Hi,
I have used 5.1 drools-api and drools-core JARs and wrote following code :
String currentWorkingDirectory = System.getProperty("ofbiz.home");
kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyRuleAgent"
);
String url =
"file:"+currentWorkingDirectory+"/framework/drools/config/changeset.xml";
System.out.println("Url is "+url+"\t CwD
"+currentWorkingDirectory);
kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) );
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newUrlResource( url ),
ResourceType.CHANGE_SET );
kbase = kagent.getKnowledgeBase();
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
While execution , I got following error :
Service invocation error
Exception: org.ofbiz.service.GenericServiceException
Message: Service [ruleServiceJava] target threw an unexpected exception
(org/drools/rule/CompositeClassLoader)
---- cause
---------------------------------------------------------------------
Exception: java.lang.NoClassDefFoundError
Message: org/drools/rule/CompositeClassLoader
---- stack trace
---------------------------------------------------------------
java.lang.NoClassDefFoundError: org/drools/rule/CompositeClassLoader
org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:47)
org.drools.agent.impl.KnowledgeAgentImpl.createKBuilder(KnowledgeAgentImpl.java:1214)
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:884)
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:704)
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:584)
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:168)
org.ofbiz.drools.event.drool.RuleIntegrate.createKnowledgeBase(RuleIntegrate.java:46)
org.ofbiz.drools.event.drool.RuleIntegrate.createWorkingMemory(RuleIntegrate.java:29)
org.ofbiz.payroll.DroolsRule.callRuleJava(DroolsRule.java:42)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:100)
org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:57)
org.ofbiz.service.ModelServiceReader$GenericInvokerImpl.runSync(ModelServiceReader.java:761)
_$gen.file_58$.D_58$.Swapnil_95$Data.ofbiz_95$payroll.ofbiz_45$17_45$Aug_45$2010.applications.payroll.servicedef.services
_46$xml_35$ruleServiceJava.runSync(file:/D:/Swapnil_Data/ofbiz_payroll/ofbiz-17-Aug-2010/applications/payroll/servicedef/
services.xml#ruleServiceJava:114)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:399)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:226)
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:165)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:336)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:637)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:383)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227)
org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:90)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:619)
--------------------------------------------------------------------------------
Then I check drools-core.jar in version 5 and in 5.1 too.
The problem I found was 'org/drools/rule/CompositeClassLoader' class
was present in 5.0 version but was not there in 5.1 .
Pl help me in resolving this issue.
Thanks,
Swapnil Sawant
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Error-while-applying-...
Sent from the Drools - User mailing list archive at
Nabble.com.