3 Replies Latest reply on Jul 22, 2010 10:54 PM by Stuart Douglas

    Injection across modules within ear archive does not work

    Sreenivas Munnangi Newbie

      I 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.

      public class Translator1
          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.

        Deployment "vfs:///space/jboss-" 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.

        Deployment "vfs:///space/jboss-" 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.