Re: Re: EJB injection issues from .WAR classes?

"Hans J. Prueller" <[email protected]> Mon, 07 Feb 2011 09:31:14 +0100
Newsgroups gmane.comp.java.objectweb.jonas
Organization LBS logics GmbH
Message-ID <1297067474.2009.4.camel@smithers>
Guillaume,

thank you for this tip -- I assumed something like that but as my
experience with Java EE 5 is very limited (as we were stuck on JOnAS 4
until now).

The Framework (WEbWork) is a rather old release, we have planned to
migrate webwork to JSF so we won't upgraded extend the WebWOrk stuff.

WebWork supports injection of Components, which is the way we handle
EJB2.1 lookup  in the current release. As far as I know there is some
kind
of "compatibility" layer available for EJB3 session beans, also defining
a local/remote Home interface for the "classical lookup" like ejb2.1 -
is
that supported by JOnAS 5.2 ???

What about JSF Backing Beans / Managed Beans --  injection should work
there I guess?

regards,
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
(unnamed) (image/png, 1 KB) - not displayed