wood burning stoves
The moose likes EJB and other Java EE Technologies and the fly likes JNDI Lookup Failing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JNDI Lookup Failing" Watch "JNDI Lookup Failing" New topic

JNDI Lookup Failing

Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43
Trying to learn EJB 3.1 on Glassfish 3 and I can't get the JNDI lookup to work. I have the following test client trying to connect to the server:

It's trying to connect this guy:

I get the following error message:

java.lang.IllegalArgumentException: Invalid ejb jar [Gnostic_Taxonomy_1.jar]: it contains zero ejb.
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:72)
at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:124)
at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:722)
at com.sun.enterprise.deployment.Application.visit(Application.java:1744)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:774)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:253)
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:222)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:152)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:79)
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:612)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:554)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)

Thing is though the project is definitely an EJB project. So perhaps the JAR file isn't being built? Or it's being built as something other than an EJB bean? The process I used was: File>New>EJB>Session Bean. I added a package name and class name and clicked remote, local and no interface boxes to 'on', then I clicked 'Next'. I added a mapped name which was the same as the bean name and clicked "Finish". When trying to run the project I just do Run As > Run on Server (Glassfish). Again, I'm a newb on Eclipse and EJBs so there's no telling if even my basic comprehension of steps/requirements is right, don't assume it is!


Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43
Anyone willing to help me on this? I've checked here: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jst.ejb.doc.user/topics/tecrtpro.html and basically the damned thing won't run. Somehow the EJB isn't being deployed into the JAR or the EAR app is failing in some way.

Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43
Do I have to tell Eclipse explicitly to build and deploy the JAR file from the EJB project or does it do it automatically when I do Run As > Run on Server??

And same question but for the JAR file getting put in the EAR file before it's deployed? That something I do explicitly or?

Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43
Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43
Can anyone tell me why I'm getting this? I'm using 3.1 annotations so I don't get why it isn't working (no xml file to mess up) I've dumped the manually created jar into Glassfish's autodeploy folder (it also gets put into eclipseApps as a non-jar folder structure) and have verified that the jar has the source/bytecode in it but I still keep getting:

java.lang.IllegalArgumentException: Invalid ejb jar [Taxonomy]: it contains zero ejb.

Also I've tried just putting a jar into "eclipseApps" and running that in case it expects a jar file.

Come on guys I could really use a hand here! Help!!
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Post the output of

Also, as the error message says, does the server.log have any additional info on annotation scanning?

[My Blog] [JavaRanch Journal]
Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43

Server's log doesn't seem to have anything more than the stack trace already provided.

Thanks for helping BTW!
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Your jar contains even the .java files. Those are not needed. You just have to package the .class files. But that shouldn't result in a deployment failure. I don't see any obvious reason why the deployment should fail. By the way, what are the contents of the META-INF/MANIFEST.MF file?

Other than that the only place where you might find some hint is the server.log file.
Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43
Thanks for the reply Jaikiran.

MANIFEST.MF contains:

Manifest-Version: 1.0
Dennis Hopfer
Ranch Hand

Joined: Dec 02, 2010
Posts: 43

Can you guys please help me figure out where I'm failing?

Happy Christmas!
I agree. Here's the link: http://aspose.com/file-tools
subject: JNDI Lookup Failing
It's not a secret anymore!