• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Referencing EJBs in a JAR file from a WAR

Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 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.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic