6 Replies Latest reply on Dec 16, 2005 1:47 AM by greywind

    DeploymentException with -ds.xml inside ear inside rar

    greydeath

      I added the following lines to my jboss-app.xml and since then I get exceptions during deployment.

      <loader-repository>
      goldensource.com:loader=goldensource.app.ear
      <loader-repository-config>
      java2ParentDelegation=false
      </loader-repository-config>
      </loader-repository>

      10:14:23,758 INFO [ServiceConfigurator] Problem configuring service jboss.jca:service=ManagedConnectionFactory,name=goldensource/adapters/filesystem/ftp
      org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@db38e1 on mbean jboss.jca:service=ManagedConnectionFactory,name=goldensource/adapters/filesystem/ftp; - nested throwable: (javax.management.InvalidAttributeValueException: Set attribute has class class org.apache.xerces.dom.DeferredElementImpl loaded from null that is not assignable to attribute class interface org.w3c.dom.Element loaded from org.jboss.mx.loading.UnifiedClassLoader3@16c6b08{ url=file:/local/mkopp/jboss-4.0.3RC1/server/default/tmp/deploy/tmp19879goldensource.app.ear ,addedOrder=41})
      at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:572)
      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:273)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:162)
      at org.jboss.system.ServiceConfigurator.processDependency(ServiceConfigurator.java:535)
      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:298)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:162)
      at org.jboss.system.ServiceConfigurator.processDependency(ServiceConfigurator.java:535)
      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:298)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:162)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:116)
      at org.jboss.system.ServiceController.install(ServiceController.java:202)


      It seems a class loader problem I debuged it and found that the org.jboss.resource.connectionmanager.RARDeployment is loaded by the UnifiedClassLoader3 (the EAR ClassLoader). The Property that is being set here is managedConnectionFactoryProperties.
      The problem, the ear file contains the xml-apis.jar. Thus the org.w3c.Element is also loaded by the UnifiedClassLoader. The Xerces object on the other hand is loaded by the null ClassLoader (I guess that means bootstrap). Therefor the classes are incompatible.

      I'm not sure if this is a bug or If I am missing some classloader configuration for jboss. Is the RARDeployment supposed to be loaded by the Application classloader? it is a server class and should be loaded by the server class loader right?

        • 1. Re: DeploymentException with -ds.xml inside ear inside rar
          flottis

          Hello, I'm having the same problem, has anyone found a solution to this (and still being able to have a custom xml parser and deploy the .rar inside the .ear) ?

          /Andreas

          • 2. Re: DeploymentException with -ds.xml inside ear inside rar
            greywind

            Your Application includes the org.w3c.dom interfaces in a jar file, thus jboss will load the class from there.
            The problem is that the DomElement itself is created by the jboss classloader not the RAR Application ClassLoader. Now it tries to assign the dom element of type Element (loaded by jbossClassLoader) to an dom element type Element (loaded by ApplicationClassLoader) which is not the same class (2 different class loaders). BANG.

            Solution for the moment (as the jboss guys do not seem to fix it) remove the org.w3c interfaces from your ear file and you will automatically use the ones supplied with jboss. then it works

            • 3. Re: DeploymentException with -ds.xml inside ear inside rar

               

              "greywind" wrote:

              Solution for the moment (as the jboss guys do not seem to fix it)


              Fix what?

              JBoss has parsed the ra.xml using the xml parser and the w3c classes you told it to use.
              These classes are not compatible with the JDK classes that the RAR deployer uses.

              Why are you trying to override JDK classes? That isn't the intention of
              turning off spec defined classloading "java2ParentDelegation=false"

              There are plans to install a global filer on the classloading to stop people
              shooting themselves in the foot by adding JDK classes and JBoss classes
              to their isolated classloaders.

              e.g. the Tomcat deployer already has this:
               <attribute name="FilteredPackages">javax.servlet,org.apache.commons.logging</attribute>
              


              since people generally break their web apps by bunding the servlet jar (amongst other things) in their WEB-INF/lib "dumping ground"


              • 4. Re: DeploymentException with -ds.xml inside ear inside rar
                greywind

                You are right that we shouldn't overwrite JDK classes, unfortunatelly we have to.
                JDK 1.4.2 contains only DOM2 the Xerces 2.6/2.7 releases need DOM3 interfaces. hence you have to have those interfaces in the ear.

                If you ask me, DOM should not be in the JDK, it does not have Suns release cycle so why is it bound by it.

                • 5. Re: DeploymentException with -ds.xml inside ear inside rar

                  Use the "endorsed" mechanism.
                  http://java.sun.com/j2se/1.4.2/docs/guide/standards/
                  See also, JBOSS_DIST/lib/endorsed

                  • 6. Re: DeploymentException with -ds.xml inside ear inside rar
                    greywind

                    I know, but this has effect on all the other applications deployed in the application server. In case of DOM3 that might not be a problem but it is a matter of prinicpal and our clients have very strict rules of deployment. They will definitly not like it.

                    Anyway I know how to work around it and I just let the other guy know.

                    And I also know that it is not a jboss problem per se.