4 Replies Latest reply on Sep 27, 2011 11:39 PM by benze

    Spring 3.0.5 & JPA2 WAR causes JBoss AS6 deployment trouble

    benze

      I've got a Tomcat 7 war application that builds and deploys perfectly in Tomcat. I am now required to port the application over to JBoss AS6. The application is a Spring 3.0.5/Hibernate 3/JPA2/Quartz 1.8.5 application.

      I have configured by mysql DS in JBoss, and am expecting errors as I go through the process of trying to get it to work, but I've hit an error with no detailed explanation, so have no idea how to determine what/where the problem lies.

      Upon my first load, I got the following error message:

      {code}

      WARN  [org.jboss.detailed.classloader.ClassLoaderManager] (RMI TCP Connection(2)-127.0.0.1) Unexpected error during load of:javax.transaction.xa.XAResource: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) previously initiated loading for a different type with name "javax/transaction/xa/XAResource"

      {/code}

       

      Based on some postings I found, they suggested removing any packages providing javax.transaction.* in my war. I have done that, excluding it from the Quartz package as well as marking it as a provided lib elsewhere in my pom.xml.

      My new error now, however is:

      {code}

      2011-09-24 00:58:34,246 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (RMI TCP Connection(2)-127.0.0.1) Error installing to PostClassLoader: name=vfs:///home/eric/.eclipse/workspace3/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1316801763095/deploy/webapp.war state=ClassLoader mode=Manual requiredState=PostClassLoader: org.jboss.deployers.spi.DeploymentException: Deployment error processing fragment for JAR: java-1.0-SNAPSHOT.jar
          at org
      .jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.0.GA]
      ...
      ...
      ...
      Caused by: java.lang.IllegalStateException: Unresolved conflict on resource environment reference named: systemConfiguration
          at org
      .jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData.augment(ResourceEnvironmentReferencesMetaData.java:78) [:2.0.0.Alpha24]
          at org
      .jboss.metadata.javaee.spec.RemoteEnvironmentRefsGroupMetaData.augment(RemoteEnvironmentRefsGroupMetaData.java:580) [:2.0.0.Alpha24]
          at org
      .jboss.metadata.javaee.spec.EnvironmentRefsGroupMetaData.augment(EnvironmentRefsGroupMetaData.java:191) [:2.0.0.Alpha24]
          at org
      .jboss.metadata.web.spec.WebCommonMetaData.augment(WebCommonMetaData.java:941) [:2.0.0.CR1]
          at org
      .jboss.web.deployers.MergedJBossWebMetaDataDeployer.deploy(MergedJBossWebMetaDataDeployer.java:390) [:6.0.0.Final]
         
      ... 70 more

      {/code}


      Now I know that the java-1.0-SNAPSHOT.jar package is my main app code. In it, I have a spring bean called "systemConfiguration". However, I do not understand what "Unresolved conflict on resource environment reference" means, nor how to even begin to try and solve it.

      If anyone can provide some insight into what the error means and/or how I could get additional debug information from JBoss AS6 to understand how to resolve this error? Renaming the bean is not really an option as it is referenced in annotations in several parts of the code.

      Thanks!

      Eric

        • 1. Re: Spring 3.0.5 & JPA2 WAR causes JBoss AS6 deployment trouble
          wolfgangknauf

          Hi,

           

          could you post the list of JAR files that are deployed as part of your app to JBoss?

           

          Best regards

           

          Wolfgang

          • 2. Re: Spring 3.0.5 & JPA2 WAR causes JBoss AS6 deployment trouble
            benze

            Hi,

             

             

            After a lot of trial and error (and random guesswork), I _think_ I finally got it working by disabling JBoss' annotation scanning.  What I believe was happening (although I would like to have some confirmation about this if my theory makes sense), is that JBoss was scanning the annotations within my classes, as was Spring.


            Given that the application uses  JSR annotations as well as Spring annotations (ex: @Inject, @Resource, @Autowired, @Qualifier, etc), I believe that JBoss was seeing the @Resource("systemConfiguration") annotation and complaining that it did not know what that bean was given that it was configured in a Spring XML configuration file.

             

            I added the following to my WEB-INF/jboss-scanning.xml file and everything _seems_ to work better.

             

            {code:xml}

            <scanning xmlns="urn:jboss:scanning:1.0">

                      <!-- Disable container annotation scanning since we are relying on Spring processing annotations only-->

            </scanning>

            {code:xml}

             

             

            Does that make sense?


            Thanks,


            Eric

            • 3. Re: Spring 3.0.5 & JPA2 WAR causes JBoss AS6 deployment trouble
              alesj

              This way you disable JBossAS scannning completely; e.g. no EJB, WS, CDI, ... can find your classes / beans.

              • 4. Re: Spring 3.0.5 & JPA2 WAR causes JBoss AS6 deployment trouble
                benze

                Good point.  Any suggestions how to reolve my conflict/problem then?

                 

                Thanks,


                Eric