Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5699

When attempting to run Magnolia on J2EE server Guice conflicts with CDI

    XMLWordPrintable

Details

    • Bug
    • Resolution: Outdated
    • Neutral
    • None
    • 5.2.2
    • None
    • None
    • Wildfly8.0.final

    Description

      Attempting to deploy a magnolia project (created from maven archetype) on Wildfly fails because wildfly scans the jar for classes using CDI annotations. Unfortunately, Magnolia uses Guice annotations which conflict with CDI causing Wildfly to bail on the deployment.

      Since both Glassfish and Wildfly use Weld as their CDI implementation I would imagine the same symptoms appear on Glassfish (and probably any other CDI spec compliant server), though I haven't tested yet.

      The workaround is to stop the CDI implementation from scanning the jars. There is a note on this here : http://weld.cdi-spec.org/documentation/#4

      Basically it boils down to :
      On JBoss - include a jboss-all.xml in the META-INF folder with this configuration :

      <jboss xmlns="urn:jboss:1.0">
          <weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
      </jboss>
      

      On Glassfish - I think it should be possible to turn off CDI by including a beans.xml file in WEB-INF with the following declaration (untested):

      <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
             http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
             bean-discovery-mode="none">
      </beans>
      

      This may work for JBoss too - I haven't tried it.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              jportway joshua portway
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD