1
我有一個隊列tibco.I我試圖從隊列使用drools管道接收對象如下。問題與Drools管道
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
String jmsRules ="jms.drl";
kbuilder.add(ResourceFactory.newClassPathResource(jmsRules, getClass()), ResourceType.DRL);
if (kbuilder.hasErrors()) {
System.out.println("KBuilder has errors: " + kbuilder.getErrors());
return;
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeCommand insertStage = PipelineFactory.newStatefulKnowledgeSessionInsert();
Action unwrapObjectStage = PipelineFactory.newJmsUnwrapMessageObject();
unwrapObjectStage.setReceiver(insertStage);
Pipeline entry = PipelineFactory.newStatefulKnowledgeSessionPipeline(ksession);
entry.setReceiver(unwrapObjectStage);
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.tibco.tibjms.naming.TibjmsInitialContextFactory");
props.setProperty(Context.URL_PKG_PREFIXES, "com.tibco.tibjms.naming");
props.setProperty(Context.PROVIDER_URL, "tibjmsnaming://10.6.8.21:7222");
String destinationName = "DIAG1_vmware-ucs-1-v02_routing";
Service messenger = PipelineFactory.newJmsMessenger(entry, props, destinationName, null);
messenger.start();
ksession.fireAllRules();
System.out.println("NUMBER OF FACTS INSERTED===>"+ksession.getFactCount());
ksession.dispose();
messenger.stop();
指定的隊列(DIAG1_vmware-UCS-1-v02_routing)objects.when我運行程序我得到以下異常早已寥寥無幾。
Exception in thread "main" java.lang.RuntimeException: Unable to instantiate JmsFeeder
at org.drools.runtime.pipeline.impl.JmsMessenger.<init>(JmsMessenger.java:63)
at org.drools.runtime.pipeline.impl.JmsMessengerProviderImpl.newJmsMessenger(JmsMessengerProviderImpl.java:34)
at org.drools.runtime.pipeline.PipelineFactory.newJmsMessenger(PipelineFactory.java:410)
at com.sample.JMSPipelineSmooksDemo.go(JMSPipelineSmooksDemo.java:78)
at com.sample.JMSPipelineSmooksDemo.main(JMSPipelineSmooksDemo.java:26)
Caused by: javax.naming.NameNotFoundException: Name not found: 'ConnectionFactory'
at com.tibco.tibjms.naming.TibjmsContext.lookup(TibjmsContext.java:713)
at com.tibco.tibjms.naming.TibjmsContext.lookup(TibjmsContext.java:489)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.drools.runtime.pipeline.impl.JmsMessenger.<init>(JmsMessenger.java:60)
... 4 more
請幫我解決問題。