Jms 访问WildFly';使用IBM';s SDK

Jms 访问WildFly';使用IBM';s SDK,jms,activemq,wildfly-10,Jms,Activemq,Wildfly 10,正如标题所示,我正在尝试从独立客户端连接到运行在WildFly 10上的ActiveMQ。如果我使用Oracle的SDK,在不更改代码或配置的情况下,我可以连接,但是如果我切换到IBM的SDK,它将失败,出现以下异常: javax.jms.JMSException: Failed to create session factory at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createC

正如标题所示,我正在尝试从独立客户端连接到运行在WildFly 10上的ActiveMQ。如果我使用Oracle的SDK,在不更改代码或配置的情况下,我可以连接,但是如果我切换到IBM的SDK,它将失败,出现以下异常:

javax.jms.JMSException: Failed to create session factory
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:727)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:233)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:229)
        at pt.sibs.epms.JmsClient.main(JmsClient.java:50)
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]
        at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:777)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:724)
        ... 3 more
我的问题是:这是不可能的,我在浪费我的时间,还是只是一个额外调整的问题

注意:不幸的是,我不得不使用IBM的SDK,因为客户端将在AIX机器上运行

编辑#1 在做了一些字节码操作之后,我能够识别出发散点

Oracle的SDK事件流:

method start() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                context javax.net.ssl.SSLContext@58c1c010
                this.channelClazzclass io.netty.channel.socket.nio.NioSocketChannel
                isStarted() true
------------------------------------------------------------------------------------------------------------

method doConnect() from io/netty/bootstrap/Bootstrap
                channel.isOpen() true
                regFuture.isDone() true
------------------------------------------------------------------------------------------------------------

method createConnection() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                future class io.netty.channel.DefaultChannelPromise
                channel class io.netty.channel.socket.nio.NioSocketChannel
                channel.isOpen() true
------------------------------------------------------------------------------------------------------------

method openTransportConnection() from org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl
                connector.isStarted() true
------------------------------------------------------------------------------------------------------------
method start() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                context javax.net.ssl.SSLContext@71b0b083
                this.channelClazzclass io.netty.channel.socket.nio.NioSocketChannel
                isStarted() true
------------------------------------------------------------------------------------------------------------

method doConnect() from io/netty/bootstrap/Bootstrap
                channel.isOpen() true
                regFuture.isDone() false
------------------------------------------------------------------------------------------------------------

method doClose() from io/netty/channel/socket/nio/NioSocketChannel
------------------------------------------------------------------------------------------------------------

method createConnection() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                future class io.netty.channel.DefaultChannelPromise
                channel class io.netty.channel.socket.nio.NioSocketChannel
                channel.isOpen() false
mar 10, 2017 7:59:35 AM org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector createConnection
ERROR: AMQ214016: Failed to create netty connection
java.nio.channels.ClosedChannelException

------------------------------------------------------------------------------------------------------------

method openTransportConnection()from org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl
                connector.isStarted() false
------------------------------------------------------------------------------------------------------------
一切正常

IBM的SDK事件流:

method start() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                context javax.net.ssl.SSLContext@58c1c010
                this.channelClazzclass io.netty.channel.socket.nio.NioSocketChannel
                isStarted() true
------------------------------------------------------------------------------------------------------------

method doConnect() from io/netty/bootstrap/Bootstrap
                channel.isOpen() true
                regFuture.isDone() true
------------------------------------------------------------------------------------------------------------

method createConnection() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                future class io.netty.channel.DefaultChannelPromise
                channel class io.netty.channel.socket.nio.NioSocketChannel
                channel.isOpen() true
------------------------------------------------------------------------------------------------------------

method openTransportConnection() from org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl
                connector.isStarted() true
------------------------------------------------------------------------------------------------------------
method start() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                context javax.net.ssl.SSLContext@71b0b083
                this.channelClazzclass io.netty.channel.socket.nio.NioSocketChannel
                isStarted() true
------------------------------------------------------------------------------------------------------------

method doConnect() from io/netty/bootstrap/Bootstrap
                channel.isOpen() true
                regFuture.isDone() false
------------------------------------------------------------------------------------------------------------

method doClose() from io/netty/channel/socket/nio/NioSocketChannel
------------------------------------------------------------------------------------------------------------

method createConnection() from org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector
                future class io.netty.channel.DefaultChannelPromise
                channel class io.netty.channel.socket.nio.NioSocketChannel
                channel.isOpen() false
mar 10, 2017 7:59:35 AM org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector createConnection
ERROR: AMQ214016: Failed to create netty connection
java.nio.channels.ClosedChannelException

------------------------------------------------------------------------------------------------------------

method openTransportConnection()from org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl
                connector.isStarted() false
------------------------------------------------------------------------------------------------------------
如您所见,
createConnection()
失败,因为通道未打开,并且正在显式调用来自
NioSocketChannel
doClose()
。 我已将
doClose()
更改为引发并捕获异常,以便在调用异常时查看它:

java.lang.Exception: CLOSE INVOKED
                at io.netty.channel.socket.nio.NioSocketChannel.doClose(NioSocketChannel.java:238)
                at io.netty.channel.AbstractChannel$AbstractUnsafe.doClose0(AbstractChannel.java:611)
                at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:590)
                at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:534)
                at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.closeOnRead(AbstractNioByteChannel.java:71)
                at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:158)
                at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
                at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
                at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
                at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
                at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
                at java.lang.Thread.run(Thread.java:785)
关闭操作正常进行,不是由任何异常事件引起的。
这是一个bug吗?

经过几天的调查,我终于找到了问题所在。我注意到,尽管客户端使用的是Java8,但TLSv1用于握手(没有引发异常)。我试图以多种方式强制使用TLSv1.2,但只有当我发现一个记录不完整的属性时,我才能够解决问题:

-Dcom.ibm.jsse2.overrideDefaultTLS=true
需要在客户端设置该属性