This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Referencing EJBs in a JAR file from a WAR

Nathanael Ulrick
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Despite the fact that subsequent tests reveal that what is returned is indeed a

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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!