aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Problem in integrating EJB3.0 with Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problem in integrating EJB3.0 with Struts" Watch "Problem in integrating EJB3.0 with Struts" New topic
Author

Problem in integrating EJB3.0 with Struts

Neha k Agrawal
Greenhorn

Joined: Mar 25, 2008
Posts: 25
Hello Experts,
I am facing some problem in integration of struts 1.2.9 with EJB 3.0.I am using Netbeans 6.0.I have Deployed & undeployed the EJB module.I have also added the EJB module project as a jar file in my client project.I have already googled this error but didn't find anything useful.Please help.Many Thanks in advance.


This is my stateless bean




This is my local interface





This is my client(Struts's Action class)



This is the error I am getting
Deploying application in domain failed; Error loading deployment descriptors for module [IMS_1] -- Cannot resolve reference Unresolved Ejb-Ref com.myapp.struts.LoginAction/loginSessionLocal@jndi: @null@IMS_EJB.LoginSessionLocal@Session@null
Deployment error:
The module has not been deployed.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:163)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor335.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:157)
... 16 more
Harshi Gunarathna
Greenhorn

Joined: Oct 26, 2008
Posts: 8
hi..I am also having the same kind of a problem. I have added the EJB3 module to a web project and trying to call methods in a stateless session bean through remote interface.

Here is the error:
Deploying application in domain failed; Error loading deployment descriptors for module [Merchants] -- Cannot resolve reference Unresolved Ejb-Ref com.mjoy.cp.interfaces.ReservationCPInterfaceBean/ticketReservationBean@jndi: @null@com.mjoy.cp.reservation.TicketReservationLocal@Session@null
Deployment error:
The module has not been deployed.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:160)
... 16 more
BUILD FAILED





If somebody know the answer pleas help.

Thank you.
Afzal Hossain
Greenhorn

Joined: Jan 02, 2006
Posts: 25
Hi Neha,

I think you have to look up EJB from JNDI if you want to use it in Struts Action class. The Dependency Injection only works if the class is managed by the container. For instance , it is possible to use annotated dependency injection in Servlet, Listener, Tag Handler or any EJB. Therefore the struts Action instance is not managed by container so you can not directly use Annotated dependency.

And for the best practice you should use ServiceLocator design pattern for the JNDI lookup.

Thanks


Afzal
vitesse wei
Ranch Hand

Joined: Sep 07, 2007
Posts: 100
Although.It is a pretty old thread,but lots people googled this page for a solution
I find one,and attach here for future people reference.
this is referenced from glassfish2 Q/A

I have an EJB component with a Local interface. Can I access it from a web component in a different application?

No. The EJB specification only requires access to an EJB component's local EJB interface from within the same application in the same JVM. One option is to package the ejb-jar in the same .ear as the .war. A second option, if using GlassFish v3, is to package the EJB component directly within the .war.


SCJP 5.0<br />SCWCD1.4<br />SCBCD5
 
wood burning stoves
 
subject: Problem in integrating EJB3.0 with Struts