Re: Re: Re: EJB injection issues from .WAR classes?
Guillaume Sauthier <[email protected]> Mon, 07 Feb 2011 13:12:03 +0100
| Newsgroups | gmane.comp.java.objectweb.jonas |
|---|---|
| Organization | Objectweb Consortium |
| Message-ID | <[email protected]> |
Yep, legacy (using JNDI lookups) "injection" will work. If you don't specify the mapped name, the Easybeans default JNDI name is <bean-class>_<interface-class>@Remote (or @Local), with class specified using their FQN. --G Le 07/02/2011 11:07, Hans J. Prueller a écrit : > if injection is not performed by the container, > > EJB lookup should work via: > > Context.lookup(<mappedName>) > > when I declare my EJB's with: > > @Stateless(mappedName=<mappedName>) > > > I think that should work in Web-Frameworks without container-based > injection too ?? > > hans > > Am Montag, den 07.02.2011, 09:26 +0100 schrieb Guillaume Sauthier: >> Hi Hans >> >> A Java EE container is only required to manager @EJB in Java EE >> managed components (Servlet, Filter, ...). >> Here you have an @EJB in some framework managed classes. >> JOnAS (and any other container) will not inject anything for you >> here, this is the job of the framework to do that. >> >> Maybe there is a webwork extension that will add support for this ? >> >> --G >> >> >> Le 06/02/2011 09:50, Hans J. Prueller a écrit : >>> Hi JOnAS Team! >>> >>> Meanwhile I have set up a Testproject and (partially) migrated our >>> Java EE 1.4 based EAR to Java EE 5 (finally!). >>> Basically things work, I can deploy the EAR to JOnAS 5.2 with success. >>> >>> >>> One major problem I have is that the injection of EJB's into the >>> .WAR-File classes not always works and I do not know why ? >>> >>> >>> E.g. there are 2 classes in the WAR file, in one case the EJB >>> injection works in the other case NOT (the reference to the EJB >>> simply is NULL all the time): >>> >>> case 1) classical Servlet class (Extends HttpServlet) IMSAppServ.java: >>> >>> member variable: >>> >>> @EJB >>> static IMSSystem imssys; >>> >>> >>> -- when accessing imssys in doGet etc. methods -- it is already >>> injected correctly and I can invoke the EJB methods (SLSB) >>> >>> >>> case 2) we are using WebWork as WebApp Framework instead of "pure >>> servlet programming", something similar to struts. webwork >>> handles requests in so called "Action classes"; there is for >>> instance the "HomeAction.java": >>> >>> member variable: >>> @EJB >>> IMSSystem imssys; >>> >>> --- when accessing imssys in the "execute" method of the action >>> class, it ALWAYS IS NULL and causes NPE's and follow up errors ... >>> >>> >>> >>> >>> _I assumed that the EJB's should be injected anywhere I put the >>> @EJB annotation in one of the classes contained in the WAR -- am I >>> wrong_ >>> _with this ? so what is required to get working @EJB injections also >>> in our WebWork based or any other classes ?_ >>> >>> as I didn't found much in the docs regarding this issue, help is >>> appreciated! ;-) >>> >>> regards, >>> HANS >
Guillaume_Sauthier.vcf
(text/x-vcard, 398 B)
begin:vcard fn:Guillaume Sauthier n:Sauthier;Guillaume org:<a href="http://www.ow2.org"><img title="OW2" alt="OW2 Consortium" border="0" src="http://www.ow2.org/xwiki/bin/skin/XWiki/DefaultSkin/logoOW2.png" /></a> adr:;;;;;;France email;internet:[email protected] title:<a href="http://jonas.ow2.org">JOnAS Application Server</a> url:http://jonas.ow2.org version:2.1 end:vcard