Search code examples
jboss7.xcdijboss-weld

CDI 1.1 with JBoss


Is it possible to use CDI 1.1 with JBoss 7.1.1?

I have a single test war and would like to deploy this war together with weld 2.0.
I disabled the automatically loading of the weld module with the jboss-deployment-structure File:

<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.jboss.weld.core" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

I also tried to add a extra slot in the jboss/module folder:

<jboss-deployment-structure>
  <deployment>
    <exclusions>
      <module name="org.jboss.weld.core" />
      <module name="org.jboss.weld.api" />
      <module name="org.jboss.weld.spi" />
    </exclusions>
    <dependencies>
      <module name="org.jboss.weld.core" slot="2.0" />
      <module name="org.jboss.weld.api" slot="2.0" />
      <module name="org.jboss.weld.spi" slot="2.0" />
    </dependencies>
  </deployment>
</jboss-deployment-structure>

The deployment failed in both cases because JBoss apparently needs weld for the deployment.

So is it possible to use CDI 1.1 with JBoss 7.1.1 and how?


Solution

  • No, it's not possible. You could try weld-servlet from 2.0 but it won't work with EJB and will get quite confused. The app server integration is different in weld 2.0, so it won't work with AS7.