RE: Struts2 Action Class and EJB Injection

2009-07-16 Thread Martin Gainty
ous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Thu, 16 Jul 2009 07:16:14 +0200 > From: ro...@mtndesigns.co.uk > To: user@struts.apache.org > Subject: Re: Struts2 Action Class and EJB Injection > > Thanks for the example. I shall download the source

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Robin Mannering
Thanks for the example. I shall download the source and give it a go. Thanks again. Nathan Schulte wrote: Robin Mannering mtndesigns.co.uk> writes: Can you please tell me how you obtained the EJB plugin and a short example of using it. I would prefer to use this if possible. Sorr

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Nathan Schulte
Robin Mannering mtndesigns.co.uk> writes: > Can you please tell me how you obtained the EJB plugin and a short > example of using it. > > I would prefer to use this if possible. Sorr, I misspoke earlier. I'm actually using the EJB3 JBoss Plugin, from here http://cwiki.apache.org/S2PLUGINS/ejb3

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Robin Mannering
Can you please tell me how you obtained the EJB plugin and a short example of using it. I would prefer to use this if possible. Nathan Schulte wrote: Robin Mannering wrote: Is there anybody that is using Struts2 as the 'frontend' to an EJB 3 'backend' and what solution do you currently emp

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Nathan Schulte
Robin Mannering wrote: > Is there anybody that is using Struts2 as the 'frontend' to an EJB 3 > 'backend' and what solution do you currently employ. I am using the described setup, yes. Our solution was to use the mentioned EJB3 plugin and it's @InjectEJB annotation. It works well, I have not h

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Robin Mannering
Yes, using annotations would be the ideal method. I think I remember reading that declaring beans as 'remote' when this is not that case, may cause unnecessary serialization/deserialization as calls are supposedly being made remotely. Depending on the EJB app server configuration. Obviously

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Wes Wannemacher
I don't see anything wrong with that. I'd still like to eventually create a plugin that removes the need to do that in your execute method. The EJB spec added those annotations, so I'd like to figure out a way to honor them (cleanly). -Wes On Wed, Jul 15, 2009 at 10:37 AM, Robin Mannering wrote:

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Robin Mannering
Hi Wes, I found a resource on the web that seems to be a simpler solution: InitialContext ic = new InitialContext(); UserServiceBeanLocal userService = (UserServiceBeanLocal) ic.lookup(UserServiceBeanLocal.class.getName()); As in the web resource I found, it was necessary to change @Local to

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Wes Wannemacher
You are right, there is only one, the other one in that list is a jboss-ejb plugin. Take a look at the source for the plugin, it is not particularly complex and I know the author is lurking around here somewhere. I would suggest that you do one of two things - 1. Create an interceptor, probably ide

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Robin Mannering
Many thanks for the prompt and detailed reply. I understand why the use of injection does not work now within a Struts2 action class. However, there only seems one EJB plugin available, which doesn't actually have a download available and hasn't had for some time it appears. http://code.goo

Re: Struts2 Action Class and EJB Injection

2009-07-15 Thread Wes Wannemacher
The difference is that the container did not instantiate your struts action, struts did. There are EJB plugins available, check the plugin registry. http://cwiki.apache.org/S2PLUGINS/home.html The ones I have seen are based on injection via interceptor. I've toyed with the notion of creating an O

Struts2 Action Class and EJB Injection

2009-07-15 Thread Robin Mannering
Hello, Platform : Struts 2, EJB 3.0, Glassfish 2.1 I wish to obtain a reference to an EJB using injection. This works fine within a servlet, but from within a Struts2 action class, all references to injected EJB variables hold a 'null' reference. I've included a portion of my action class be