Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Embedded container example in EJB Cookbook does not work

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying the embedded container example in EJB 3.1 Cookbook by Reese.
I think it may be because NetBean platform's embedded container cannot look up the bean.


When I ran it on NetBean Platform 8 , it says

CapitalApplication was successfully deployed in 4,976 milliseconds.
javax.naming.NamingException: Lookup failed for 'java:global/CapitalApplication/CapitalBean'
in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: CapitalBean not found]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
....
Caused by: javax.naming.NameNotFoundException: CapitalBean not found
at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:237)
...8)

fileStructure.jpg
[Thumbnail for fileStructure.jpg]
File Struture of the Bean and embedded container application
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also tried a different approach based on the JSR 318 chapter 21.
I guess the embedded container in Glassfish does not work.


I got a different error message:

properties: {javax.ejb.embeddable.modules=C:\Downloads\2381_Code\2381_01_Code\CapitalApplication\dist\CapitalApplication.jar}
Feb 28, 2015 11:27:11 PM org.glassfish.ejb.embedded.EJBContainerProviderImpl createContainer
INFO: [EJBContainerProviderImpl] Using installation location C:\Program Files\glassfish-4.1\glassfish
Feb 28, 2015 11:27:11 PM org.glassfish.ejb.embedded.EJBContainerProviderImpl createContainer
...
INFO: Authorization Service has successfully initialized.
....
...
Exception in thread "main" javax.ejb.EJBException: Modules: [CapitalApplication] do not match an entry in the classpath
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.addModules(EJBContainerProviderImpl.java:297)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:130)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
at embeddablecontainerapp.Main.main(Main.java:30)
Java Result: 1
BUILD SUCCESSFUL (total time: 6 seconds)

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic