我们有一个作为Remote EJB公开的业务功能。我们与客户端共享远程接口。下面是我们分享的远程接口。
public interface EmployeeRemoteEJB {
public Output saveEmployee(Input input);
}
public Output extends BaseObj{
private static final long serialVersionUID = -7096731222829800554L;
//some fields are there
}
public Input extends BaseObj{
private static final long serialVersionUID = -70967312228423800554L;
//some fields
}
public BaseObj implements Serializable{
}
现在 Input 类和 Output 类有一些字段,它们也扩展自BaseObj
并具有生成的SerialVersion UID
.
现在我们已经在 WebSphere Application Server 7.0 上部署了这个 EJB。EJB 的远程调用工作正常。当我们部署调用 EJB 的客户端 Web 应用程序或具有 EJB 的 Web 应用程序时,它会中断。我们得到ClassCastException
那个
com.test.ejb._EmployeeRemoteEJB_Stub incompatible with com.test.ejb.EmployeeRemoteEJB
当我们重新启动应用程序时,它又开始工作了。
这就是我们调用远程 EJB 的方式
//此 JNDI 名称是为远程 EJB 配置的。字符串 REMOTE_LOOKUP_KEY = "empremotesvc"; 字符串 JNDI_PROVIDER_URL = "iiop://10.222.232.111:2809";
Properties props = new Properties();
props.put( Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
props.put( Context.PROVIDER_URL, JNDI_PROVIDER_URL );
Object lobj;
InitialContext ctx;
try{
ctx = new InitialContext( props );
lobj = ctx.lookup( REMOTE_LOOKUP_KEY );
EmployeeRemoteEJB empObjRemote = (EmployeeRemoteEJB) lobj;
return empObjRemote ;
}
catch( NamingException e ){
e.printStackTrace();
}
有人可以让我知道是什么导致了这个问题吗?如果您需要更多详细信息,请告诉我。