两个项目部署在不同的机器上,到lookup时出错。高手们出来帮帮忙吧,折磨了好久了。。在两台机器上互telent对方的2809端口都可以通。有说在C:\Windows\System32\drivers\etc的hosts里补上127.0.0.1 localhost和目标主机ip与host,都补上了,也还是不行。。
代码如下:Properties p = new Properties();
p.put(Context.PROVIDER_URL,ejbConfig.getEJB_URL());
p.put(Context.INITIAL_CONTEXT_FACTORY,ejbConfig.getEJB_DRIVER());
//"com.ibm.websphere.naming.WsnInitialContextFactory");
RobotRemote acct = null;
System.out.println("EJB Invoke");
try {
InitialContext in = new InitialContext(p);
Object ref = in.lookup("ejb/resmaster/system/RobotEJB");
RobotHome dominateEJB20Home = (RobotHome) PortableRemoteObject
.narrow(ref, RobotHome.class);
acct = dominateEJB20Home.create();
} catch (Exception e) {
e.printStackTrace();
}
错误信息是:
[10-10-25 11:28:04:712 GMT] 0000003c WebApp        E   [Servlet Error]-[A communication failure occurred while attempting to obtain an initial context with the provider URL: "iiop://*.*.*.*:2809".  Make sure that any bootstrap address information in the URL is correct and that the target name server is running.  A bootstrap address with no port specification defaults to port 2809.  Possible causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration.]: javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context with the provider URL: "iiop://*.*.*.*:2809".  Make sure that any bootstrap address information in the URL is correct and that the target name server is running.  A bootstrap address with no port specification defaults to port 2809.  Possible causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration. [Root exception is org.omg.CORBA.TRANSIENT: java.net.BindException: Address already in use: NET_Bind:host=webuikf,port=2809  vmcid: IBM  minor code: E02  completed: No]
at com.ibm.ws.naming.util.WsnInitCtxFactory.mapInitialReferenceFailure(WsnInitCtxFactory.java:2217)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1377)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:915)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:839)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:523)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:117)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:712)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:171)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at com.ibm._jsp._index._jspService(_index.java:91)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:115)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:168)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:270)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:308)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:465)
at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:111)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3107)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
Caused by: org.omg.CORBA.TRANSIENT: java.net.BindException: Address already in use: NET_Bind:host=webuikf,port=2809  vmcid: IBM  minor code: E02  completed: No
at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:425)
at com.ibm.ws.orbimpl.transport.WSTransport.getConnection(WSTransport.java:423)
at com.ibm.CORBA.transport.TransportBase.getConnection(TransportBase.java:163)
at com.ibm.rmi.iiop.TransportManager.get(TransportManager.java:93)
at com.ibm.rmi.iiop.GIOPImpl.getConnection(GIOPImpl.java:115)
at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:189)
at com.ibm.rmi.corba.Corbaloc.locateUsingINS(Corbaloc.java:307)
at com.ibm.rmi.corba.Corbaloc.resolve(Corbaloc.java:378)
at com.ibm.rmi.corba.ORB.objectURLToObject(ORB.java:3680)
at com.ibm.CORBA.iiop.ORB.objectURLToObject(ORB.java:3227)
at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:3578)
at com.ibm.ws.naming.util.WsnInitCtxFactory.stringToObject(WsnInitCtxFactory.java:1502)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1353)
... 35 more
Caused by: java.net.BindException: Address already in use: NET_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:398)
at java.net.Socket.bind(Socket.java:582)
at java.net.Socket.<init>(Socket.java:392)
at java.net.Socket.<init>(Socket.java:207)
at com.ibm.ws.orbimpl.transport.WSTCPTransportConnection.createSocket(WSTCPTransportConnection.java:308)
at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:356)
... 47 more