Unable to connect to read the rules from Guvnor through eclipse.
pdee Jul 22, 2012 10:49 PMHi ,
I am a newbie to drools . The following is my project set up :-
Guvnor : Version 5.3.0.Final
Name | Version | Id | Provider |
Eclipse IDE for Java EE Developers | 1.4.2.20120213-0813 | epp.package.jee | |
Eclipse Platform | 3.7.2.M20120208-0800 | org.eclipse.platform.ide | null |
Java EE IDE Feature | 1.4.2.20120213-0813 | org.eclipse.epp.package.jee.feature.feature.group | Eclipse Packaging Project |
JBoss Drools Core | 5.3.0.Final | org.drools.eclipse.feature.feature.group | JBoss by Red Hat |
JBoss Drools Task | 5.3.0.Final | org.drools.eclipse.task.feature.feature.group | JBoss by Red Hat |
JBossAS Tools | 2.3.1.v20120706-1758-H139-CR1 | org.jboss.ide.eclipse.as.feature.feature.group | JBoss by Red Hat |
JBoss Archives Tools | 3.3.1.v20120706-1740-H90-CR1 | org.jboss.ide.eclipse.archives.feature.feature.group | JBoss by Red Hat |
JBossAS Tools Server / Compression Integration | 2.3.1.v20120706-1758-H139-CR1 | org.jboss.ide.eclipse.as.archives.integration.feature.feature.group | JBoss by Red Hat |
JBossAS Tools Server / JMX Integration | 2.3.1.v20120706-1758-H139-CR1 | org.jboss.ide.eclipse.as.jmx.integration.feature.feature.group | JBoss by Red Hat |
JBossAS Tools Server / Remote Systems Integration | 2.3.1.v20120706-1758-H139-CR1 | org.jboss.ide.eclipse.as.server.rse.integration.feature.feature.group | JBoss by Red Hat |
JBossAS Tools Server Adapter | 2.3.1.v20120706-1758-H139-CR1 | org.jboss.ide.eclipse.as.serverAdapter.wtp.feature.feature.group | null |
JMX Console | 1.3.1.v20120706-1745-H74-CR1 | org.jboss.tools.jmx.feature.feature.group | JBoss by Red Hat |
(Using jre7)
Steps :-
- Created a new fact jar , by name NameAgefact.jar , with fields name and age .
- Uploaded the jar into the webdav.
- Created a new rule based on this jar.
- Created a changeset (NameAge.xml )with the following entry :-
<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns="http://drools.org/drools-5.0/change-set"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd">
<add>
<resource
source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/NameAge/LATEST/ChangeSet.xml"
type="PKG" basicAuthentication="enabled" username="admin" password="admin"/>
</add>
</change-set>
5. Created a main class with the following :-
KnowledgeAgent kagent = KnowledgeAgentFactory .newKnowledgeAgent("kagent");
Resource resource = ResourceFactory.newClassPathResource("NameAge.xml");
try{
kagent.applyChangeSet(resource);
}catch(Exception e){
System.out.println("there was an error executing the package");
}
KnowledgeBase kbase = kagent.getKnowledgeBase();
kagent.dispose();
I get the following error message :-
java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage
there was an error executing the package
at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:776)
at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1071)
at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:824)
at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:673)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:203)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:182)
at AntTrialTest.main(AntTrialTest.java:15)
Caused by: java.io.StreamCorruptedException: invalid stream header: 3C636861
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at org.drools.common.DroolsObjectInputStream.<init>(DroolsObjectInputStream.java:68)
at org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:205)
at org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:174)
at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:749)
... 6 more
I did make sure that the server and the client share the same JVM.
I am not sure as to where am I going wrong . Would be really helpful , if someone can help me rectify .