Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Inject beans from one EJB module into another

843830Nov 24 2007 — edited Nov 25 2007
I'm wondering if there is a way to inject beans from one EJB module into another. Obviously, you can't just use the plain @EJB annotation, otherwise you'll get an error such as the following at runtime:
Exception occured in J2EEC Phasejava.lang.IllegalArgumentException: Referencing error: This bundle has no bean of name [LogEJBBean]
com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment descriptors for module [VCMarkWeb] -- Referencing error: This bundle has no bean of name [LogEJBBean]
        at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:390)
...
Some ideas that come to mind are:

1. using the 'name=' parameter and specifying the JNDI name of the bean in question (though I'm not sure how it would get registered in the first place)
1.5 Perhaps the @Resource annotation would be useful instead??
2. I suppose another option would be to attach needed beans to the EJBContext, but this sounds kinda hackish and could possibly cause clustering problems...
3. I bet I could put something in ejb-jar.xml, but I have no idea what, and I'd really prefer not to manage another xml configuration file if I can avoid it.

Anyway, I'm wondering if anybody has done this, and if there is an intended way within the EJB3.0 spec to do this sort of thing, since it's not jumping out at me.

Thanks for reading! Any advice is appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2007
Added on Nov 24 2007
1 comment
227 views