You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Amit Prakash Singh <am...@gmail.com> on 2010/02/03 08:51:05 UTC
Issue tomcat and OpenEJB integration
Hi All,
I have integrated openEJB with tomcat 6 and now I wanted to perform a simple
"HelloWorld" test on my integration. I can see in the openejb.log that ejb
has been deployed successfully.
2010-02-03 13:08:57,559 - INFO - Found ejb module EjbModule in war /scbcd
2010-02-03 13:08:57,699 - INFO - Configuring enterprise application:
C:\tomcat\webapps\scbcd
2010-02-03 13:08:58,337 - INFO - Enterprise application
"C:\tomcat\webapps\scbcd" loaded.
2010-02-03 13:08:58,337 - INFO - Assembling app: C:\tomcat\webapps\scbcd
2010-02-03 13:08:58,353 - INFO - Jndi(name=HelloUserBeanLocal) -->
Ejb(deployment-id=HelloUserBean)
2010-02-03 13:08:58,353 - INFO - Created Ejb(deployment-id=HelloUserBean,
ejb-name=HelloUserBean, container=My Stateless Container)
2010-02-03 13:08:58,353 - INFO - Deployed
Application(path=C:\tomcat\webapps\scbcd)
However, when I call this ejb in my client it doesn't seems to get hold of
the deployed bean. My client is a simple Struts action as shown below:
ejbAction.java
package com.scbcd.struts.actions;
import javax.ejb.EJB;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.ejb.stateless.*;
public final class ejbAction extends Action
{
@EJB
private HelloUser helloUser;
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
{
String message = "Hello Guest!";
if (helloUser!=null)
message = helloUser.sayHello();
request.setAttribute("message",message);
return mapping.findForward("success");
}
}
Also, please note that I have packaged the EJB in a separate jar file which
has been placed in the Struts app's lib folder.
Please assist me getting this resolved.
Thanks
Amit
Re: Issue tomcat and OpenEJB integration
Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hi,
Not sure to understand the problem.
Can you provide more information?
For example, the business ejb didn't get injected in the Struts action.
BTW, who is in charge of injecting JEE components (EJB) into non JEE
components (Struts Action)?
AFAIK, it's only possible using managed beans (JSR 299 - CDI for JEE).
Jean-Louis
Amit Prakash Singh wrote:
>
> Hi All,
>
> I have integrated openEJB with tomcat 6 and now I wanted to perform a
> simple
> "HelloWorld" test on my integration. I can see in the openejb.log that ejb
> has been deployed successfully.
>
> 2010-02-03 13:08:57,559 - INFO - Found ejb module EjbModule in war /scbcd
> 2010-02-03 13:08:57,699 - INFO - Configuring enterprise application:
> C:\tomcat\webapps\scbcd
> 2010-02-03 13:08:58,337 - INFO - Enterprise application
> "C:\tomcat\webapps\scbcd" loaded.
> 2010-02-03 13:08:58,337 - INFO - Assembling app: C:\tomcat\webapps\scbcd
> 2010-02-03 13:08:58,353 - INFO - Jndi(name=HelloUserBeanLocal) -->
> Ejb(deployment-id=HelloUserBean)
> 2010-02-03 13:08:58,353 - INFO - Created Ejb(deployment-id=HelloUserBean,
> ejb-name=HelloUserBean, container=My Stateless Container)
> 2010-02-03 13:08:58,353 - INFO - Deployed
> Application(path=C:\tomcat\webapps\scbcd)
>
> However, when I call this ejb in my client it doesn't seems to get hold of
> the deployed bean. My client is a simple Struts action as shown below:
>
> ejbAction.java
>
> package com.scbcd.struts.actions;
> import javax.ejb.EJB;
> import org.apache.struts.action.*;
> import javax.servlet.http.*;
> import com.ejb.stateless.*;
> public final class ejbAction extends Action
> {
> @EJB
> private HelloUser helloUser;
>
> public ActionForward execute(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response) throws Exception
> {
> String message = "Hello Guest!";
> if (helloUser!=null)
> message = helloUser.sayHello();
> request.setAttribute("message",message);
> return mapping.findForward("success");
> }
>
> }
>
>
> Also, please note that I have packaged the EJB in a separate jar file
> which
> has been placed in the Struts app's lib folder.
>
> Please assist me getting this resolved.
>
> Thanks
> Amit
>
>
--
View this message in context: http://n4.nabble.com/Issue-tomcat-and-OpenEJB-integration-tp1460967p1461000.html
Sent from the OpenEJB User mailing list archive at Nabble.com.