Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB, JNDI

 
Mamadou Touré
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Hi ,

I'm new in EJB, I creaed an EJB3 module that I package and deployed under Glassfish, but when I try to call it through a JSP servlet (by using the DI with @EJB annotation), I got an error, so should I declare something in the JNDI.

HEre is the error
bean.HelloWorldBean@null@bean.HelloWorldBean@Session@null into class servlet.ServletClient at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387) at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206) at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117) at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259) ... 31 more Caused by: javax.naming.NameNotFoundException: bean.HelloWorldBean#bean.HelloWorldBean not found at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216) at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HEre is the error
bean.HelloWorldBean@null@bean.HelloWorldBean@Session@null into class servlet.ServletClient at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387) at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206) at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117) at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259) ... 31 more Caused by: javax.naming.NameNotFoundException: bean.HelloWorldBean#bean.HelloWorldBean not found at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216) at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)


-One reason could be that you are using name param in @Stateless tag (& name is different from class name) but you are using class name for @EJB (it's just a wild guess).
I think if you share the code (please used code tag), it would be helpful to get the reason for error message.

thanks.

 
Mamadou Touré
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
Below are the error I got, my EJB code and my servlet Code.

what do I forget ?
État HTTP 500 -

--------------------------------------------------------------------------------

type Rapport d'exception

Message

DescriptionLe serveur a rencontré une erreur interne () qui l'a empêché de remplir cette requête.

Exception

javax.servlet.ServletException: PWC1391 : Servlet.init() pour le servlet HelloWorldServlet a émis une exception.
Cause racine

java.lang.RuntimeException: WEB5002 : Exception dans handleBeforeEvent.
Cause racine

com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref webpackage.HelloWorldServlet/hwb@jndi: beanpackage.HelloWorldBean@null@beanpackage.HelloWorldBean@Session@null into class webpackage.HelloWorldServlet
Cause racine

javax.naming.NameNotFoundException: beanpackage.HelloWorldBean#beanpackage.HelloWorldBean not found
note Les suivis de pile complets de l'exception et de ses causes principales sont disponibles dans les journaux Sun GlassFish Enterprise Server v2.1.


and here is the Code for my bean:


Here is my servlet that call my EJB
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Removed the technically wrong reply.
DJ
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic