• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I get an instance of a Stateless Session EJB deployed alone in Glassfish, from a Servlet?

 
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using Glassfish (Sun Java System Application Server 9.1_01 (build b09d-fcs)).
I've deployed an EJB (Stateless Session Bean) in "Applications>EJB Modules" in Glassfish.
I want to access this EJB from a Servlet, which is deployed in a war file.

The following errors are rising:

com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref
javax.naming.NameNotFoundException:


My code:

Servlet:



EJB:



sun-ejb-jar.xml:



in web.xml I put:


What should I do to make this work?
 
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm really surprised, a guy with this amount of certifications in the title not being capable of deploy / use an EJB?

First of all you should not use a reference to your EJB class directly, instead use your LDAPLocal within the servlet. Try it and tell us if it works.
 
Rogerio Kioshi
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayr Motta wrote:I'm really surprised, a guy with this amount of certifications in the title not being capable of deploy / use an EJB?

First of all you should not use a reference to your EJB class directly, instead use your LDAPLocal within the servlet. Try it and tell us if it works.



Yes, but I like testing the knowledge of my Javaranch friends

I changed to LDAPLocal, but it is not even deploying (war file)...
 
Jayr Motta
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's not even deploying then your problem is bigger than just referring the right interface while injecting your EJB. Figure out why are you having problem with this and then you may try to inject as I told you.

Do you have a .ear with an application.xml? You're packaging your EJB's in this war?
 
reply
    Bookmark Topic Watch Topic
  • New Topic