2 Replies Latest reply on Aug 15, 2013 11:24 AM by Marshall Lucas

    Having issues getting a KnowledgeSession when using JPA persistence

    Marshall Lucas Newbie

      Seems that Fuse is having issues finding classes across bundles.  Any ideas?  Marshall  2013-08-02 16:41:11,740 | ERROR | NAPSHOT-thread-1 | JbpmEngine                       | ?                                   ? | 239 - gov.faa.apws.workflow.workflow-impl - 0.0.1.SNAPSHOT | java.lang.IllegalStateException: java.lang.reflect.InvocationTargetExceptio n java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException         at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:142)[228:org.droo ls.persistence-jpa:5.5.0.Final]         at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:66)[228:o rg.drools.persistence-jpa:5.5.0.Final]         at gov.faa.apws.workflow.server.impl.JbpmEngine.startTheEngine(JbpmEngine.java:414)[239:gov.faa.apws.workflow.workflow-impl: 0.0.1.SNAPSHOT]         at gov.faa.apws.workflow.server.impl.JbpmEngine.setResourceFactoryService(JbpmEngine.java:324)[239:gov.faa.apws.workflow.wor kflow-impl:0.0.1.SNAPSHOT]         at gov.faa.apws.workflow.server.osgi.ResourceFactoryServiceTracker.addingService(ResourceFactoryServiceTracker.java:42)[239: gov.faa.apws.workflow.workflow-impl:0.0.1.SNAPSHOT]         at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)[karaf.jar:2.3.0.redhat-60024]         at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:864)[karaf.jar:2.3.0.redhat-60024]         at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[karaf.jar:2.3.0.redhat-60024]         at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[karaf.jar:2.3.0.redhat-60024]         at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)[karaf.jar:2.3.0.redhat-60024]         at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)[karaf.jar:2.3.0.redhat-60024]         at gov.faa.apws.workflow.server.impl.JbpmMonitor.init(JbpmMonitor.java:52)[239:gov.faa.apws.workflow.workflow-impl:0.0.1.SNA PSHOT]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_38]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_38]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_38]         at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_38]         at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)[14:org.apache.aries.blueprint.core:1.0. 1.redhat-60024]         at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)[14:org.apache.aries.blueprint.core:1.0.1.redh at-60024]         at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)[14:org.apache.aries.blueprint.core:1 .0.1.redhat-60024]         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)[14:org.apache.aries.blueprint.core:1 .0.1.redhat-60024]         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[14:org.apache.aries.blueprint.core:1. 0.1.redhat-60024]         at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[14:org.apache.aries.blueprint.core:1.0.1.redh at-60024]         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_38]         at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_38]         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[14:org.apache.aries.blueprint.core:1.0.1.redh at-60024]         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[14:org.apache.arie s.blueprint.core:1.0.1.redhat-60024]         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[14:org.apache.aries.blue print.core:1.0.1.redhat-60024]         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:667)[1 4:org.apache.aries.blueprint.core:1.0.1.redhat-60024]         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[14:org.apache.aries.bl ueprint.core:1.0.1.redhat-60024]         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[14:org.apache.aries.blue print.core:1.0.1.redhat-60024]         at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:270)[14:org.apache.aries.bl ueprint.core:1.0.1.redhat-60024]         at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:233)[14:org.apache.aries.blu eprint.core:1.0.1.redhat-60024]         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[1 3:org.apache.aries.util:1.0.1.redhat-60024]         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[1 3:org.apache.aries.util:1.0.1.redhat-60024]         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[13:org .apache.aries.util:1.0.1.redhat-60024]         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[13:org .apache.aries.util:1.0.1.redhat-60024]         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[13:org .apache.aries.util:1.0.1.redhat-60024]         at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0 .3.redhat-60024.jar:]         at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)[org.apache.felix.frame work-4.0.3.redhat-60024.jar:]         at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)[org.apache.felix.framework-4.0. 3.redhat-60024.jar:]         at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4580)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]         at org.apache.felix.framework.Felix$4.run(Felix.java:2115)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]         at org.apache.felix.framework.Felix$5.run(Felix.java:2159)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)[:1.6.0_38]         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_38]         at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_38]         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_38]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_38]         at java.lang.Thread.run(Thread.java:662)[:1.6.0_38] Caused by: java.lang.reflect.InvocationTargetException         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.6.0_38]         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)[:1.6.0_38]         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)[:1.6.0_38]         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)[:1.6.0_38]         at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:128)[228:org.droo ls.persistence-jpa:5.5.0.Final]         ... 48 more Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.drools.persistence.jpa.JpaTimeJobFactoryManager not fou nd by org.drools.core [226]         at org.drools.TimerJobFactoryType$3.createInstance(TimerJobFactoryType.java:26)[226:org.drools.core:5.5.0.Final]         at org.drools.SessionConfiguration.getTimerJobFactoryManager(SessionConfiguration.java:274)[226:org.drools.core:5.5.0.Final]          at org.drools.common.AbstractWorkingMemory.(AbstractWorkingMemory.java:316)         at org.drools.common.AbstractWorkingMemory.(AbstractWorkingMemory.java:246)         at org.drools.common.AbstractWorkingMemory.(AbstractWorkingMemory.java:212)         at org.drools.reteoo.ReteooWorkingMemory.(ReteooWorkingMemory.java:103)         at org.drools.reteoo.ReteooStatefulSession.(ReteooStatefulSession.java:81)         at org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:402)         at org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:387)         at org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:175)         at org.drools.persistence.SingleSessionCommandService.(SingleSessionCommandService.java:120)[228:org.drools.persistenc e-jpa:5.5.0.Final]         ... 53 more Caused by: java.lang.ClassNotFoundException: org.drools.persistence.jpa.JpaTimeJobFactoryManager not found by org.drools.core [226]         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)         at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_38]         at java.lang.Class.forName0(Native Method)[:1.6.0_38]         at java.lang.Class.forName(Class.java:169)[:1.6.0_38]         at org.drools.TimerJobFactoryType$3.createInstance(TimerJobFactoryType.java:24)[226:org.drools.core:5.5.0.Final]         ... 63 more

        • 1. Re: Having issues getting a KnowledgeSession when using JPA persistence
          Marshall Lucas Newbie

          Anyone?  Anyone?  Seems to be a problem with the drools.api and drools.core packages using reflection to find the implementation packages.  Any ideas???  How do you get past the reflection across bundles problem?

           

          Marshall

          • 2. Re: Having issues getting a KnowledgeSession when using JPA persistence
            Marshall Lucas Newbie

            Fixed it using a bit of Maven Ant-Run magick.  Have to modify the manifest of the knowledge-api jar file to have a Require-Bundle: org.drools.persistence-jpa directive on it.

             

            <code>

                      <plugin>

                            <artifactId>maven-antrun-plugin</artifactId>

                            <version>1.4</version>

                            <executions>

                                <execution>

                                    <phase>install</phase>

                                    <configuration>

                                        <tasks>

                                            <!-- Major Magick here, allows the Knowledge-API bundle split package to -->

                                            <!-- find the rest of the package in the persistence bundle.  This adds  -->

                                            <!-- the Require-Bundle: org.drools.persistnce-jpa directive to the      -->

                                            <!-- MANIFEST.MF within the knowledge-api jar file.                      -->

                                            <jar file="${basedir}/target/system/org/drools/knowledge-api/5.5.0.Final/knowledge-api-5.5.0.Final.jar" update="true">

                                                <manifest>

                                                    <attribute

                                                        name="Require-Bundle"

                                                        value="org.drools.persistence-jpa;bundle-version=5.5.0.Final" />

                                                </manifest>

                                            </jar>

                                            <!-- Build the executable version of full Karaf/Felix OSGi ESB Container -->

                                            <!-- with all required bundles and APWS features installed               -->

                                            <copy todir="/devel/apws">

                                                <fileset dir="${basedir}/resources" includes="**/*" />

                                                <fileset dir="${basedir}/target" includes="system/**/*" />

                                            </copy>

                                        </tasks>

                                    </configuration>

                                    <goals>

                                        <goal>run</goal>

                                    </goals>

                                </execution>

                            </executions>

                        </plugin>

            </code>

             

            Marshall