[jboss-user] [jBPM] - Unknown resource type: null when call kagent.applyChangeSet( resource ) the second time.

TC ONG do-not-reply at jboss.com
Fri Mar 9 01:36:16 EST 2012


TC ONG [https://community.jboss.org/people/devilkazuya99] created the discussion

"Unknown resource type: null when call kagent.applyChangeSet( resource ) the second time."

To view the discussion, visit: https://community.jboss.org/message/722709#722709

--------------------------------------------------------------
          URL url = new URL(CHANGE_SET_URL);
          UrlResource resource = (UrlResource) ResourceFactory.newUrlResource( url );
               
          KnowledgeAgentConfiguration agentConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); 
             agentConfig.setProperty("drools.agent.newInstance", "true");
             agentConfig.setProperty("drools.agent.scanDirectories", "false");

               KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyKnowledgeAgent", agentConfig );
               
               KnowledgeAgentEventListener kaListener = new KnowledgeAgentEventListener() {
                    
                    @Override
                    public void resourceCompilationFailed(ResourceCompilationFailedEvent arg0) {
                         logger.debug("resourceCompilationFailed");
                    }
                    
                    @Override
                    public void knowledgeBaseUpdated(KnowledgeBaseUpdatedEvent arg0) {
                         logger.debug("knowledgeBaseUpdated");
                    }
                    
                    @Override
                    public void beforeResourceProcessed(BeforeResourceProcessedEvent arg0) {
                         logger.debug("beforeResourceProcessed");
                    }
                    
                    @Override
                    public void beforeChangeSetProcessed(BeforeChangeSetProcessedEvent arg0) {
                         logger.debug("beforeChangeSetProcessed");
                    }
                    
                    @Override
                    public void beforeChangeSetApplied(BeforeChangeSetAppliedEvent arg0) {
                         logger.debug("beforeChangeSetApplied");
                    }
                    
                    @Override
                    public void afterResourceProcessed(AfterResourceProcessedEvent arg0) {
                         logger.debug("afterResourceProcessed");
                    }
                    
                    @Override
                    public void afterChangeSetProcessed(AfterChangeSetProcessedEvent arg0) {
                         logger.debug("afterChangeSetProcessed");
                    }
                    
                    @Override
                    public void afterChangeSetApplied(AfterChangeSetAppliedEvent arg0) {
                         logger.debug("afterChangeSetApplied");
                    }
               };
               
               kagent.addEventListener(kaListener);
               
               kagent.applyChangeSet( resource );
               
               kagent.monitorResourceChangeEvents(true); 



The code above is ok but when I call 

kagent.applyChangeSet( resource );

again then I get
Exception in thread "Thread-3" java.lang.RuntimeException: Unknown resource type: null
     at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:686)
     at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)
     at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:712)
     at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1002)
     at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:785)
     at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:657)
     at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:190)
     at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:169)
     at com.geneoz.procedureengine.KnowledgeAgentTest$ResourcePoller.run(KnowledgeAgentTest.java:68)
     at java.lang.Thread.run(Thread.java:680)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/722709#722709]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120309/e79fb666/attachment-0001.html 


More information about the jboss-user mailing list