Splitting EJBs and Interfaces into a Separate Module - Deployment Fails

I am having problems with this guide to “extract” my interfaces and entities from my EAR, so that I can use them from another web application:

  • I am using NetBeans 6.8 and Glassfish 3.0.1.
  • Java Class Library Project
    • contains all objects and interfaces
  • Project "Java EE Application"
    • the class library added to the project is packaged in an EAR
    • contains implementations of EJB, MDB, Test
  • Project "Java Web Application"
    • class library added to project packaged in WAR
    • contains a REST interface

When I create and deploy a web application, everything goes well.

When I create a Java EE application, I see that the jar file (interfaces, entities) are included. But when I try to deploy the EAR, Glassfish refuses it with the java.lang.NoClassDefFoundError error:

[#|2010-03-28T18:25:59.875+0200|WARNING|glassfishv3.0|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=28;_ThreadName=Thread-1;|Error in annotation processing: java.lang.NoClassDefFoundError: mvs/core/StoreServiceLocal|#]

[#|2010-03-28T18:25:59.876+0200|SEVERE|glassfishv3.0|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=28;_ThreadName=Thread-1;|Exception while deploying the app
java.lang.IllegalArgumentException: Invalid ejb jar [CoreServer]: it contains zero ejb. 
Note: 
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean. 
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar. 
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.

'mvs / core / StoreServiceLocal' is the interface that is defined in the library jar file.

What am I doing wrong?

I use EJB3 annotations, so there is no bean descriptor descriptor:

MVS / core /ShopperService.java:

@Stateless
public class ShopperService implements ShopperServiceLocal, ShopperServiceRemote {
}

MVS / core /ShopperServiceLocal.java:

@Local
public interface ShopperServiceLocal {
}
+3
source share
2 answers

" Java EE Application" ( , , NoClassDefFoundError). EJB webapp, "" ( ).

+4

EAR , . "" EAR WAR ( -) JAR , EJB ( EJB). EJB, .

EJB, EJB lite ( EJB 3.1) WAR, . WAR EJB , . WAR. EJB lite , EJB - .

EJB, EAR . EAR WAR - JAR EJB-.

+1

Source: https://habr.com/ru/post/1738870/


All Articles