Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-209

do not export api if excluded within jboss-deployment-structure.xml

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • 2.0.0.Final
    • None
    • Server
    • None
    • Workaround Exists
    • Hide

      workaround 1
      update the javaee/api/main.module.xml as followed:

      <!--<module name="javax.persistence.api" export="true"/>-->
      <module name="javax.persistence.api" export="false"/>
      

      though this is non-portable.

      workaround 2
      update jboss-deployment-structure.xml as followed:

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure>
          <deployment>
              <exclude-subsystems>
                  <subsystem name="jpa" />
              </exclude-subsystems>
              <exclusions>
                  <!-- WFCORE-209 workaround -->
                  <module name="javaee.api" />
                  <!-- --------------------- -->
                  <module name="javax.persistence.api" />
                  <module name="org.hibernate" />
              </exclusions>
              <dependencies>
                  <!-- WFCORE-209 workaround -->
                  <module name="javax.activation.api" export="true"/>
                  <module name="javax.annotation.api" export="true"/>
                  <module name="javax.ejb.api" export="true"/>
                  <module name="javax.el.api" export="true"/>
                  <module name="javax.enterprise.api" export="true"/>
                  <module name="javax.enterprise.deploy.api" export="true"/>
                  <module name="javax.inject.api" export="true"/>
                  <module name="javax.interceptor.api" export="true"/>
                  <module name="javax.jms.api" export="true"/>
                  <module name="javax.jws.api" export="true"/>
                  <module name="javax.mail.api" export="true"/>
                  <module name="javax.management.j2ee.api" export="true"/>
                  <!-- <module name="javax.persistence.api" export="true"/> -->
                  <module name="javax.resource.api" export="true"/>
                  <module name="javax.rmi.api" export="true"/>
                  <module name="javax.security.auth.message.api" export="true"/>
                  <module name="javax.security.jacc.api" export="true"/>
                  <module name="javax.servlet.api" export="true"/>
                  <module name="javax.servlet.jsp.api" export="true"/>
                  <module name="javax.transaction.api" export="true"/>
                  <module name="javax.validation.api" export="true"/>
                  <module name="javax.ws.rs.api" export="true"  services="export"/>
                  <module name="javax.xml.bind.api" export="true"/>
                  <module name="javax.xml.registry.api" export="true"/>
                  <module name="javax.xml.soap.api" export="true"/>
                  <module name="javax.xml.ws.api" export="true"/>
          
                  <!-- This one always goes last. -->
                  <module name="javax.api" export="true"/>
                  <!-- --------------------- -->
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
      

      this is fully portable

      Show
      workaround 1 update the javaee/api/main.module.xml as followed: <!--<module name= "javax.persistence.api" export= "true" /> --> <module name= "javax.persistence.api" export= "false" /> though this is non-portable. workaround 2 update jboss-deployment-structure.xml as followed: <?xml version= "1.0" encoding= "UTF-8" ?> <jboss-deployment-structure> <deployment> <exclude-subsystems> <subsystem name= "jpa" /> </exclude-subsystems> <exclusions> <!-- WFCORE-209 workaround --> <module name= "javaee.api" /> <!-- --------------------- --> <module name= "javax.persistence.api" /> <module name= "org.hibernate" /> </exclusions> <dependencies> <!-- WFCORE-209 workaround --> <module name= "javax.activation.api" export= "true" /> <module name= "javax.annotation.api" export= "true" /> <module name= "javax.ejb.api" export= "true" /> <module name= "javax.el.api" export= "true" /> <module name= "javax.enterprise.api" export= "true" /> <module name= "javax.enterprise.deploy.api" export= "true" /> <module name= "javax.inject.api" export= "true" /> <module name= "javax.interceptor.api" export= "true" /> <module name= "javax.jms.api" export= "true" /> <module name= "javax.jws.api" export= "true" /> <module name= "javax.mail.api" export= "true" /> <module name= "javax.management.j2ee.api" export= "true" /> <!-- <module name= "javax.persistence.api" export= "true" /> --> <module name= "javax.resource.api" export= "true" /> <module name= "javax.rmi.api" export= "true" /> <module name= "javax.security.auth.message.api" export= "true" /> <module name= "javax.security.jacc.api" export= "true" /> <module name= "javax.servlet.api" export= "true" /> <module name= "javax.servlet.jsp.api" export= "true" /> <module name= "javax.transaction.api" export= "true" /> <module name= "javax.validation.api" export= "true" /> <module name= "javax.ws.rs.api" export= "true" services= "export" /> <module name= "javax.xml.bind.api" export= "true" /> <module name= "javax.xml.registry.api" export= "true" /> <module name= "javax.xml.soap.api" export= "true" /> <module name= "javax.xml.ws.api" export= "true" /> <!-- This one always goes last. --> <module name= "javax.api" export= "true" /> <!-- --------------------- --> </dependencies> </deployment> </jboss-deployment-structure> this is fully portable

      I'm currently trying to upgrade JPA 2.0 to JPA 2.1 in JBoss EAP 6.3 by leveraging the jboss-deployment-structure.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure>
          <deployment>
              <exclude-subsystems>
                  <subsystem name="jpa" />
                  <subsystem name="webservices" />
                  <subsystem name="weld" />
              </exclude-subsystems>
              <exclusions>
                  <module name="javax.persistence.api" />
                  <module name="org.hibernate" />
              </exclusions>
          </deployment>
      </jboss-deployment-structure>
      

      When trying to deploy my war (containing all hibernate 4.3.6 jars) I get the following error:

      Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
      at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:936) [hibernate-core-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:824) [hibernate-core-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788) [hibernate-core-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742) [hibernate-core-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410) [hibernate-core-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844) [hibernate-core-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) [hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) [hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) [hibernate-core-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) [hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
      at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152) [hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:290) [spring-orm-3.2.11.RELEASE.jar:3.2.11.RELEASE]
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) [spring-orm-3.2.11.RELEASE.jar:3.2.11.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573) [spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511) [spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
      ... 23 more

      Index was introduced with JPA 2.1 and even though:
      1. my application bundle the correct JPA jar
      2. my application excluded the javax.persistence.api
      3. my application excluded the jpa subsystem
      I get a conflict.

      The only way I made it possible to upgrade the JPA version was to explicitely state to not export the javax.persistence.api (see workaround). This way of doing thing though is not portable (as it impacts all other war deployed in the JBoss server) and is critical in our situation.

      The issue might/is probably not be related to jboss-modules component but I was not able to find within the jboss sources the explicit line of code responsible of reading the jboss-deployment-structure.xml.

      If you can point me out the correct component it will be a pleasure to help resolve the issue.

              Unassigned Unassigned
              mathieu@mathieulachance.com Mathieu Lachance (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: