Naming.unbind("somename") 对 wildfly 13 失败

Naming.unbind("somename") fails against wildfly 13

我正在将一个应用程序从 jboss 4.2 迁移到 wildfly 13。该应用程序公开了 EJB,已成功迁移并且这些 EJB 被一些独立客户端使用(用 tanuki 包装器包装为服务)运行 与 Wildfly 在同一台机器上。这些独立客户端使用 JMX 进行监控。 启动代码尝试取消绑定服务名称,以防客户端在较早的 运行 中使用

崩溃
Naming.unbind("//localhost:1099/myService");

在正常启动时(不是在崩溃之后)

java.rmi.NotBoundException

符合预期。

我的问题是我得到以下堆栈跟踪

Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:211)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)

端口 1099 是默认 "well known" 端口,如命名 javadoc 所述:

The Naming class provides methods for storing and obtaining references to remote objects in a remote object registry. Each method of the Naming class takes as one of its arguments a name that is a java.lang.String in URL format (without the scheme component) of the form: //host:port/name where host is the host (remote or local) where the registry is located, port is the port number on which the registry accepts calls, and where name is a simple string uninterpreted by the registry. Both host and port are optional. If host is omitted, the host defaults to the local host. If port is omitted, then the port defaults to 1099, the "well-known" port that RMI's registry, rmiregistry, uses.

我也试过使用 wildfly 管理端口,因为它使用 http 端口升级,我得到

java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
    java.net.SocketTimeoutException: Read timed out

具有以下根本原因

Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:171)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
    at java.io.DataInputStream.readByte(DataInputStream.java:265)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:246)

我错过了什么and/or做错了什么?

我发现rmiregistry不是wildfly启动的。我被我们的旧环境误导了 init.d 在 OS 启动时启动 rmiregistry。

所以启动 rmiregistry 解决了我的问题。

rmi 和 wildfly http 升级功能彼此无关,因为 rmiregistry 是一个独立的进程。