java.io.IOException:由peer wildfly 10重置连接

时间:2018-03-31 11:25:33

标签: java jboss ejb wildfly

我正在尝试在wildfly 10服务器中进行远程ejb查找。下面是查找代码。

    private static Object lookup() throws Exception {
                Properties  properties = new Properties();
                properties.put("java.naming.factory.url.pkgs",
                  "org.jboss.ejb.client.naming");
                properties.put("jboss.naming.client.ejb.context",
                  "false");
                properties.put("org.jboss.ejb.client.scoped.context", "true");
                properties.put("endpoint.name", "client-endpoint");

                properties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED","false");
                properties.put("remote.connections", "default");
                properties.put("remote.connection.default.host", "192.168.1.13");
                properties.put("remote.connection.default.port", "36430");
                properties.put("remote.connection.default.username", "username");
                properties.put("remote.connection.default.password", "pwd");
                properties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
                properties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
                properties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
                properties.put("remote.connectionprovider.create.options.org.jboss.remoting3.RemotingOptions.MAX_OUTBOUND_MESSAGES", "0x7fffffff");
                properties.put("remote.connectionprovider.create.options.org.jboss.remoting3.RemotingOptions.MAX_INBOUND_MESSAGES", "0x7fffffff");
       InitialContext   ctx = new InitialContext(properties);

       Object obj = (WorkFlowExternalFacade) ctx.lookup("ejb:cwapp/cwebl/WorkFlowExternalFacade!com.xxx.xxx.WorkFlowExternalFacadeRemote);
   System.out.println("Lookup Success:"+obj)

       obj.findAll();

}

当我将IP和端口更改为运行在9080端口上的本地wildfly时,上面的代码工作正常,即...

  

properties.put(" remote.connection.default.host"," 127.0.0.1");   properties.put(" remote.connection.default.port"," 9080");

我尝试执行远程查找的代码,其中wildfly正在其他一些机器上运行(192.168.1.13:36430)我遇到异常......

java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:197)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at org.xnio.nio.NioSocketConduit.read(NioSocketConduit.java:289)
at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:410)
at org.xnio.http.HttpUpgrade$HttpUpgradeState.flushUpgradeChannel(HttpUpgrade.java:369)
at org.xnio.http.HttpUpgrade$HttpUpgradeState.access$900(HttpUpgrade.java:165)
at org.xnio.http.HttpUpgrade$HttpUpgradeState$ConnectionOpenListener.handleEvent(HttpUpgrade.java:340)
at org.xnio.http.HttpUpgrade$HttpUpgradeState$ConnectionOpenListener.handleEvent(HttpUpgrade.java:320)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:326)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:567)
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:294)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:430)
at org.jboss.ejb.client.remoting.EndpointPool$PooledEndpoint.connect(EndpointPool.java:192)
at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:153)
at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:133)
at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:78)
at org.jboss.ejb.client.remoting.RemotingConnectionManager.getConnection(RemotingConnectionManager.java:51)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:161)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:118)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createIdentifiableEjbClientContext(EjbNamingContext.java:269)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.setupScopedEjbClientContextIfNeeded(EjbNamingContext.java:134)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.<init>(EjbNamingContext.java:101)
at org.jboss.ejb.client.naming.ejb.ejbURLContextFactory.getObjectInstance(ejbURLContextFactory.java:38)
at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:601)
at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:550)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:345)
at javax.naming.InitialContext.lookup(InitialContext.java:417)

以上异常发生在ctx.lookup(..),但我收到了代理对象,我试图打印代理对象

  

查找成功:远程EJB StatelessEJBLocator的代理   &#34; xx / xx / WorkFlowExternalFacade&#34;,视图是界面   com.xxx.xxx.xxx.WorkFlowExternalFacadeRemote,   亲和力是无

但是当我尝试使用对象obj.findAll()调用API时,我得到了以下异常

java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:cwapp, moduleName:cwebl, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@37918c79
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:798)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146)
at com.sun.proxy.$Proxy2.findAll(Unknown Source)

有人可以帮我解决上述问题吗?

0 个答案:

没有答案