Wildfly 10.1 - ActiveMQ on IPv6
poppjens Feb 20, 2018 6:00 AMHi all,
I have a Wildfly 10.1 server providing ActiveMQ Topics and Queues as well as Session Bean access via http-remoting to a Java Client. The server and client work for IPv4 without a problem.
Right now I need to switch to IPv6. I got everything working but JMS. I use the following code:
String JMS_CONNECTION_FACTORY_JNDI = "jms/RemoteConnectionFactory";
Context context = getApplicationManager().getConnectionHandler().getContext();
TopicConnectionFactory cf = (TopicConnectionFactory) context.lookup(JMS_CONNECTION_FACTORY_JNDI);
topicConnection = cf.createTopicConnection();
The same context is used to lookup session beans and this works! If I try to create the TopicConnection I get:
java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:101)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622)
at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:209)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:207)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1097)
After debugging I found, that the lookup returns a ServerLocator Object that has the IPv6 address with scope (%enp0s3 - which is the server network interface). I assume since the client doesn't know the scope (since it is on the server) it is not able to resolve the address. When I remove the scope in debugging in the URL in ActiveMQConnectionFactory.readExternal(..) during lookup the client starts without a problem.
The strange thing is, that the EJB lookup on the same context works and I can access the server logic. So I assume that it is either a wrong setting or bug in Wildfly ActiveMQ.
The binding on the Wildfly server is to the IPv6 Address without scope (so the scope is nowhere set but in the operating system!).
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
....
inet6 fd00::d7dc:b4cc:2e2a:ea1/64 scope global noprefixroute dynamic
valid_lft 6893sec preferred_lft 3293sec
...
This is only a test setup on a VM, so the IPv6 Address is just auto assigned.
Any help on the topic is appreciated ;-)