users@glassfish.java.net

Getting rid of InitialContext.lookup()

From: <forums_at_java.net>
Date: Mon, 25 Jul 2011 09:40:10 -0500 (CDT)

Our EAR is rather old (most code is from pre-EJB 3.0 era) and we'd like to
get rid of some of the old stuff. Especially the "new
InitialContext().lookup()" and <ejb-ref> is what we like to replace by
something smarter.

We have one EAR that contains one WAR and one EJB-JAR file. The WAR contains
a JAX-RS resource, with a sub-resource locator method. Inside of the
sub-resource's method, there is the code we want to replace (hence there is
the place where we like to use @EJB or @Inject).

We tried to just write "@EJB" or "@Inject" in the sub-resource but both did
not replace "null" by something useful. Then we tried writing "@Stateless" or
"@RequestScoped" above the sub-resource, but it did not help.

What is the trick?


--
[Message sent by forum member 'mkarg']
View Post: http://forums.java.net/node/825811