You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stefano <el...@gmail.com> on 2009/04/10 14:48:34 UTC

Re: Struts and EJB 3

in struts1 what's the way to use EJB3.0?

there's no possibility to use annotation?
i need to use classical jndi? why?

thanks

On Fri, Mar 6, 2009 at 13:24, Ignacio de Córdoba <ic...@skios.es> wrote:
>
> Hi,
> I'm us¡ng JBoss and @EJB doesn't work either. Are you using Struts1 or
> Struts2? If Struts2, You can use the extension for EJB3 for Struts2. It
> works OK (interceptor).
>
>
> senderj wrote:
>>
>> My env is Netbean with Glassfish. I am able to create a servlet to call
>> EJB with this code:
>>
>> public class TryAdvise_create extends HttpServlet {
>>     @EJB
>>     AdviseFacadeRemote advBean;
>>     ......
>>     protected void processRequest(HttpServletRequest request, ........ {
>>     ......
>>         Advise adv = new Advise(123, "123 Company");
>>         advBean.create(adv);
>>
>> It works great. But when doing the same on a Struts Action:
>>
>> public class TryAdviseAction extends Action {
>>     @EJB
>>     AdviseFacadeRemote advBean;
>>     ......
>>     public ActionForward execute(ActionMapping mapping, ......... {
>>         Advise a = advBean.find(new Long(1));
>>
>> advBean is always null. Why? Please help.
>>
>
> --
> View this message in context: http://www.nabble.com/Struts-and-EJB-3-tp22368697p22369485.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and EJB 3

Posted by Stefano Tranquillini <st...@gmail.com>.
Yes, i'll try to use, but the ejb with annotation gives me a
nullpointer exception.
i've to call the ejb using the old style jndi call.

On Fri, Apr 10, 2009 at 15:25, Lukasz Lenart
<lu...@googlemail.com> wrote:
> 2009/4/10 Stefano <el...@gmail.com>:
>> in struts1 what's the way to use EJB3.0?
>>
>> there's no possibility to use annotation?
>> i need to use classical jndi? why?
>
> You can use annotations with Struts1, is not a problem with framework
> but with Java platform you're using. THe best solution is to use
> Spring to connect Struts1 Actions with EJB3 beans.
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and EJB 3

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/4/10 Stefano <el...@gmail.com>:
> in struts1 what's the way to use EJB3.0?
>
> there's no possibility to use annotation?
> i need to use classical jndi? why?

You can use annotations with Struts1, is not a problem with framework
but with Java platform you're using. THe best solution is to use
Spring to connect Struts1 Actions with EJB3 beans.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org