-
1. Re: EJB3 and Struts2 with CDI
rop Apr 5, 2011 5:15 AM (in response to rop)I think this error was, because you also need an empty beans.xml in the ejb-jar.
So I fixed that, but then got the errors below.
What is actually required for these @Named and @Inject annotations to work between two different modules in the same ear-file ?
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss-injector:topLevelUnit=foobar-ear-0.0.1.ear,unit=foobar-ejbapp-0.0.1.jar,bean=FoobarMgr,interceptor=org.jboss.weld.integration.ejb.SessionBeanInterceptor" is missing the following dependencies:
Dependency "<UNKNOWN jboss-injector:topLevelUnit=foobar-ear-0.0.1.ear,unit=foobar-ejbapp-0.0.1.jar,bean=FoobarMgr,interceptor=org.jboss.weld.integration.ejb.SessionBeanInterceptor>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss-switchboard:appName=foobar-ear-0.0.1,module=foobar-ejbapp-0.0.1,name=FoobarMgr' **")
Deployment "jboss-injector:topLevelUnit=foobar-ear-0.0.1.ear,unit=foobar-ejbapp-0.0.1.jar,bean=FoobarMgr,interceptor=org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor" is missing the following dependencies:
Dependency "<UNKNOWN jboss-injector:topLevelUnit=foobar-ear-0.0.1.ear,unit=foobar-ejbapp-0.0.1.jar,bean=FoobarMgr,interceptor=org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss-switchboard:appName=foobar-ear-0.0.1,module=foobar-ejbapp-0.0.1,name=FoobarMgr' **")
Deployment "jboss-switchboard:appName=foobar-ear-0.0.1,module=foobar-ejbapp-0.0.1,name=FoobarMgr" is missing the following dependencies:
Dependency "java:global/cdi/foobar-ear-0.0.1/foobar-ejbapp-0.0.1/BeanManager" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'java:global/cdi/foobar-ear-0.0.1/foobar-ejbapp-0.0.1/BeanManager' **")
Deployment "jboss-switchboard:appName=foobar-ear-0.0.1,module=foobar-webapp-0.0.1" is missing the following dependencies:
Dependency "java:global/cdi/foobar-ear-0.0.1/foobar-webapp-0.0.1/BeanManager" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'java:global/cdi/foobar-ear-0.0.1/foobar-webapp-0.0.1/BeanManager' **")
Deployment "jboss.j2ee:ear=foobar-ear-0.0.1.ear,jar=foobar-ejbapp-0.0.1.jar,name=FoobarMgr,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:ear=foobar-ear-0.0.1.ear,jar=foobar-ejbapp-0.0.1.jar,name=FoobarMgr,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss-injector:bean=FoobarMgr,interceptor=org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor,topLevelUnit=foobar-ear-0.0.1.ear,unit=foobar-ejbapp-0.0.1.jar' **")
Dependency "<UNKNOWN jboss.j2ee:ear=foobar-ear-0.0.1.ear,jar=foobar-ejbapp-0.0.1.jar,name=FoobarMgr,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss-injector:bean=FoobarMgr,interceptor=org.jboss.weld.integration.ejb.SessionBeanInterceptor,topLevelUnit=foobar-ear-0.0.1.ear,unit=foobar-ejbapp-0.0.1.jar' **")
Deployment "jboss.j2ee:ear=foobar-ear-0.0.1.ear,jar=foobar-ejbapp-0.0.1.jar,name=FoobarMgr,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:ear=foobar-ear-0.0.1.ear,jar=foobar-ejbapp-0.0.1.jar,name=FoobarMgr,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
Deployment "jboss.web.deployment:war=/foobar-webapp" is missing the following dependencies:
Dependency "vfs:///C:/program1/jboss6/server/default/deploy/foobar-ear-0.0.1.ear_WeldBootstrapBean" (should be in state "Create", but is actually in state "**ERROR**")
-
2. EJB3 and Struts2 with CDI
rop Apr 7, 2011 8:24 PM (in response to rop)Still didnt get EJB3 dependency-injection to work with Struts2 action-classes.
The main difference to a plain servlet, is that the action-classes in Struts2
are created on-the-fly (new myActionclass()) everytime a request comes in,
and @EJB doesnt work for such classes.
Currently, as a work-around, I just do jndi context-lookup to get the EJB3 instead.
But I read somewhere that CDI should be able to handle this.
Is that correct?
Any input still appreciated!
Thanx,