Indeed, the change set is an xml file specifying the resources to add/modify/remove. Take a look at the change set structure here: http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e788

Best, 

On Thu, Jun 3, 2010 at 5:48 PM, Josua <josua.troesch@bluewin.ch> wrote:

Hi,

I’m new to drools, just started evaluating Drools-Guvnor for a project. To
take advantage of Java-enums I’m using the current 5.1.0 Milestone 2.

I created a decision table (web-guided) in drools-guvnor and deployed the
package snapshot, which is downloadable and returns a .pkg-File. This File
is in some Binary format (non plaintext). When I try to load that package in
code using a KnowledgeAgent it fails on the following code line:

knowledgeAgent.applyChangeSet(resource);

with an Exception: “java.lang.RuntimeException: Unable to parse ChangeSet …
Caused by: org.xml.sax.SAXParseException: Content is not allowed in
prolog.”.
I debugged it, and it seems to try to parse XML content from this binary
file..

Can anyone tell me the proper way to load a package from a remote Guvnor
installation?

Thx!


Complete code:
 KnowledgeAgent knowledgeAgent =
KnowledgeAgentFactory.newKnowledgeAgent("testAgent");
 UrlResource resource = (UrlResource) ResourceFactory.newUrlResource(url);
 resource.setBasicAuthentication("enabled");
 resource.setUsername("whatever");
 resource.setPassword("");
 knowledgeAgent.applyChangeSet(resource);
 KnowledgeBase knowledgeBase = knowledgeAgent.getKnowledgeBase();

Stacktrace:

java.lang.RuntimeException: Unable to parse ChangeSet
           at
org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:323)
           at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:130)
           at
com.efgfp.hermes.drools.test.DroolsTest.testDroolsDecisionTable(DroolsTest.java:37)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at
org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
           at
org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
           at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at
org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
           at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
           at
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
           at
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
           at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
           at
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
           at org.testng.TestRunner.runWorkers(TestRunner.java:908)
           at org.testng.TestRunner.privateRun(TestRunner.java:617)
           at org.testng.TestRunner.run(TestRunner.java:498)
           at org.testng.SuiteRunner.runTest(SuiteRunner.java:329)
           at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:324)
           at org.testng.SuiteRunner.privateRun(SuiteRunner.java:296)
           at org.testng.SuiteRunner.run(SuiteRunner.java:201)
           at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
           at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
           at org.testng.TestNG.run(TestNG.java:787)
           at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75)
           at
org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:79)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
           at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
           at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
           at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
           at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
           at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1038)
           at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
           at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
           at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
           at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
           at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
           at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
           at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
           at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
           at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
           at
org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:295)
           at
org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:174)
           at
org.drools.xml.XmlChangeSetReader.read(XmlChangeSetReader.java:49)
           at
org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:320)
           ... 36 more
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Use-Drools-Guvnor-pkg-tp868651p868651.html
Sent from the Drools - User mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti