payara / Payara

Payara Server is an open source middleware platform that supports reliable and secure deployments of Java EE (Jakarta EE) and MicroProfile applications in any environment: on premise, in the cloud or hybrid.
http://www.payara.fish
Other
880 stars 301 forks source link

EAR deployment results in "zero ejb" #2273

Closed OndroMih closed 6 years ago

OndroMih commented 6 years ago

Description


I am working in Eclipse EE Neon, created an EJB project with a TimerBean (@Stateless) en added an EAR project. The EAR project has the TimerBean int its deployment assembly. Then I am running the exported EAR-file on my Raspberry Pi (Model B Rev 2) with Payara Micro like this:

java -jar ./payara-micro-4.1.2.173.jar --deploy ./EAR.ear

Expected Outcome

TimerBean is started as should, no problems at all. (The timer starts periodically printing the deisgnated output to the console)

Current Outcome

Unfortunately this result in the following ...

[2017-10-31T11:50:31.835+0100] [] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1509447031835] [levelValue: 1000] Exception while deploying the app [EAR                                                                    ]

[2017-10-31T11:50:31.842+0100] [] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1509447031842] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.IllegalArgumentException: Invalid ejb jar [EAR]: 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 org.glassfish.ejb.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:147)
        at org.glassfish.ejb.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:112)
        at com.sun.enterprise.deployment.BundleDescriptor.visit(BundleDescriptor.java:627)
        at org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl.visit(EjbBundleDescriptorImpl.java:767)
        at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:121)
        at com.sun.enterprise.deployment.BundleDescriptor.visit(BundleDescriptor.java:627)
        at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:236)
        at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:189)
        at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:223)
        at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:91)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:882)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:822)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:379)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:488)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:544)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:360)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:539)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:570)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:562)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:360)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:561)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1469)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1727)
        at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:134)
        at fish.payara.micro.impl.PayaraMicroImpl.deployAll(PayaraMicroImpl.java:1396)
        at fish.payara.micro.impl.PayaraMicroImpl.bootStrap(PayaraMicroImpl.java:993)
        at fish.payara.micro.impl.PayaraMicroImpl.main(PayaraMicroImpl.java:186)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at fish.payara.micro.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:107)
        at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:70)
        at fish.payara.micro.boot.PayaraMicroLauncher.main(PayaraMicroLauncher.java:79)
        at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:361)
]]

[2017-10-31T11:50:32.015+0100] [] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1509447032015] [levelValue: 1000] [[
  Exception while deploying the app [EAR] : Invalid ejb jar [EAR]: 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.]]

Steps to reproduce (Only for bug reports)

Build the sample project ResourcesMicro.zip with Eclipse EE Neon (maybe it's enough to build simply by maven) and run

java -jar ./payara-micro-4.1.2.173.jar --deploy ./EAR.ear

Werid thing is ... when I export the project with the TimerBean as a .jar the TimerBean is started as should, no problems at all. (The timer starts periodically printing the deisgnated output to the console)

Samples

This ResourcesMicro.zip

Context (Optional)

Previously discussed in the Payara Forum here.

Environment

suchwerk commented 6 years ago

I have the same issue with payara-5.Beta1(full) and a war project. i can deploy it in netbeans but not in my dockerimage.

i use a postbootcommandfile contaniing deploy /opt/deploy/ while starting payara with asadmin asadmin start-domain --verbose --postbootcommandfile ${INSTALL_DIR}/deploy-command ${DOMAIN_NAME}

suchwerk commented 6 years ago

Same with payara-5.Beta2.

suchwerk commented 6 years ago

Sorry, my bad. The depoly command (as stated) was wrong. The name of the war file was missing. At least the error message is kind of confusing as the war file could not be found.

TickleThePanda commented 6 years ago

I'm seeing the same problem as this. Deploying an ear (made of multiple component jar ejbs) gives the same error but deploying an individual jar is fine.

TickleThePanda commented 6 years ago

I've taken a look into this further.

Payara Micro does not have org.glassfish.main.deployment:deployment-javaee-full as a dependency, therefore there's no EarDetector (and the other ear deployment classes) available when getArchiveHandler is called for the ear. This means that the archive is then determined to be an ejb.

If org.glassfish.main.deployment:deployment-javaee-full is included as a dependency (which then needs org.glassfish.main.applclient.server:appclient-connector), I can then deploy ear packages.

smillidge commented 6 years ago

Payara Micro doesn't support EAR files currently as it is based off Web Profile which does not include EAR file support.

MaryemJaouadii commented 8 months ago

I had similar problem when deploying an ear file on payara and it keeps showing it contains zero ejb. My project was with JDK 17 so I looked for what minimum maven version that is compatible with this version. I found that I was using old version so when I upgraded it to 3.9.6 ( minimum is 3.8+) it was deployed successfully.