4 Replies Latest reply on Dec 23, 2010 9:04 AM by jaikiran pai

    classLoader is not connected to a domain

    kristin.polenz Newbie

      I get a exception after a new deployment of my application. It seems to be an classloader issue. The begin of the stacktrace is the following.

       

      org.drools.RuntimeDroolsException: java.lang.IllegalStateException: BaseClassLoader@14f744d{vfszip:xxx.ear/} classLoader is not connected to a domain (probably undeployed?) for class org.drools.base.extractors.BaseObjectClassFieldReader

      at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:152)
          at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java:315)
          at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:245)
          at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:379)
          at org.drools.base.ClassFieldAccessorStore.merge(ClassFieldAccessorStore.java:270)

          ...

       

      I use JBoss 5.0.1 and Drools 5.0.1.

       

      The application works fine after the first deployment. After a new (second) deployment, I get this exception and only a JBoss restart is helpfully.

        • 1. Re: classLoader is not connected to a domain
          jaikiran pai Master

          Before trying to investigate any further, I would recommend that you move to 5.1.0 AS and see if it already has the fix for the issue. If it still fails in AS 5.1.0, then please post the new stacktrace and a bit more details about your application.

          • 2. Re: classLoader is not connected to a domain
            Bernd Ruecker Master

            Hi jaikiran.

             

            Let me add some details to the deployment first: We have the Drools code in a jBPM ActionHandler class (see code below), containes in a jar file. We tried to deploy this jar file within an own ESB archive as well as EAR as well as single jar.

             

            Currently we are using Drools 5.0.1 deployed as ESB-Archiv (ESB 4.7), since this is the constellation of the SOA Platform. We can try it with JBoss AS 5.1, but is that part of the SOA Platform?

             

            Here the code:

             

            protected void execute(ExecutionContext context) throws Exception {
                    Object value = null;
                    ContextInstance ci = context.getContextInstance();
                   
                  KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
                 
                  KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                  URL url = new URL("http://localhost:8080/drools-guvnor-5.0.1/org.drools.guvnor.Guvnor/package/ag.pst.hapo.documentScreening/LATEST");     
                  kbuilder.add(ResourceFactory.newUrlResource(url), ResourceType.PKG);
                  kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
                  StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

             

                  // insert objects

             

                    ksession.fireAllRules();
                    ksession.dispose();   
              }

             

            And here the full StackTrace from that code:

             

            org.drools.RuntimeDroolsException: java.lang.IllegalStateException:  BaseClassLoader@14f744d{vfszip:xxx.ear/} classLoader is not connected to  a domain (probably undeployed?) for class  org.drools.base.extractors.BaseObjectClassFieldReader

                at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:152)
                at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java:315)
                 at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:245)
                 at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:379)
                 at org.drools.base.ClassFieldAccessorStore.merge(ClassFieldAccessorStore.java:270)
                 at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:739)
                 at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
                 at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
                 at xxx.jbpm.actions.FireRules.createRulesContext(FireRules.java:94)
                 at xxx.jbpm.actions.FireRules.executeAction(FireRules.java:51)
                 at xxx.jbpm.actions.AbstractGeneralActionHandler.execute(AbstractGeneralActionHandler.java:43)
                 at org.jbpm.graph.def.Action.execute(Action.java:118)

                ....

             

            It looks to me, that something may be cached, which shouldn't be cached and we have some old classes still referenced? Or maybe from generated DRL classes? Or ...?

             

            Any ideas to this? I think I will ping the Drools guys as well for this...

            • 3. Re: classLoader is not connected to a domain
              Bernd Ruecker Master

              We tested the same thing on a JBoss AS 4.2.3 with Drools 5.0.1 and JBossesb 4.8. The problem is the same, but the stack trace is different (see below)... Puzzling!

               

              Anybody and ideas or hints?


              java.lang.RuntimeException: Error while creating RulesContext
                  at xxx.jbpm.actions.FireRules.createRulesContext(FireRules.java:105)
                  at xxx.jbpm.actions.FireRules.executeAction(FireRules.java:47)
                  at xxx.jbpm.actions.AbstractGeneralActionHandler.execute(AbstractGeneralActionHandler.java:43)
                  at org.jbpm.graph.def.Action.execute(Action.java:137)
                  at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:280)
                  at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:237)
                  at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:207)
                  at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:190)
                  at org.jbpm.graph.def.Node.enter(Node.java:358)
                  at sun.reflect.GeneratedMethodAccessor435.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
                  at org.jbpm.graph.def.Node_$$_javassist_147.enter(Node_$$_javassist_147.java)
                  at org.jbpm.graph.def.Transition.take(Transition.java:151)
                  at org.jbpm.graph.def.Node.leave(Node.java:453)
                  at org.jbpm.graph.def.Node.leave(Node.java:415)
                  at org.jbpm.graph.def.Node.execute(Node.java:407)
                  at org.jbpm.graph.def.Node.enter(Node.java:375)
                  at sun.reflect.GeneratedMethodAccessor435.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
                  at org.jbpm.graph.def.Node_$$_javassist_147.enter(Node_$$_javassist_147.java)
                  at org.jbpm.graph.def.Transition.take(Transition.java:151)
                  at org.jbpm.graph.def.Node.leave(Node.java:453)
                  at org.jbpm.graph.def.Node.leave(Node.java:415)
                  at org.jbpm.graph.def.Node.execute(Node.java:407)
                  at org.jbpm.graph.def.Node.enter(Node.java:375)
                  at sun.reflect.GeneratedMethodAccessor435.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
                  at org.jbpm.graph.def.Node_$$_javassist_147.enter(Node_$$_javassist_147.java)
                  at org.jbpm.graph.def.Transition.take(Transition.java:151)
                  at org.jbpm.graph.def.Node.leave(Node.java:453)
                  at org.jbpm.graph.node.StartState.leave(StartState.java:78)
                  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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
                  at org.jbpm.graph.def.Node_$$_javassist_147.leave(Node_$$_javassist_147.java)
                  at org.jbpm.graph.exe.Token.signal(Token.java:214)
                  at org.jbpm.graph.exe.Token.signal(Token.java:143)
                  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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
                  at org.jbpm.graph.exe.Token_$$_javassist_80.signal(Token_$$_javassist_80.java)
                  at org.jbpm.command.SignalCommand.execute(SignalCommand.java:97)
                  at org.jboss.soa.esb.services.jbpm.cmd.AsyncProcessSignal$AsyncSignalAction.execute(AsyncProcessSignal.java:304)
                  at org.jbpm.graph.def.Action.execute(Action.java:137)
                  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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
                  at org.jbpm.graph.def.Action_$$_javassist_100.execute(Action_$$_javassist_100.java)
                  at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:280)
                  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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
                  at org.jbpm.graph.def.Node_$$_javassist_147.executeAction(Node_$$_javassist_147.java)
                  at org.jbpm.job.ExecuteActionJob.execute(ExecuteActionJob.java:33)
                  at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:172)
                  at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:63)
              Caused by: org.drools.RuntimeDroolsException: java.lang.IllegalStateException: Can't overwrite cause
                  at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:152)
                  at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java:315)
                  at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:245)
                  at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:379)
                  at org.drools.base.ClassFieldAccessorStore.merge(ClassFieldAccessorStore.java:270)
                  at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:739)
                  at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
                  at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
                  at xxx.jbpm.actions.FireRules.createRulesContext(FireRules.java:91)
                  ... 69 more
              Caused by: java.lang.IllegalStateException: Can't overwrite cause
                  at java.lang.Throwable.initCause(Throwable.java:320)
                  at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:624)
                  at java.lang.ClassLoader.loadClass(Unknown Source)
                  at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:474)
                  at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
                  at java.lang.ClassLoader.loadClass(Unknown Source)
                  at java.lang.ClassLoader.loadClass(Unknown Source)
                  at java.lang.ClassLoader.defineClass1(Native Method)
                  at java.lang.ClassLoader.defineClassCond(Unknown Source)
                  at java.lang.ClassLoader.defineClass(Unknown Source)
                  at org.drools.base.ClassFieldAccessorCache$ByteArrayClassLoader.defineClass(ClassFieldAccessorCache.java:367)
                  at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:135)
                  ... 77 more

              • 4. Re: classLoader is not connected to a domain
                jaikiran pai Master

                I haven't yet paid attention to those details, but my first guess is that you are using an outdated (undeployed) classloader during the second attempt. I'll look at the details later today.