• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Remote Java EE Client with JNDI Lookup for Remote Session Beans

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Creator of Enthuware JWS+ V6
Posts: 3390
311
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3390
311
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3390
311
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
aha, ok, that was the problem!

Regards,
Frits
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
ScroogeXHTML - a fast and small RTF to HTML5 and XHTML converter library
https://coderanch.com/t/742149/ScroogeXHTML-RTF-HTML-XHTML-converter
reply
    Bookmark Topic Watch Topic
  • New Topic