If you are using 5.2.0-SNAPSHOT in both of your applications, this shouldn't be happening. Please double check it.
As a workaround, you could get rule's sources from Guvnor instead of the binary package.

Best, 

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Thu, Nov 25, 2010 at 7:55 PM, mjhn <mjohnson@quickcut.com.au> wrote:

Hi,

I had previously posted to drools-users. Maybe wrong place for it. I am an
absolute new user. Excited and Very keen to have this working and for any
feedback to help me progress.

I'm using the 5.2.0-SNAPSHOT binaries for making use of the new auth
attributes in the kagent:resource tag.

I'm attempting to get PKG out of Guvnor. Using the following
droolsservice.xml config

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:drools="http://drools.org/schema/drools-spring"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                                               http://drools.org/schema/drools-spring
http://192.168.2.2/~martinjohnson/xmpp_code/drools-spring-1.2.0.xsd
                         http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd" >

<drools:kagent kbase="knowledgeBase" id="kagent" new-instance="false">
      <drools:resources>
              <drools:resource type="CHANGE_SET"
basic-authentication="enabled" username="admin" password=""
source="http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/TicketImportPackage/LATEST/ChangeSet.xml"
/>
      </drools:resources>
</drools:kagent>
</beans>

As far as i can tell the ChangeSet.xml is coming down. The PKG accessed.
Though then...


Nov 25, 2010 9:09:52 PM com.javawhat.rules.RuleAgentManager init
INFO: Loading knowledge agents ...
Nov 25, 2010 9:09:52 PM com.javawhat.rules.RuleAgentManager init
INFO: Initializing knowledge agents with package:
[2010:11:329 21:11:675:info] ResourceChangeScanner reconfigured with
interval=60
[2010:11:329 21:11:676:info] ResourceChangeScanner created with default
interval=60
[2010:11:329 21:11:682:info] ResourceChangeScanner reconfigured with
interval=120
[2010:11:329 21:11:682:info] ResourceChangeScanner reconfigured with
interval=120
[2010:11:329 21:11:14:info] ResourceChangeNotification created
[2010:11:329 21:11:14:debug] ResourceChangeNotification monitor added
monitor=org.drools.io.impl.ResourceChangeScannerImpl@37722456
[2010:11:329 21:11:17:debug] KnowledgeAgent building resource map
[2010:11:329 21:11:17:info] KnowledegAgent has started listening for
ChangeSet notifications
[2010:11:329 21:11:18:info] KnowledgeAgent created, with configuration:
monitorChangeSetEvents=true scanResources=true scanDirectories=true
newInstance=false
[2010:11:329 21:11:514:info] KnowledgeAgent applying ChangeSet
[2010:11:329 21:11:516:debug] KnowledgeAgent notifier subscribing to
resource=[UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/TicketImportPackage/LATEST']
[2010:11:329 21:11:516:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@23000bcf to
resource=[UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/TicketImportPackage/LATEST']
[2010:11:329 21:11:516:debug] ResourceChangeScanner subcribing
notifier=org.drools.io.impl.ResourceChangeNotifierImpl@580754fc to
resource=[UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/TicketImportPackage/LATEST']
[2010:11:329 21:11:517:debug] KnowledgeAgent rebuilding KnowledgeBase using
ChangeSet
[2010:11:329 21:11:517:info] KnowledgeAgent performing an incremental build
of the ChangeSet
[2010:11:329 21:11:280:exception]
java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
       at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:665)
       at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:618)
       at
org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:809)
       at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:587)
       at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:186)
       at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:169)
       at
com.javawhat.rules.RuleAgentManager.createKnowledgeAgent(RuleAgentManager.java:125)
       at com.javawhat.rules.RuleAgentManager.init(RuleAgentManager.java:85)
       at
com.javawhat.rules.RuleAgentManager.getInstance(RuleAgentManager.java:48)
       at com.adstream.test.Main.main(Main.java:53)
Caused by: java.io.OptionalDataException
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1282)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
       at
org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:167)
       at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
       at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
       at java.util.HashMap.readObject(HashMap.java:1030)
       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 java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
       at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
       at
org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:59)
       at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
       at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
       at org.drools.rule.Package.readExternal(Package.java:197)
       at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
       at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
       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:654)
       ... 9 more
[2010:11:329 21:11:283:warning] KnowledgeAgent: The resource didn't create
any package: [UrlResource
path='http://localhost:8080/drools-guvnor.war/org.drools.guvnor.Guvnor/package/TicketImportPackage/LATEST']
[2010:11:329 21:11:283:info] KnowledgeAgent incremental build of
KnowledgeBase finished and in use
[2010:11:329 21:11:284:debug] KnowledgeAgent finished rebuilding
KnowledgeBase using ChangeSet


The issue lies behind 'stream.readObject();' from JavaDialectRuntimeData
around line 167

// Return the object stored as a byte[]
      byte[] bytes = (byte[]) stream.readObject();
      if ( signed ) {
          checkSignature( stream,
                          helper,
                          bytes,
                          pubKeyAlias );
      }

guvnor and my sample app are both running 5.2.0-SNAPSHOT. Really appreciate
any advice. Is it falling over an a parse of the binary and some
disagreement on contents of payload?

Thanks

Martin
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/5-2-0-SNAPSHOT-java-io-OptionalDataException-repost-tp1970098p1970098.html
Sent from the Drools - Dev mailing list archive at Nabble.com.
_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev