• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use @EJB to inject an ejb?  RSS feed

 
Michael Remijan
Author
Ranch Hand
Posts: 131
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an EAR which I'm trying to deploy. The EAR has 1 module for a a jar with the ejb's in it and the EAR has 1 module for a webapp. Inside the the ejb class I use annotations which look like this:


When I deploy the EAR to jboss I can see that jboss is binding the ejb to jndi where I want it:


In the webapp, I want to inject this ejb into a class using the @EJB annotation. In the webapp I tried using @EJB(name="ejb/Portal/local") but the propery always stayed null. So I tried using an InitialContext lookup("java:comp/env/ejb/Portal/local") but that also failed with a NamingException saying that "ejb" is not found.

So what do I need to do to get at a reference to the ejb? Am I missing some xml configuration somewhere?

Thanks!
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

See this thread.

If this is still true it is just a Java EE 5 compliance shortfall in JBoss.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!