我想使用EJB3规则会话从Java独立客户端执行规则执行服务器。
public class TestGameExecute {
public static void main(String[] args) {
Map<String,Object> inputParameters = new HashMap<String, Object>();
Map<String,Object> resMap = null;
IlrEJB3SessionFactory ejbSF;
IlrStatelessSession rs;
Game game = new Game(10,3);
inputParameters.put("GAME", game);
Hashtable<String, String> jndiProperties = new Hashtable<String, String>();
jndiProperties.put("java.naming.provider.url", "corbaloc:iiop:********");
jndiProperties.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
jndiProperties.put("java.naming.security.principal", "username");
jndiProperties.put("java.naming.security.credentials", "password");
try {
ejbSF = new IlrEJB3SessionFactory(jndiProperties);
ejbSF.setRemote(true);
ejbSF.setStatelessRemoteJndiName("ilog.rules.res.session.impl.ejb3.IlrStatelessSessionRemote");
rs = ejbSF.createStatelessSession();
IlrSessionRequest request = ejbSF.createRequest();
request.setRulesetPath(new IlrPath("/GAMLCDDRuleAppPhaseII/SiorkCDDRuleProject_PhaseII"));
request.setInputParameters(inputParameters);
request.setForceUptodate(true);
request.setTraceEnabled(true);
request.getTraceFilter().setInfoAllFilters(true);
IlrSessionResponse response = rs.execute(request);
resMap = response.getOutputParameters();
Game retGame =(Game)resMap.get("GAME");
System.out.println(retGame.getWinner());
} catch (IlrSessionCreationException e) {
e.printStackTrace();
} catch (IlrSessionException e) {
e.printStackTrace();
}
}
}
我在下面得到此错误:
线程中的异常" p = 421238:o = 0:ct" java.rmi.marshalexception:Corba Marshal 0x4942f896否;嵌套的例外是: org.omg.corba.marshal: 服务器(ID = 614476EB,HOST = GAMLWM000T01.ESUNBANK.COM.TW)跟踪启动: org.omg.corba.marshal:无法从基础桥梁读取值:无法从下面的桥梁读取值:ClassNotFoundException com.siork.siork.siork.cdd.game vmcid:IBM次要代码:896完成:否:否 在com.ibm.rmi.iiop.cdrreader.read_value(cdrreader.java:1649) 在com.ibm.rmi.iiop.cdrreader.read_abstract_interface(cdrreader.java:1606) 在com.ibm.rmi.iiop.cdrreader.read_abstract_interface(cdrreader.java:1591) 请访问iLog.rules.res.session.impl.ejb3._ejsremote0slilrstatelesssessioneejb3_fdcc75a4_tie.tie.execute(_ejsremote0slemote0slemote0slemoteslemoteslemoteSlemoteSsessesseeejb3_fdcc75a4_tie.java:100) at Ilog.rules.res.session.impl.ejb3._ejsremote0slilrstatelesssessioneejb3_fdcc75a4_tie._invoke(_ejsremote0slemote0slemote0slemoteslemoteslemoteslemoteslemerrstatelesssessioneejb3_fdcc75a4_tie.java) 请访问com.ibm.corba.iiop.serverdelegate.dispatchinvokehandler(serverdelegate.java:669) 在com.ibm.corba.iiop.serverdelegate.dispatch(serverdelegate.java:523) 在com.ibm.rmi.iiop.orb.orb.process(orb.java:523) 在com.ibm.corba.iiop.orb.orb.process(orb.java:1575) 在com.ibm.rmi.iiop.connection.dorequestwork(Connection.java:3039) 在com.ibm.rmi.iiop.connection.dowork(Connection.java:2922) 在com.ibm.rmi.iiop.workunitimpl.dowork(workunitimpl.java:64) 在com.ibm.ejs.oa.pool.pool.pooledthread.run(threadpool.java:118) 请访问com.ibm.ws.util.threadpool $ worker.run(threadpool.java:1815) 服务器(ID = 614476EB,HOST = GAMLWM000T01.ESUNBANK.COM.TW)跟踪结束。
我已经在互联网上搜索了有关此任务的灵魂
game.java
package com.siork.cdd;
import java.io.Serializable;
import ilog.rules.bom.annotations.BusinessName;
public class Game implements Serializable {
private static final long serialVersionUID = 1L;
public static String GAME = "GAME";
private int banker_point;
private int player_point;
private String winner;
public Game() {}
public Game(@BusinessName("BANKER") int banker_point,
@BusinessName("PLAYER") int player_point) {
this.banker_point = banker_point;
this.player_point = player_point;
}
public int getBanker_point() {
return banker_point;
}
public void setBanker_point(int banker_point) {
this.banker_point = banker_point;
}
public int getPlayer_point() {
return player_point;
}
public void setPlayer_point(int player_point) {
this.player_point = player_point;
}
public String getWinner() {
return winner;
}
public void setWinner(String winner) {
this.winner = winner;
}
}
您的java独立客户端" testgameexecute"需要在其classpath上具有com.siork.cdd.game,以便能够通过RMI删除此类的实例。<</
它的JDK问题。检查您的JDK版本,升级它,对我来说,它的工作原理应为8.x
在我的情况下,我将值设置为
List<ColReteral> coll;
coll.setId("1");
remote.update("id", coll);
我有错误
Corba元帅0x4942F896,无法从底座桥梁读取价值:classNotFoundException
因为我忘记了
coll = new ArrayList<ColReteral>();
..