aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Referencing EJBs in a JAR file from a WAR 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 "Referencing EJBs in a JAR file from a WAR " Watch "Referencing EJBs in a JAR file from a WAR " New topic
Author

Referencing EJBs in a JAR file from a WAR

Nathanael Ulrick
Greenhorn

Joined: Jul 17, 2001
Posts: 22
Not sure how to access a session EJB which has been deployed in a separate JAR file from a WAR.
My files look like this:

(Where the jndi-name MyJNDI is that of the bean in the JAR.)
This results in

during the deployment of the WAR. No difference even if I wrap the JAR and the WAR in an EAR file.

Removing the <ejb-ref> tag in web.xml allows the deployment to go ahead, but then the context lookup to java:comp/env/ejb/MyEJB fails. ejb not bound, it says.

I've tried to do a context lookup on the JNDI name of the bean directly. This works, but only on startup of JBoss. Any subsequent redeploy results in a ClassCastException on lookup, such as:
Couldn't cast class $Proxy62 into interface foo.bar.MyEJBHome
Despite the fact that subsequent tests reveal that what is returned is indeed a foo.bar.MyEJBHome.

So this leads me to suspect that I'm not supposed to be doing a direct lookup anyway.

Using JBoss 3.0.4. Any help appreciated.
N
 
wood burning stoves
 
subject: Referencing EJBs in a JAR file from a WAR