Java 运行Apache SCXML引擎时发生异常。参数类型不匹配-
我正在使用apache commons scxml引擎运行。 我有一个扩展AbstractStateMachine的自定义类Java 运行Apache SCXML引擎时发生异常。参数类型不匹配-,java,apache-commons,scxml,apache-commons-scxml,Java,Apache Commons,Scxml,Apache Commons Scxml,我正在使用apache commons scxml引擎运行。 我有一个扩展AbstractStateMachine的自定义类 public class MicrowaveOwenStateMachine extends AbstractStateMachine { public MicrowaveOwenStateMachine() { super(MicrowaveOwenStateMachine.class.getClassLoader().ge
public class MicrowaveOwenStateMachine extends AbstractStateMachine {
public MicrowaveOwenStateMachine() {
super(MicrowaveOwenStateMachine.class.getClassLoader().getResource("mOwen.xml"));
}
public State getCurrentState() {
Set<?> states = getEngine().getCurrentStatus().getStates();
return ( (State) states.iterator().next());
}
public void oven(){
System.out.println("State :oven");
}
public void engine(){
System.out.println("State : Engine");
}
public void off(){
System.out.println("State : off");
}
public void on(){
System.out.println("State : on");
}
public void idle(){
System.out.println("State : Idle");
}
public void cooking(){
System.out.println("State : Cooking");
}
public void door(){
System.out.println("State : Door");
}
public void closed(){
System.out.println("State : Closed");
}
public void open(){
System.out.println("State : Open");
}
}
我知道这与我的数据模型有关,因为数据模型不被视为XML节点,我发现了一些有用的东西:
- Apache commons scxml不喜欢
标记中的
属性;别说了datamodel=“ecmascript”
- 在查看JEXL evaluator源代码之前,我在
表达式方面遇到了问题;当我从
切换到位置
时,它似乎起作用了:名称
您解决了这个问题吗?我刚刚遇到了同样的问题。
java.lang.IllegalArgumentException: Cannot invoke org.apache.commons.scxml.model.SCXML.setDatamodel on bean class 'class org.apache.commons.scxml.model.SCXML' - argument type mismatch - had objects of type "java.lang.String" but expected signature "org.apache.commons.scxml.model.Datamodel"
at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2235)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2151)
at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1957)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2064)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1017)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:830)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:433)
at org.apache.commons.digester.SetPropertiesRule.begin(SetPropertiesRule.java:252)
at org.apache.commons.digester.Rule.begin(Rule.java:175)
at org.apache.commons.digester.Digester.startElement(Digester.java:1464)
at
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="init"
<datamodel>
<data id="loop_ctr" expr="0"/>
</datamodel>
...
<state id="in_progress">
<onentry>
<assign name="loop_ctr" expr="loop_ctr + 1"/>
</onentry>
<transition event="complete" target="in_review"></transition>
</state>
...