Re: [rules-users] Use Drools-Guvnor .pkg

2010-06-03 Thread Esteban Aliverti
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  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

[rules-users] Use Drools-Guvnor .pkg

2010-06-03 Thread Josua

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.