Conversion to long not supported from java.String

以下是错误:
Exception in thread "main" org.drools.RuntimeDroolsException: Conversion to long not supported from java.lang.String
at org.drools.base.extractors.BaseObjectClassFieldExtractor.getLongValue(BaseObjectClassFieldExtractor.java:106)
at org.drools.base.ClassFieldExtractor.getLongValue(ClassFieldExtractor.java:203)
at org.drools.rule.VariableRestriction$LongVariableContextEntry.updateFromTuple(VariableRestriction.java:284)
at org.drools.common.DefaultBetaConstraints.updateFromTuple(DefaultBetaConstraints.java:139)
at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:102)
at org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(SingleTupleSinkAdapter.java:20)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:151)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:140)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:140)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:299)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
at com.sample.Fishman.main(Fishman.java:30)
以下是部分代码:
final StatefulSession session=ruleBase.newStatefulSession();
String[] country=new String[]{"Norway","Danmark","Britain","Germany","Sweden"};
String[] housecolor=new String[]{"yellow","blue","red","green","white"};
String[] drink=new String[]{"mineralwater","tea","milk","coffee","beer"};
String[] cigarettebrand=new String[]{"Dunhill","Blends","PallMall","Prince","BlueMaster"};
String[] pet=new String[] {"cat","horse","bird","fish","dog"};
int[] positions = new int[] { 1, 2, 3, 4,5 };

for (int i=0;i<country.length;i++)
{
for(int g=0;g<housecolor.length;g++){
for(int k=0;k<drink.length;k++){
for(int l=0;l<cigarettebrand.length;l++){
for(int j=0;j<pet.length;j++){
for(int h=0;h<positions.length;h++){
session.insert(new People(country[i],housecolor[g],drink[k],cigarettebrand[l],pet[j],positions[h]));//提示的就是此行有错 ,它就是"Fishman.java:30"
}
}
}
}
}
}
session.fireAllRules();
session.dispose();

你可能感兴趣的:(conversion)