File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Problems Injecting EJB from Jar to Servlet in War  JBoss 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problems Injecting EJB from Jar to Servlet in War  JBoss 7" Watch "Problems Injecting EJB from Jar to Servlet in War  JBoss 7" New topic
Author

Problems Injecting EJB from Jar to Servlet in War JBoss 7

Lukas Kavofil
Greenhorn

Joined: Jun 30, 2012
Posts: 7

Hi. I have a problem I just cant specify for JBoss to inject the Stateless bean found in deployed jar on the server ( ejbexample.FooRemote) to the servlet which is to be deployed in different war file.

I use norma annotation @EJB and even tried @EJB(mappedName="ejbexample.FooRemote") with no result. Still I have either problems deploying the app or running the servlert with this dependency injection.

This works if I have the whole ejbexample package in the WEB-INF/classes of the war file.

I use a remote client written in POJO to access the bean via JNDI lookup and therefore I know that the app si deployed and running correctly.

Of course I have ejbexample package also in war file in order to have FooRemote interface, but I dont have FooBean there.

How shold I tell the container to find the correct EJB to inject ?

EDIT: To provide you with more accurate information here are annotations for FooRemote and FooBean:


@Remote
public interface FooRemote {...

@Stateless
public class FooBean implements FooRemote {.....

.

Thanks.


Degree in finance. Java/programming enthusiast. OCJP.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems Injecting EJB from Jar to Servlet in War JBoss 7