Well, the BRMS is tricky because it doesnt have good error report  and it is very strict on dependencies...

What I did to resolve my problems was check every import and class used in my model. For example I had to
re-check the libraries used on my model (like joda-time which I had to include in the model jar imported into the
BRMS package). Also I was very careful checking the "import <class>" declaration on the BRMS's package config.

Also check that the mvel jar is the same in the BRMS and your test classpath. (this was all the problem in the readPackage and
serialization problem). BRMS needs to throw better error messages I think, because this errors are very usual.

That solved my problem.

Thanks and good luck!


On 21-08-2007, at 12:18, Felipe Piccolini wrote:

Hi,

Im trying to test the RuleAgent to get a pkg from BRMS (url) but it cant load the pkg (which was succesfuly
created) from the snapshot url given by BRMS. If I try to connect to that URL I inmediatly get the pkg to download...

Tryed to debug but I stoped at 
DroolsObjectInputStream oin = new DroolsObjectInputStream(in);
                return (Package) oin.readObject();

at HttpClientImpl.java... the readObject() fails from ObjectInputStream.

Here is the stacktrace....

RuleAgent(testSolcredProfesion) INFO (Tue Aug 21 10:12:02 CLT 2007): Configuring with newInstance=true, secondsToRefresh=30
RuleAgent(testSolcredProfesion) INFO (Tue Aug 21 10:12:06 CLT 2007): Configuring package provider : URLScanner monitoring URLs:  http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/cl.bluesoft.test/test_1.0 with local cache dir of /tmp/drools
RuleAgent(testSolcredProfesion) WARNING (Tue Aug 21 10:12:08 CLT 2007): Falling back to local cache.
java.lang.NullPointerException
at org.drools.agent.FileScanner.readPackage(FileScanner.java:101)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
at org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:93)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:297)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:265)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:251)
at org.drools.agent.RuleAgent.init(RuleAgent.java:183)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:140)
at cl.bluesoft.drools.api.RulesFactory.addRules(RulesFactory.java:149)
at cl.bluesoft.test.TestBRMS.main(TestBRMS.java:36)

-------
Also downloaded the pakage from the BRMS and used simple BinaryRuleBaseLoader:

BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader(ruleBase);
    loader.addPackage( CONTEXT_CLASS_LOADER.getResourceAsStream( binaryPackageFilePath ) );
 
but I have a problem with serialization... my first thought was about different mvel jars, replaced mvel jar in my classpath with the one in BRMS war, but
the problem is still there... Im using Enum clases (enum types from 1.5), maybe this is the problem?... because I cant set the serialVersionID in enums.

org.drools.RuntimeDroolsException: java.io.InvalidClassException: org.mvel.CompiledExpression; local class incompatible: stream classdesc serialVersionUID = -8459552198577984707, local class serialVersionUID = -1994048675652702021
at org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:100)
at org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:67)
at cl.bluesoft.drools.api.RulesFactory.addRulesBinPkg(RulesFactory.java:105)
at cl.bluesoft.solcred.TestSolcredProfesionBinPkg.main(TestSolcredProfesionBinPkg.java:35)
Caused by: java.io.InvalidClassException: org.mvel.CompiledExpression; local class incompatible: stream classdesc serialVersionUID = -8459552198577984707, local class serialVersionUID = -1994048675652702021
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:546)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at java.util.HashMap.readObject(HashMap.java:1013)
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:585)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.rule.Package.readExternal(Package.java:184)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.util.BinaryRuleBaseLoader.addPackage(BinaryRuleBaseLoader.java:82)
... 3 more

Thanks for help... I really need to use enums in my model...  :)


                                                                        
Felipe Piccolini M.




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



Atentamente,
______________________
Felipe Piccolini Marfull
Jefe de Proyectos
Agustina 1141 Piso 8-B
Santiago

 

Fono    +(56 2) 68830837
E-mail felipe.piccolini@bluesoft.cl