aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Exception while deploying the app: Invalid ejb jar: it contains zero ejb. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Exception while deploying the app: Invalid ejb jar: it contains zero ejb. " Watch "Exception while deploying the app: Invalid ejb jar: it contains zero ejb. " New topic
Author

Exception while deploying the app: Invalid ejb jar: it contains zero ejb.

Rahman ziaur
Greenhorn

Joined: Mar 30, 2011
Posts: 23

Hi
I have two EJB Project .I am calling the project 1 from project two.when i am deploying project one its ok.But whenever i am trying to deploy Project two its giving error in glassfish.


SEVERE: Class [ Lcom/ziaur/one/SaveInfoLocal; ] not found. Error while loading [ class com.ziaur.two.InfoRedaerImpl ]
SEVERE: Exception while deploying the app [Gtwo]
SEVERE: Invalid ejb jar [Gtwo]: 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.
java.lang.IllegalArgumentException: Invalid ejb jar [Gtwo]: 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.
at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:76)
at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:128)
at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:730)
at com.sun.enterprise.deployment.Application.visit(Application.java:1768)
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:195)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:180)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:93)
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:826)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:768)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)



Please help me to resolve this problem.Thanks in advance
Rahman ziaur
Greenhorn

Joined: Mar 30, 2011
Posts: 23

My both project's implemented class are Stateless Session Bean Class.
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi,
I think you deal with a deployment exception.
Here are my tips : build a ear that contains both your projects, each project is a ejb-jar. Each ejb-jar must use @local/remote and @statefull/stateless or the equivalents in the deployment descriptor (ejb-jar.xml).
If it fails please post your ear structure.

Regards,
Mihai



SCJP, SCJD, SCWCD, OCPJBCD
Rahman ziaur
Greenhorn

Joined: Mar 30, 2011
Posts: 23

Hi Mihai Thanks a lot for reply but will you tell me how to make ear for both Project and deployment descriptor(ejb-jar.xml).I am new to EJb and i am using EJB3.0.

Thanks a lot for your kind help
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi

Ear is the top level archive for the enterprise application. If you have time you may consult the chapter 20 - named "EJB-jar File" from the specifications (JSR220).
The build methodology for this archive may depending on the underlying tools (IDE, maven, gradle, ant, etc) but the archive structure remains the same. In your case you need something like :
my.ear:
  • project1-ejb.jar
  • project1-ejb.jar


  • After your log file I presume that you use netbeans so go in File->New project->Enterprise application. After you are ready with this select the fresh create enterprise application do right click choose "Add new module".


    Regards,
    Mihai.
    Rahman ziaur
    Greenhorn

    Joined: Mar 30, 2011
    Posts: 23

    Once again Very Much thankful to you Mihai.
    I am using Eclipse IDE and dont have any building tools like Ant or Maven.I am new to this technology so facing problem.


    Any further suggestion must be appreciated.
    Thanks
     
     
    subject: Exception while deploying the app: Invalid ejb jar: it contains zero ejb.