3 Replies Latest reply on Dec 23, 2009 8:26 AM by Carlo de Wolf

    Booting up JBoss CL in VDF

    Carlo de Wolf Master

      This is mainly a thread targetted at myself.

       

      Once more I'm booting up VDF in a component and I'm encountering known issues with jboss-cl. So this is going to be a step-by-step guide for booting it up.

       

      So when do I need jboss-cl?

      java.lang.IllegalStateException: ClassLoader has not been set
          at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.getClassLoader(AbstractDeploymentUnit.java:154)
          at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.addBeanComponent(BeanMetaDataFactoryVisitor.java:60)
          at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:126)
          ... 43 more

      An easy work-around is to install a SimpleClassLoaderDeployer which throws everything on the TCCL.

      http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/ejb3/trunk/transactions/src/test/java/org/jboss/ejb3/test/tx/common/SimpleClassLoaderDeployer.java?revision=80742&view=markup

       

      But I want the real thing, so deploy bootstrap/classloader.xml. And install the real ClassLoaderDeployer:

      <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
         <property name="classLoading"><inject bean="ClassLoading"/></property>
         <property name="system"><inject bean="ClassLoaderSystem"/></property>
      </bean>

        • 1. Re: Booting up JBoss CL in VDF
          Carlo de Wolf Master

          Next stop is a shortcoming in AbstractLevelClassLoaderSystemDeployer:

          java.lang.NullPointerException
              at org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer.createClassLoader(AbstractLevelClassLoaderSystemDeployer.java:111)
              at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.createClassLoader(AbstractDeploymentContext.java:568)
              ... 41 more

          Basically you must have a Module attachment.

           

          This one comes from an AbstractClassLoaderDescribeDeployer of which we have one called VFSClassLoaderDescribeDeployer.

           

          So:

          <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
             <property name="classLoading"><inject bean="ClassLoading"/></property>
          </bean>

          • 2. Re: Booting up JBoss CL in VDF
            Carlo de Wolf Master
            How do I delete this post?

             

            Message was edited by: Carlo de Wolf

            • 3. Re: Booting up JBoss CL in VDF
              Carlo de Wolf Master

              But to create the Module we must have the associated metadata:

              java.lang.IllegalArgumentException: Null classLoading metadata
                  at org.jboss.classloading.spi.dependency.helpers.ClassLoadingMetaDataModule.determineName(ClassLoadingMetaDataModule.java:56)
                  at org.jboss.classloading.spi.dependency.helpers.ClassLoadingMetaDataModule.<init>(ClassLoadingMetaDataModule.java:82)
                  at org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule.<init>(ClassLoaderPolicyModule.java:77)
                  at org.jboss.deployers.plugins.classloading.AbstractDeploymentClassLoaderPolicyModule.<init>(AbstractDeploymentClassLoaderPolicyModule.java:120)
                  at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.<init>(VFSDeploymentClassLoaderPolicyModule.java:72)
                  at org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer.createModule(VFSClassLoaderDescribeDeployer.java:40)

              Which for the moment we'll provide with the ClassLoadingDefaultDeployer:

              <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
                 <property name="defaultMetaData">
                    <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
                 </property>
              </bean>

              And voila VDF with JBoss CL.

               

              Note that parsing classloading metadata is disabled in this setup.