Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rogerio Kioshi
Ranch Hand
Posts: 690
  • Mark post as helpful
  • send pies
  • 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?
 
Jayr Motta
Ranch Hand
Posts: 110
Google App Engine Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • 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: 690
  • Mark post as helpful
  • send pies
  • 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 App Engine Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic