tags:

views:

884

answers:

1

I have a simple j2ee application:

foo.ear
 - foo.war
 - foo.jar (ejb3 jar)

I am deploying into jBoss 4.2.2, which is J2EE 1.4 compliant, with an ejb3 jar deployer. Thus, at present it is not possible to use the @EJB annotation in servlets. In a regular 1.4 j2EE app I could use a <ejb-local-ref> element in my web.xml, however, because my ejb's are v3 they have no <local-home> interface. Can anyone suggest a JEE compliant way to look up my ejb from the a servlet, without resorting to a platform specific JNDI lookup?

+1  A: 

The answer is no. You must use the global JNDI name:

@EJB annotations are usable in servlets and JSPs, but unfortunately, we have not yet updated tomcat to support it. Also, Tomcat works with the old XML format so you cannot use XML either. So for now, you must lookup the EJB via its global JNDI name.

See the jBoss doc's for further details.

johnstok