Re: [rules-users] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
Hi, Hi I am using drools I am getting this error after i run the rule after 10 times. Can you please suggest me is there any i can do i tried to chagne version of drools-core,api,compiler , but it does not work. my pom.xml is dependency groupIdorg.drools/groupId artifactIddrools-core/artifactId version5.1.1/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-compiler/artifactId version5.1.1/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-api/artifactId version5.1.1/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-templates/artifactId version5.1.1/version /dependency dependency groupIdcom.thoughtworks.xstream/groupId artifactIdxstream/artifactId version1.3.1/version /dependency this is the code public T T runRule(String ruleName, Object facts[], T result, String resultName) throws ERPServiceException { if(ksession == null || ruleMap == null || ruleMap.size() == 0){ throw new ERPServiceException(ERPErrorCodes.ERR_NO_DATA_TO_PROCESS); } LOGGER.info(inside run rule); ListFactHandle factHandleList = new ArrayListFactHandle(); FactHandle factHandle = null; for(Object fact: facts) { LOGGER.info(rule fact: + facts); factHandle = ksession.insert(fact); factHandleList.add(factHandle); } ksession.setGlobal(resultName, result); /* * ksession.addEventListener(kbaseRefresher); *ksession.addEventListener(kbaseRefresher); */ String ruleFullName = null; RuleEntry ruleEntry = ruleMap.get(ruleName); if(ruleEntry != null){ Long ruleMetaDataId = ruleEntry.getRuleMetaDataId(); RuleMetaDataEntry metaDataEntry = ruleMetaDataMap.get(ruleMetaDataId); if(metaDataEntry != null metaDataEntry.getRuleMetaDataParameterEntries() != null metaDataEntry.getRuleMetaDataParameterEntries().size()1) { ruleFullName = metaDataEntry.getName(); }else{ ruleFullName = RULE_NAME_PREFIX + ruleName; } LOGGER.info(running rule: + ruleFullName); ksession.fireAllRules(new RuleNameMatchesAgendaFilter(ruleFullName)); for(FactHandle fhandle: factHandleList){ ksession.retract(fhandle); } } return result; } Caused by: java.lang.ExceptionInInitializerError at org.drools.concurrent.ExecutorProviderFactory.getExecutorProvider(ExecutorProviderFactory.java:12) at org.drools.rule.constraint.MvelConstraint$ExecutorHolder.clinit(MvelConstraint.java:259) at org.drools.rule.constraint.MvelConstraint.jitEvaluator(MvelConstraint.java:232) at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:197) at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157) at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137) at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235) at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847) at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269) at com.myntra.commons.utils.RuleEngineCache.runRule(RuleEngineCache.java:152) at com.myntra.lms.manager.impl.CourierServiceabilityManagerImpl.getCouriers(CourierServiceabilityManagerImpl.java:221) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at
Re: [rules-users] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
Thanks Per Sterner, i tried to your suggestion, I removed drools-api dependency from pom.xml its working. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Drools-5-4-0-FINAL-and-OSGI-Unable-to-instantiate-service-for-Class-org-drools-concurren-tp4017660p4021691.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
Hello, perhaps it is an equinox /eclipse.osgi problem? The drools-api and the drools-core bundle have the same packages 'org.drools.concurrent'. I wrote a little test bundle which only does a dynamic-import like the 'drools-api' bundle. The class org.drools.concurrent.ExecutorProviderFactory can be found with 'Class.forName()'. But the class org.drools.concurrent.ExecutorProviderImpl can't be found. (If I manually require drools-core 'Class.forName()' works for org.drools.concurrent.ExecutorProviderImpl) I have tried eclipse.osgi 3.6.1 , 3.7.2 and the current 3.8.0 Regards, Per Sterner On 01.06.2012 03:29, Mark Proctor wrote: Looks like you have some classpath issues and using the incorrect jar versions. On 29/05/2012 14:30, Per Sterner wrote: [ERROR] [System] - Caused by: java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
I just found an old eclipse forum entry: http://www.eclipse.org/forums/index.php/mv/msg/90154/278597/#msg_278597 On 01.06.2012 03:29, Mark Proctor wrote: Looks like you have some classpath issues and using the incorrect jar versions. On 29/05/2012 14:30, Per Sterner wrote: [ERROR] [System] - Caused by: java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
Looks like you have some classpath issues and using the incorrect jar versions. On 29/05/2012 14:30, Per Sterner wrote: [ERROR] [System] - Caused by: java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
Hello, I have been using Drools 5.3.0.FINAL until now. I am upgrading my running system with 5.4.0.FINAL. The bundles are all runing. I got some error messages and tried to reduce the problem and created a simple bundle. The code only inserts facts and after 20 facts I get the following error: [ERROR] [System] - Exception in thread Thread-8 java.lang.ExceptionInInitializerError [ERROR] [System] - at org.drools.concurrent.ExecutorProviderFactory.getExecutorProvider(ExecutorProviderFactory.java:12) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint$ExecutorHolder.clinit(MvelConstraint.java:208) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint.jitEvaluator(MvelConstraint.java:199) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:164) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:124) [ERROR] [System] - at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137) [ERROR] [System] - at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59) [ERROR] [System] - at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235) [ERROR] [System] - at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:123) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:53) [ERROR] [System] - at de.pelle7.drools.test1.simpletest.SimpleTestDrools$1.run(SimpleTestDrools.java:74) [ERROR] [System] - Caused by: java.lang.IllegalArgumentException: Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider' [ERROR] [System] - at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:162) [ERROR] [System] - at org.drools.concurrent.ExecutorProviderFactory$ExecutorProviderHolder.clinit(ExecutorProviderFactory.java:8) [ERROR] [System] - ... 14 more [ERROR] [System] - Caused by: java.lang.IllegalArgumentException: Unable to instantiate 'org.drools.concurrent.ExecutorProviderImpl' [ERROR] [System] - at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:213) [ERROR] [System] - at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.call(ServiceRegistryImpl.java:205) [ERROR] [System] - at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:160) [ERROR] [System] - ... 15 more [ERROR] [System] - Caused by: java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl [ERROR] [System] - at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) [ERROR] [System] - at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) [ERROR] [System] - at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) [ERROR] [System] - at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) [ERROR] [System] - at java.lang.ClassLoader.loadClass(Unknown Source) [ERROR] [System] - at java.lang.Class.forName0(Native Method) [ERROR] [System] - at java.lang.Class.forName(Unknown Source) [ERROR] [System] - at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:210) [ERROR] [System] - ... 17 more The Rule file: package de.pelle7.drools.test1.users.rules.impl; import de.pelle7.drools.test1.simpletest.*; import org.jbpm.ruleflow.instance.*; rule Funny Rule #1 dialect java when $testObject : TestObjectA( value == 0 ) from entry-point my_entry then System.err.println(New Item: + $testObject); retract($testObject); end If I change the line -- $testObject : TestObjectA( value == 0 ) from entry-point my_entry to -- $testObject : TestObjectA( ) from entry-point my_entry there is no problem. In the java code i initialize a Drools Session programatically and add one rule file: package de.pelle7.drools.test1.simpletest; import java.io.InputStream; import java.net.URI; import java.net.URL; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseConfiguration; import org.drools.KnowledgeBaseFactoryService; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderConfiguration; import org.drools.builder.KnowledgeBuilderFactoryService; import org.drools.builder.ResourceType; import org.drools.definition.KnowledgePackage; import org.drools.io.ResourceFactory; import