Injection across modules within ear archive does not work
msreddy Jun 26, 2010 9:37 PMI am trying to use web beans for communication among modules within ear archive. The ear archive consists of one war module and one ejb module, similar to translator example, in fact I have started playing with translator for this example. Default example works fine. I am trying to inject the context in war module from ejb module. For example I have created a ManagedBean in web module and into which I am injecting a type from ejb module as given below. I want the injection in web bean of another module but within same j2ee application.
@javax.faces.bean.ManagedBean public class Translator1 { @Inject TranslatorControllerBean tcb;
For the above to work so that the web module recognises the type, I declared dependency on ejb module in war's pom.xml. When I deployed the app. to jboss 6 M3 with weld 1.0.1 final, it causes the following exception.
DEPLOYMENTS IN ERROR: Deployment "vfs:///space/jboss-6.0.0.20100429-M3/server/default/deploy/weld-translator.ear" is in error due to the following reason(s): java.lang.IllegalStateException: jboss.ejb3:application=weld-translator,module=weld-translator,component=TranslatorControllerBean,service=EjbEncFactory is already installed. at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1395) [:2.2.0.Alpha4]
To avoid the above, I created another web module called war1 to see if I can inject context from war1 to war. This results in unsatisfied dependency exception as given below.
DEPLOYMENTS IN ERROR: Deployment "vfs:///space/jboss-6.0.0.20100429-M3/server/default/deploy/weld-translator.ear_WeldBootstrapBean" is in error due to the following reason(s): org.jboss.weld.exceptions.DeploymentException: WELD-001408 Injection point has unsatisfied dependencies. Injection point: field org.jboss.weld.examples.translator.Translator1.tcb1; Qualifiers: [@javax.enterprise.inject.Default()], **ERROR** at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1395) [:2.2.0.Alpha4]
Not sure if I am hitting a bug (or more), pl. advise.
Does some one have an example similar to what I described, injecting into another web bean (not controlled by container) across modules within same j2ee application. It works fine with facelets.
Thanks in advance for your time and help.