5 Replies Latest reply on Jun 25, 2008 2:50 PM by vickyk

    Help With RARDeployment Errors

    maverick18

      Hi

      My application consists of three archives war,rar and a sar. In order to integrate the logging of all three modules into one log file (with my customizations), I had to introduce jboss's concept of class loading. My application structure is as follows,
      myapp.ear
      --->lib (contains log4j.jar)
      --->META-INF(contains application.xml,jboss-app.xml and MANIFEST.mf)
      --->myapp-ra.rar
      --->myapp-ws.war
      --->myapp-login.sar
      --->log4j.xml

      The jboss-app.xml has the following structure,
      <jboss-app>
      <loader-repository>myapp:loader=myapp.ear
      </loader-repository>
      myapp-login.sar
      </jboss-app>

      Though I was able to get the logging to work, my resource adapter now fails to load and am getting the following error,

      18:29:53,125 ERROR [RARDeployment] Could not find ManagedConnectionFactory class: mav.resource.communication.common.spi.ManagedConnectionFactoryImpl
      java.lang.ClassNotFoundException: No ClassLoaders found for: mav.resource.communication.common.spi.ManagedConnectionFactoryImpl
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.jboss.resource.connectionmanager.RARDeployment.startService(RARDeployment.java:322)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at org.jboss.system.ServiceController.start(ServiceController.java:435)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy39.start(Unknown Source)
      at org.jboss.deployment.SimpleSubDeployerSupport.startService(SimpleSubDeployerSupport.java:356)
      at org.jboss.deployment.SimpleSubDeployerSupport.start(SimpleSubDeployerSupport.java:127)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy9.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy4.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy5.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
      at org.jboss.Main.boot(Main.java:200)
      at org.jboss.Main$1.run(Main.java:508)
      at java.lang.Thread.run(Unknown Source)
      18:29:53,125 WARN [ServiceController] Problem starting service jboss.jca:service=ManagedConnectionFactory,name=csta
      org.jboss.deployment.DeploymentException: Could not find ManagedConnectionFactory class: mav.resource.communication.common.spi.ManagedConnectionFactoryImpl
      at org.jboss.resource.connectionmanager.RARDeployment.startService(RARDeployment.java:327)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      Any help would be highly appreciated.

        • 1. Re: Help With RARDeployment Errors
          vickyk

           

          java.lang.ClassNotFoundException: No ClassLoaders found for: mav.resource.communication.common.spi.ManagedConnectionFactoryImpl


          Where is ManagedConnectionFactoryImpl located in the myapp.ear ?

          Make sure that the same rar which is part of the ear gets deployed properly when deployed independently.




          • 2. Re: Help With RARDeployment Errors
            maverick18

            myapp-ra.rar
            --->META-INF( contains ra.xml,MANIFEST)
            --->cstaAdapter.jar (contains the ManagedConnectionFactoryImpl class)
            The above rar is part of the myapp.ear.

            As suggested by you, I tried deploying the RAR file independently and it works (even visible in the jmx console)

            The only diff being that when I deploy it as part of the ear, the -ds.xml file has a slight difference in the rar-name i.e.
            <rar-name>myapp.ear#myapp-ra.rar</rar-name>

            • 3. Re: Help With RARDeployment Errors
              vickyk

               

              "maverick18" wrote:

              The only diff being that when I deploy it as part of the ear, the -ds.xml file has a slight difference in the rar-name i.e.
              <rar-name>myapp.ear#myapp-ra.rar</rar-name>


              Huh ..... -ds.xml file is not present in the EAR which is scoped .
              So the classes like MCF/CF etc will not be visible to the -ds.xml deployment.

              Couple of things you can try to get this working
              1) Include the -ds.xml in the EAR .
              2) Make the -ds.xml as a part of seperate deployment unit(may be sar) whose loader-repository points to the same as defined for your EAR .

              I hope you understand thoroughly what you are doing before making the choices as explained above .


              <jboss-app>
              <loader-repository>myapp:loader=myapp.ear
              </loader-repository>
              myapp-login.sar
              </jboss-app>


              The myapp-login.sar should be in tag , your -ds.xml can also be placed inside the module tag ....

              Have a look at this one for reference
              http://anonsvn.jboss.org/repos/jbossas/trunk/testsuite/src/resources/deployers/ear2/META-INF/jboss-app.xml


              • 4. Re: Help With RARDeployment Errors
                maverick18

                Sorry for the delay in replying but I was sent away on some training.

                yup ! you were right. The -ds.xml did not have the classes in scope to load the con-factories. I should have thought of it before. I subsequently tried the following two approaches and they both worked,
                1) Included the -ds.xml as part of the ear and also deployed it as a service in the jboss-app.xml file (as you mentioned)
                2> Included the -ds.xml at the root of the ear

                However both of the solutions have a problem in the sense that it is harder to change the configuration.Now is that going to be a limitation if we want to acheive the logging integration or is there a solution for that ?

                I also read this article,
                http://wiki.jboss.org/wiki/JBossClassLoadingUseCases?action=e&windowstate=normal&mode=view, which kind of opened my eyes :o)

                Since you had a hand in the making the doc, could you be kind enough to clarify a basic doubt I have ?

                In case3:
                The UCL's parent, HierarchicalLoaderRepository3$NoParentClassLoader, overrides loadClass() to always throw a ClassNotFoundException, thus forcing the UCL to only load from its URLs.

                This ensures that the deployment is always scoped


                But then the child repository also calls getPackageClassLoaders() on its parent, and also includes into the returned class loader set a UCL (constructed on the spot and associated to the child repository) that has among its ancestors an instance of NoAnnotationURLClassLoader, which ultimately can reach the system class loader.

                I guess this is required in order to load basic java classes (like String etc) but would this not be defeating the above purpose as the NoParentClassLoader's immediate parent is the NoAnnotationURLClassLoader itself


                This makes it similar to the Case4 situation where there is no NoParentClassLoader in between.


                What exactly is the difference between the above two ?

                • 5. Re: Help With RARDeployment Errors
                  vickyk

                   

                  "maverick18" wrote:

                  However both of the solutions have a problem in the sense that it is harder to change the configuration.Now is that going to be a limitation if we want to acheive the logging integration or is there a solution for that ?

                  You configuration is incorrect and I don't understand how this is a problem. Why would you have a problem in logging integration ?

                  "maverick18" wrote:

                  What exactly is the difference between the above two ?

                  Read this
                  Because Java2ParentDelegation is turned off by default, the Step (1.1) is never executed, parentRepository.getCachedClass() never gets called, so the UCL doesn't have access to the repository's cached classes.

                  This is a JCA forums please don't raise non-jca questions here , it will not be answered ;)