• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote Java EE Client with JNDI Lookup for Remote Session Beans

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source:OCP JavaEE 6 EJB Developer Study Notes by Ivan A Krizsan


I was trying to get reference to EJB(StatefulSession1Bean) using JNDI lookup for Remote-Client for same example as mentioned in 5.2.2. Remote Java EE Client with Dependency Injection with the below changes:

RemoteEJBClientServlet



I am seeing the following exception in server logs:



Please advise on the possible solution for the issue.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2173
57
Android Chrome Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohit,

Did you check the console log when starting up your application? You will find the global JNDI names being logged.

There is one small mistake though in your setup: In the PostConstruct method you only have JNDI access to "java:comp/env" (check chapter 4.6.1 table 1)

Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the console log when starting up your application? You will find the global JNDI names being logged.


These were the JNDI names seen at startup of application:


There is one small mistake though in your setup: In the PostConstruct method you only have JNDI access to "java:comp/env" (check chapter 4.6.1 table 1)


I couldn't find any table under section:chapter 4.6.1 table 1(OCP JavaEE 6 EJB Developer Study Notes by Ivan A Krizsan,Version: April 8, 2012)
Also,I see that java:global,java:app,java:module can be used under PostConstruct method as mentioned under example (5.1.3. Local Session Bean Client with JNDI Lookup)
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2173
57
Android Chrome Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't find any table under section:chapter 4.6.1 table 1(

Sorry, I meant the ejb-specs chapter 4.6.1 table 1, but I now see that the PostConstruct is inside a Servlet (and not an EJB) so never mind this table as it is not relevant anymore...

Hmmmm... you are getting a NameNotFoundException, although it looks like you are using the correct name (btw I don't see the definition of your EJB)
Is the EJB packaged in the war or is it packaged in a separate jar?
Have you tried doing the lookup from the doGet() ? It looks like the global name is not yet available in the server.

Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits,

The Programs works fine now.
I was removing the RemoteSessionBean project from Add and Remove(Run on a Server) window on starting the RemoteEJBClientServlet on GlassFish Server.
The problem is resolved now
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2173
57
Android Chrome Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aha, ok, that was the problem!

Regards,
Frits
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic