EJB+jboss实现远程调用时出现的奇怪问题,求高手解答。跪谢!
在客户这边做实施,开发了一个cs的工具,由于我们需要查询远程的oracle数据库,但又不能直接访问服务器的1521端口,所以就想了个解决的办法:写算法到ejb中,用jboss发布,调用1099端口就可以了,以http的形式实现的远程数据传输。
//连接远程jbosss的方法,以http的形式实现public static Object getEJB(String jndipath) { try { Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory"); p.put(Context.PROVIDER_URL,"http://YOUR_IP:YOUR_POST/unified-invoker/JNDIFactory/?return-exception=true"); p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces"); InitialContext ctx = new InitialContext(p); Object oo = ctx.lookup(jndipath); return oo; } catch (Exception e) { e.printStackTrace(); return null; }}
org.jboss.remoting.CannotConnectException: Cannot connect http client invoker.at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:333)at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:135)......Caused by: java.io.InvalidClassException: com.sun.rowset.providers.RIOptimisticProvider; local classincompatible: stream classdesc serialVersionUID = -3143367176751761936, local class serialVersionUID = -8429279896237029122at java.io.ObjectStreamClass.initNonProxy(Unknown Source)at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)......org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:239)at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:133)at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:120)at org.jboss.remoting.marshal.http.HTTPUnMarshaller.read(HTTPUnMarshaller.java:69)at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:471)at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:305)......at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)at $Proxy1.getCachedRowSet_Query(Unknown Source)at hdaty.ui.UserLanding$LoginUser.run(UserLanding.java:343)Caused by: java.io.InvalidClassException: com.sun.rowset.providers.RIOptimisticProvider; local class incompatible: stream classdesc serialVersionUID = -3143367176751761936, local class serialVersionUID = -8429279896237029122at java.io.ObjectStreamClass.initNonProxy(Unknown Source)at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)......