0 Replies Latest reply on Jul 22, 2012 10:49 PM by pdee

    Unable to connect to read the rules from Guvnor through eclipse.

    pdee Newbie

      Hi ,

       

      I am a newbie to drools . The following is my project set up :-

      Guvnor : Version 5.3.0.Final

       

       

      NameVersion

      Id

      Provider
        Eclipse IDE for Java EE Developers1.4.2.20120213-0813epp.package.jee
      Eclipse Platform3.7.2.M20120208-0800org.eclipse.platform.idenull
      Java EE IDE Feature1.4.2.20120213-0813org.eclipse.epp.package.jee.feature.feature.groupEclipse Packaging Project
      JBoss Drools Core5.3.0.Finalorg.drools.eclipse.feature.feature.groupJBoss by Red Hat
      JBoss Drools Task5.3.0.Finalorg.drools.eclipse.task.feature.feature.groupJBoss by Red Hat
      JBossAS Tools2.3.1.v20120706-1758-H139-CR1org.jboss.ide.eclipse.as.feature.feature.groupJBoss by Red Hat
      JBoss Archives Tools3.3.1.v20120706-1740-H90-CR1org.jboss.ide.eclipse.archives.feature.feature.groupJBoss by Red Hat
      JBossAS Tools Server / Compression Integration2.3.1.v20120706-1758-H139-CR1org.jboss.ide.eclipse.as.archives.integration.feature.feature.groupJBoss by Red Hat
      JBossAS Tools Server / JMX Integration2.3.1.v20120706-1758-H139-CR1org.jboss.ide.eclipse.as.jmx.integration.feature.feature.groupJBoss by Red Hat
      JBossAS Tools Server / Remote Systems Integration2.3.1.v20120706-1758-H139-CR1org.jboss.ide.eclipse.as.server.rse.integration.feature.feature.groupJBoss by Red Hat
      JBossAS Tools Server Adapter2.3.1.v20120706-1758-H139-CR1org.jboss.ide.eclipse.as.serverAdapter.wtp.feature.feature.groupnull
      JMX Console1.3.1.v20120706-1745-H74-CR1org.jboss.tools.jmx.feature.feature.groupJBoss by Red Hat

       

      (Using jre7)

       

      Steps :-

       

      1. Created a new fact jar , by name NameAgefact.jar , with fields name and age .
      2. Uploaded the jar into the webdav.
      3. Created a new rule based on this jar.
      4. 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 .