Hello,
Im having trouble with the BRMS front end throwing an:
Exception in thread "main" java.lang.ClassCastException: java.util.HashSet
cannot be cast to java.util.List
at org.drools.rule.Package.readExternal(Package.java:172)
This is what I have set up:
jbossweb-1.0.1.GA
drools-4.0.1-brms
Java version 1.6.0 - VM 1.6.0-b105
mvel jar file:
mvel14-1.2rc4rv908 (taken from the jbossweb lib)
This is the class, which i put into a .jar, which in turn I import into the front end:
package data;
import java.io.Serializable;
public class ExceptionType implements Serializable{
private String customerType = "";
private String exceptionType = "";
public ExceptionType(){}
public ExceptionType(String customerType, String exceptionType)
{
this.exceptionType = exceptionType;
this.customerType = customerType;
}
public void setExceptionType(String exceptionType) {
this.exceptionType = exceptionType;
}
public String getExceptionType() {
return exceptionType;
}
public void setCustomerType(String customerType) {
this.customerType = customerType;
}
public String getCustomerType() {
return customerType;
}
}
And here is the starting point:
package data;
import java.util.Properties;
import org.drools.RuleBase;
import data.ExceptionType;
import org.drools.StatefulSession;
import org.drools.agent.RuleAgent;
public class Runner {
public Runner()
{
ExceptionType e = new ExceptionType("das", "32432");
e.setExceptionType("system failure");
Properties prop = new Properties();
prop.setProperty("newInstance", "true");
prop.setProperty("url","http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/defaultPackage/snap2");
prop.setProperty("poll", "30");
RuleAgent agent = RuleAgent.newRuleAgent(prop); //error occurs on this line.
RuleBase rb = agent.getRuleBase();
StatefulSession session = rb.newStatefulSession();
session.insert(e);
session.fireAllRules();
}
/**
* @param args
*/
public static void main(String[] args)
{
new Runner();
}
}
I have specified a package import in the packge in the front end:
import data.ExceptionType
Validation of the .jar file and build of the package seem to work fine.
Here is the complete stack trace:
RuleAgent(default) INFO (Fri Sep 28 21:57:54 NZST 2007): Configuring with
newInstance=true, secondsToRefresh=30
RuleAgent(default) INFO (Fri Sep 28 21:57:54 NZST 2007): Configuring package provider :
URLScanner monitoring URLs:
http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/defaultP...
Exception in thread "main" java.lang.ClassCastException: java.util.HashSet
cannot be cast to java.util.List
at org.drools.rule.Package.readExternal(Package.java:172)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:54)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:137)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:109)
at org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)
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 data.Runner.<init>(Runner.java:25)
at data.Runner.main(Runner.java:37)
Any help would be appreciated.
Thanks,
Wojtek Kedzior
First Data Utilities
Auckland, New Zealand
Software Engineering