11 Replies Latest reply on Jul 31, 2017 7:24 AM by Miroslav Novak

    Timeout when connecting WildFly 10 remote JMS

    Peter Lauko Newbie

      Hi,

      Please help setting up a remote connection to WildFly JMS. Everything works fine when connecting from war application running on the server, but I cannot connect to the queue either from standalone Camel application, or from JMeter. Every remote access gives "java.net.ConnectException: Operation failed with status WAITING after 5000 MILLISECONDS" error.

      I get the same error when running from Docker, or installed server.

      Please help, I'm desperately stuck at this point. I'm very new to both WildFly and Camel.

      Thanks very much for any help!

      Details follow.

       

      WildFly 10.1.0.Final setup

       

      create 2 users:

      /opt/jboss/wildfly/bin/add-user.sh admin 12345678 --silent &&\

      /opt/jboss/wildfly/bin/add-user.sh -a -g guest -u jmsuser -p 12345678 --silent

       

      startup:

      /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 -c standalone-full.xml

      (Results are the same when starting with: /opt/jboss/wildfly/bin/standalone.sh -b 127.0.0.1 -bmanagement 127.0.0.1 -c standalone-full.xml)

       

      setup netty:

      batch

      /subsystem=messaging-activemq/server=default/remote-acceptor=netty:add(socket-binding=messaging)

      /socket-binding-group=standard-sockets/socket-binding=messaging:add(port=5445)

      run-batch

       

      setup test queue:

      batch

      /subsystem=messaging-activemq/server=default/jms-queue=TestQ/:add(entries=["java:jboss/exported/TestQ"])

      run-batch

      :reload

       

      client Camel app

       

      <?xml version="1.0" encoding="UTF-8"?>

      <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
         xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

       

         <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">

         <property name="environment">

         <props>

         <prop key="java.naming.factory.initial">org.jboss.naming.remote.client.InitialContextFactory</prop>

         <prop key="java.naming.provider.url">remote://127.0.0.1:5445</prop>

         </props>

         </property>

         </bean>

       

         <bean name="jms" class="org.apache.camel.component.jms.JmsComponent">

         <property name="connectionFactory" ref="authenticatedConnectionFactory"/>

         </bean>

       

         <bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">

         <property name="jndiTemplate">

         <ref bean="jndiTemplate"/>

         </property>

       

         <property name="jndiName">

         <value>java:jms/RemoteConnectionFactory</value>

         </property>

         </bean>

       

         <bean id="authenticatedConnectionFactory"
         class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">

         <property name="targetConnectionFactory" ref="jmsQueueConnectionFactory"/>

         <property name="username" value="jmsuser"/>

         <property name="password" value="12345678"/>

         </bean>

       

         <camel:camelContext xmlns="http://camel.apache.org/schema/spring">

         <camel:route>

         <camel:from uri="timer:foo?period=1s"/>

         <setBody>

         <simple>${body}Message at ${date:now:yyyy-MM-dd HH:mm:ss}</simple>

         </setBody>

         <camel:to uri="jms:queue:ExampleQueue"/>

         </camel:route>

         </camel:camelContext>

      </beans>

       

       

       

      Results

       

      [INFO] Starting Camel ...

      [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Using org.apache.camel.spring.CamelContextFactoryBean as CamelContextBeanDefinitionParser

      [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelProducerTemplateFactoryBean with id: template on camel context: camel-1

      [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelFluentProducerTemplateFactoryBean with id: fluentTemplate on camel context: camel-1

      [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelConsumerTemplateFactoryBean with id: consumerTemplate on camel context: camel-1

      [pache.camel.spring.Main.main()] logging                        DEBUG Logging Provider: org.jboss.logging.Log4jLoggerProvider

      [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG Looking for jboss-naming-client.properties using classloader java.net.URLClassLoader@5b730279

      [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.endpoint.create.options. has the following options {}

      [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.remote.connectionprovider.create.options. has the following options {}

      [pache.camel.spring.Main.main()] xnio                           INFO  XNIO version 3.4.0.Final

      [pache.camel.spring.Main.main()] nio                            INFO  XNIO NIO Implementation Version 3.4.0.Final

      [-naming-client-endpoint" I/O-1] nio                            DEBUG Started channel thread 'Remoting "config-based-naming-client-endpoint" I/O-1', selector sun.nio.ch.KQueueSelectorImpl@5a9c6258

      [naming-client-endpoint" Accept] nio                            DEBUG Started channel thread 'Remoting "config-based-naming-client-endpoint" Accept', selector sun.nio.ch.KQueueSelectorImpl@11991c67

      [pache.camel.spring.Main.main()] remoting                       INFO  JBoss Remoting version 4.0.21.Final

      [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.connect.options. has the following options {}

      [pache.camel.spring.Main.main()] HaRemoteNamingStore            DEBUG Failed to connect to server remote://127.0.0.1:5445

      java.net.ConnectException: Operation failed with status WAITING after 5000 MILLISECONDS

        at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:97)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:198)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)

        at org.jboss.naming.remote.client.RemoteContext.lookupInternal(RemoteContext.java:104)

        at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:93)

        at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:146)

        at javax.naming.InitialContext.lookup(InitialContext.java:417)

        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)

        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)

        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)

        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)

        at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)

        at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)

        at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)

        at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)

        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)

        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)

        at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:222)

        at org.apache.camel.spring.Main.doStart(Main.java:154)

        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)

        at org.apache.camel.main.MainSupport.run(MainSupport.java:168)

        at org.apache.camel.main.MainSupport.run(MainSupport.java:482)

        at org.apache.camel.spring.Main.main(Main.java:86)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:519)

        at java.lang.Thread.run(Thread.java:748)

      [pache.camel.spring.Main.main()] ClassPathXmlApplicationContext WARN  Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jms' defined in file [/Users/lkp/Work/github/jaysensharma/MiddlewareMagicDemos/WildFly/JMS/Camel_With_ActiveMQ_On_WildFly10/target/classes/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean 'authenticatedConnectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticatedConnectionFactory' defined in file [/Users/lkp/Work/github/jaysensharma/MiddlewareMagicDemos/WildFly/JMS/Camel_With_ActiveMQ_On_WildFly10/target/classes/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean 'jmsQueueConnectionFactory' while setting bean property 'targetConnectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsQueueConnectionFactory' defined in file [/Users/lkp/Work/github/jaysensharma/MiddlewareMagicDemos/WildFly/JMS/Camel_With_ActiveMQ_On_WildFly10/target/classes/META-INF/spring/camel-context.xml]: Invocation of init method failed; nested exception is javax.naming.CommunicationException: Failed to connect to any server. Servers tried: [remote://127.0.0.1:5445 (Operation failed with status WAITING after 5000 MILLISECONDS)] [Root exception is java.net.ConnectException: Operation failed with status WAITING after 5000 MILLISECONDS]

      [ERROR] *************************************

      [ERROR] Error occurred while running main from: org.apache.camel.spring.Main

      [ERROR]

      java.lang.reflect.InvocationTargetException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:519)

        at java.lang.Thread.run(Thread.java:748)

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jms' defined in file [/Users/lkp/Work/github/jaysensharma/MiddlewareMagicDemos/WildFly/JMS/Camel_With_ActiveMQ_On_WildFly10/target/classes/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean 'authenticatedConnectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticatedConnectionFactory' defined in file [/Users/lkp/Work/github/jaysensharma/MiddlewareMagicDemos/WildFly/JMS/Camel_With_ActiveMQ_On_WildFly10/target/classes/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean 'jmsQueueConnectionFactory' while setting bean property 'targetConnectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsQueueConnectionFactory' defined in file [/Users/lkp/Work/github/jaysensharma/MiddlewareMagicDemos/WildFly/JMS/Camel_With_ActiveMQ_On_WildFly10/target/classes/META-INF/spring/camel-context.xml]: Invocation of init method failed; nested exception is javax.naming.CommunicationException: Failed to connect to any server. Servers tried: [remote://127.0.0.1:5445 (Operation failed with status WAITING after 5000 MILLISECONDS)] [Root exception is java.net.ConnectException: Operation failed with status WAITING after 5000 MILLISECONDS]

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)

        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)

        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)

        at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:222)

        at org.apache.camel.spring.Main.doStart(Main.java:154)

        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)

        at org.apache.camel.main.MainSupport.run(MainSupport.java:168)

        at org.apache.camel.main.MainSupport.run(MainSupport.java:482)

        at org.apache.camel.spring.Main.main(Main.java:86)

        ... 6 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticatedConnectionFactory' defined in file [/Users/lkp/Work/github/jaysensharma/MiddlewareMagicDemos/WildFly/JMS/Camel_With_ActiveMQ_On_WildFly10/target/classes/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean

        • 1. Re: Timeout when connecting WildFly 10 remote JMS
          Miroslav Novak Master

          The problem here is with JNDI lookup of RemoteConnetionFactory. There is bad value for JNDI property <"java.naming.provider.url">remote://127.0.0.1:5445. For WF10 it should look like:

          Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080"

          • 2. Re: Timeout when connecting WildFly 10 remote JMS
            Peter Lauko Newbie

            Hi Miroslav,

            Thanks for your response!

            I changed the provider url and now I get "JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed"

             

            [INFO] Starting Camel ...

            [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Using org.apache.camel.spring.CamelContextFactoryBean as CamelContextBeanDefinitionParser

            [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelProducerTemplateFactoryBean with id: template on camel context: camel-1

            [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelFluentProducerTemplateFactoryBean with id: fluentTemplate on camel context: camel-1

            [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelConsumerTemplateFactoryBean with id: consumerTemplate on camel context: camel-1

            [pache.camel.spring.Main.main()] logging                        DEBUG Logging Provider: org.jboss.logging.Log4jLoggerProvider

            [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG Looking for jboss-naming-client.properties using classloader java.net.URLClassLoader@4573a9d5

            [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.endpoint.create.options. has the following options {}

            [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.remote.connectionprovider.create.options. has the following options {}

            [pache.camel.spring.Main.main()] xnio                           INFO  XNIO version 3.4.0.Final

            [pache.camel.spring.Main.main()] nio                            INFO  XNIO NIO Implementation Version 3.4.0.Final

            [-naming-client-endpoint" I/O-1] nio                            DEBUG Started channel thread 'Remoting "config-based-naming-client-endpoint" I/O-1', selector sun.nio.ch.KQueueSelectorImpl@11991c67

            [naming-client-endpoint" Accept] nio                            DEBUG Started channel thread 'Remoting "config-based-naming-client-endpoint" Accept', selector sun.nio.ch.KQueueSelectorImpl@3b15187e

            [pache.camel.spring.Main.main()] remoting                       INFO  JBoss Remoting version 4.0.21.Final

            [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.connect.options. has the following options {}

            [naming-client-endpoint" task-3] client                         DEBUG Client authentication failed for mechanism JBOSS-LOCAL-USER: javax.security.sasl.SaslException: Failed to read server challenge [Caused by java.io.FileNotFoundException: /opt/jboss/wildfly/standalone/tmp/auth/local1539036421131255286.challenge (No such file or directory)]

            [naming-client-endpoint" task-5] client                         DEBUG Client authentication failed for mechanism DIGEST-MD5: javax.security.sasl.SaslException: DIGEST-MD5: Cannot perform callback to acquire realm, authentication ID or password [Caused by javax.security.auth.callback.UnsupportedCallbackException]

            [-naming-client-endpoint" I/O-1] connection                     DEBUG JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:

               JBOSS-LOCAL-USER: javax.security.sasl.SaslException: Failed to read server challenge [Caused by java.io.FileNotFoundException: /opt/jboss/wildfly/standalone/tmp/auth/local1539036421131255286.challenge (No such file or directory)]

               DIGEST-MD5: javax.security.sasl.SaslException: DIGEST-MD5: Cannot perform callback to acquire realm, authentication ID or password [Caused by javax.security.auth.callback.UnsupportedCallbackException]

            [pache.camel.spring.Main.main()] HaRemoteNamingStore            DEBUG Failed to connect to server http-remoting://127.0.0.1:8080

            javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:

               JBOSS-LOCAL-USER: javax.security.sasl.SaslException: Failed to read server challenge [Caused by java.io.FileNotFoundException: /opt/jboss/wildfly/standalone/tmp/auth/local1539036421131255286.challenge (No such file or directory)]

               DIGEST-MD5: javax.security.sasl.SaslException: DIGEST-MD5: Cannot perform callback to acquire realm, authentication ID or password [Caused by javax.security.auth.callback.UnsupportedCallbackException]

              at org.jboss.remoting3.remote.ClientConnectionOpenListener.allMechanismsFailed(ClientConnectionOpenListener.java:114)

              at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:389)

              at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:241)

            • 3. Re: Timeout when connecting WildFly 10 remote JMS
              Miroslav Novak Master

              It's because http-remoting-connector is protected by ApplicationRealm:

              <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>

               

              So either disable it by removing "security-realm="ApplicationRealm" above config or create application user and provide security credentials to your jndi properties.

              1 of 1 people found this helpful
              • 4. Re: Timeout when connecting WildFly 10 remote JMS
                Peter Lauko Newbie

                I added authentication, and got further, but now I got java.nio.channels.UnresolvedAddressException

                 

                [mel-1) thread #0 - timer://foo] client                         ERROR AMQ214016: Failed to create netty connection
                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)
                  at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:481)
                  at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:466)
                  at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47)
                  at io.netty.channel.CombinedChannelDuplexHandler.connect(CombinedChannelDuplexHandler.java:167)
                  at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:481)
                  at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:466)
                  at io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:50)
                  at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:481)
                  at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:466)
                  at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:448)
                  at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:908)
                  at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:203)
                  at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:166)
                  at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358)
                  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
                  at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
                  at java.lang.Thread.run(Thread.java:748)
                [mel-1) thread #0 - timer://foo] ClientSessionFactoryImpl       DEBUG Connector towards NettyConnector [host=61df4420ec8a, port=8080, httpEnabled=false, httpUpgradeEnabled=true, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] failed
                [mel-1) thread #0 - timer://foo] DefaultErrorHandler            DEBUG Failed delivery for (MessageId: ID-dit17mpc029-local-60005-1501232379108-0-1 on ExchangeId: ID-dit17mpc029-local-60005-1501232379108-0-2). On delivery attempt: 0 caught: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]
                [mel-1) thread #0 - timer://foo] DefaultErrorHandler            ERROR Failed delivery for (MessageId: ID-dit17mpc029-local-60005-1501232379108-0-1 on ExchangeId: ID-dit17mpc029-local-60005-1501232379108-0-2). Exhausted after delivery attempt: 1 caught: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]
                
                
                Message History
                ---------------------------------------------------------------------------------------------------------------------------------------
                RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
                [route1            ] [route1            ] [timer://foo?period=1s&repeatCount=1                                           ] [       185]
                [route1            ] [setBody1          ] [setBody[simple{${body}Message at ${date:now:yyyy-MM-dd HH:mm:ss}}]            ] [        17]
                [route1            ] [to1               ] [jms:queue:ExampleQueue                                                        ] [       164]
                
                
                Stacktrace
                ---------------------------------------------------------------------------------------------------------------------------------------
                org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]
                  at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
                
                • 5. Re: Timeout when connecting WildFly 10 remote JMS
                  Peter Lauko Newbie

                  I tried to bind my interfaces to 127.0.0.1 instead of 0.0.0.0, but then I get  "java.io.EOFException: XNIO000812: Connection closed unexpectedly"

                   

                  [INFO] Starting Camel ...
                  [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Using org.apache.camel.spring.CamelContextFactoryBean as CamelContextBeanDefinitionParser
                  [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelProducerTemplateFactoryBean with id: template on camel context: camel-1
                  [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelFluentProducerTemplateFactoryBean with id: fluentTemplate on camel context: camel-1
                  [pache.camel.spring.Main.main()] CamelNamespaceHandler          DEBUG Registered default: org.apache.camel.spring.CamelConsumerTemplateFactoryBean with id: consumerTemplate on camel context: camel-1
                  [pache.camel.spring.Main.main()] logging                        DEBUG Logging Provider: org.jboss.logging.Log4jLoggerProvider
                  [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG Looking for jboss-naming-client.properties using classloader java.net.URLClassLoader@4c612a64
                  [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.endpoint.create.options. has the following options {}
                  [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.remote.connectionprovider.create.options. has the following options {}
                  [pache.camel.spring.Main.main()] xnio                           INFO  XNIO version 3.4.0.Final
                  [pache.camel.spring.Main.main()] nio                            INFO  XNIO NIO Implementation Version 3.4.0.Final
                  [naming-client-endpoint" Accept] nio                            DEBUG Started channel thread 'Remoting "config-based-naming-client-endpoint" Accept', selector sun.nio.ch.KQueueSelectorImpl@29b8edf9
                  [-naming-client-endpoint" I/O-1] nio                            DEBUG Started channel thread 'Remoting "config-based-naming-client-endpoint" I/O-1', selector sun.nio.ch.KQueueSelectorImpl@1f0116c4
                  [pache.camel.spring.Main.main()] remoting                       INFO  JBoss Remoting version 4.0.21.Final
                  [pache.camel.spring.Main.main()] InitialContextFactory          DEBUG jboss.naming.client.connect.options. has the following options {}
                  [pache.camel.spring.Main.main()] HaRemoteNamingStore            DEBUG Failed to connect to server http-remoting://127.0.0.1:8080
                  java.lang.RuntimeException: java.io.EOFException: XNIO000812: Connection closed unexpectedly
                    at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:95)
                  

                  ...

                  at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:197)
                  
                  ... 60 more
                  
                  [pache.camel.spring.Main.main()] ClassPathXmlApplicationContext WARN  Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jms' defined in file [/Users/lkp/Work/sandbox/camel/camel-jms-client/target/classes/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean 'authenticatedConnectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticatedConnectionFactory' defined in file [/Users/lkp/Work/sandbox/camel/camel-jms-client/target/classes/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean 'jmsQueueConnectionFactory' while setting bean property 'targetConnectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsQueueConnectionFactory' defined in file [/Users/lkp/Work/sandbox/camel/camel-jms-client/target/classes/META-INF/spring/camel-context.xml]: Invocation of init method failed; nested exception is javax.naming.CommunicationException: Failed to connect to any server. Servers tried: [http-remoting://127.0.0.1:8080 (java.io.EOFException: XNIO000812: Connection closed unexpectedly)]
                  [ERROR] *************************************
                  [ERROR] Error occurred while running main from: org.apache.camel.spring.Main
                  
                  • 6. Re: Timeout when connecting WildFly 10 remote JMS
                    Miroslav Novak Master

                    It seems that it cannot resolve hostname "61df4420ec8a". Note that here is server bound to 0.0.0.0 so Artemis is trying to use server's hostname in connector which is used by RemoteConnectionFactory. Connection factory is looked up by client and client cannot resolve this "61df4420ec8a" hostname.

                     

                    I would suggest to create new interface like (you can set 127.0.0.1 if it's local client):

                    <interface name="public-ip-address">
                                <inet-address value="public_ip_address_of_server"/>
                            </interface>
                    

                     

                    then create new socket binding:

                    <socket-binding name="public-socket-binding" interface="public-ip-address" port="8080"/>
                    

                     

                    and then configure this socket binding in connector used by RemoteConnectionFactory. I guess you will also need to disable security on Artemis. There is attribute security-enabled which must be set to false.

                    1 of 1 people found this helpful
                    • 7. Re: Timeout when connecting WildFly 10 remote JMS
                      Miroslav Novak Master

                      Note that there are 2 types of connectors/acceptors:

                      - first is remote-connector and remote-acceptor which are used when you want to connect directly to Artemis (usually to port 5445)

                      - second is http-connector and http-acceptor which are used when you're going to Artemis in through port 8080.

                       

                      You cannot mix those connectors as in RemoteConnectionFactory. I mean if RemoteConnectionFactory is using http-connector then it must go to port 8080 and connect to http-acceptor. And the same holds for remote-connector which must point to remote-acceptor.

                       

                      Edit: corrected some bugs in texts

                      1 of 1 people found this helpful
                      • 8. Re: Timeout when connecting WildFly 10 remote JMS
                        Peter Lauko Newbie

                        Oh thanks, I didn't know that.

                        (Side question: could you recommend any beginner tutorial about wildfly 10/jboss eap7 configuration? The official docs are far too detailed to grasp quickly, and all others I found are for earlier versions. I have to setup a pilot quickly but I strongly feel I miss the big picture.)

                         

                        Meanwhile I tried a normal (non-docker) server and I could connect to that using the same settings, now I'm going to try the setup you suggested.

                        • 9. Re: Timeout when connecting WildFly 10 remote JMS
                          Miroslav Novak Master

                          Cool, great!

                           

                          You're right that some quickstart or brief how to should be provided. I'll add it to my todo list :-)

                          • 10. Re: Timeout when connecting WildFly 10 remote JMS
                            Peter Lauko Newbie

                            Hi Miroslav,

                             

                            I didn't have more time last Friday to work on this stuff, but eventually I managed to apply your suggestion regarding a new interface, and it works now even in docker!

                            Thank you so much for your help, you did save my day!

                             

                            For those who run into a similar problem here is what I did. Also, there is one more question for you, if you still have time for me

                            I'm still a bit confused if I could have made it simpler, but I ended up creating a new connection factory like this:

                             

                            batch
                            /interface=docker:add(inet-address=127.0.0.1)
                            /socket-binding-group=standard-sockets/socket-binding=docker-socket-binding/:add(interface=docker,port=8080)
                            /subsystem=messaging-activemq/server=default/http-connector=docker-http-connector:add(socket-binding=docker-socket-binding,endpoint=http-acceptor)
                            /subsystem=messaging-activemq/server=default/connection-factory=DockerConnectionFactory:add(entries=[java:jboss/exported/jms/DockerConnectionFactory],connectors=[docker-http-connector])
                            run-batch
                            

                             

                            Now the problem is that I run this batch during docker build, and line 05. fails at creating the connection factory telling:

                             

                            The batch failed with the following error (you are remaining in the batch editing mode to have a chance to correct the error): {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-4" => {"WFLYCTL0080: Failed services" => {"jboss.messaging-activemq.default.jms.connection-factory.DockerConnectionFactory" => "org.jboss.msc.service.StartException in service jboss.messaging-activemq.default.jms.connection-factory.DockerConnectionFactory: WFLYMSGAMQ0028: Failed to create connection-factory
                                Caused by: ActiveMQIllegalStateException[errorType=ILLEGAL_STATE message=AMQ129005: Connector 'docker-http-connector' not found on the main configuration file]"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.messaging-activemq.default.jms.connection-factory.DockerConnectionFactory"],"WFLYCTL0180: 
                            

                            I tried reloading the configuration to make docker-http-connector available, but still got errors.

                            2nd attempt, still doesn't work:

                             

                            batch
                            /interface=docker:add(inet-address=127.0.0.1)
                            /socket-binding-group=standard-sockets/socket-binding=docker-socket-binding/:add(interface=docker,port=8080)
                            /subsystem=messaging-activemq/server=default/http-connector=docker-http-connector:add(socket-binding=docker-socket-binding,endpoint=http-acceptor)
                            :reload
                            /subsystem=messaging-activemq/server=default/connection-factory=DockerConnectionFactory:add(entries=[java:jboss/exported/jms/DockerConnectionFactory],connectors=[docker-http-connector])
                            run-batch
                            

                            By experimenting I moved the last command to a separate cli script. This works, so this must be some timing issue.

                            Is reload async and didn't complete before the next command? I couldn't make it work in a single cli. Do you have any suggestion to make it more 'elegant'?

                             

                            3rd attempt. This one works, but kind of ugly:

                             

                            interface.cli:

                            batch
                            /interface=docker:add(inet-address=127.0.0.1)
                            /socket-binding-group=standard-sockets/socket-binding=docker-socket-binding/:add(interface=docker,port=8080)
                            /subsystem=messaging-activemq/server=default/http-connector=docker-http-connector:add(socket-binding=docker-socket-binding,endpoint=http-acceptor)
                            run-batch
                            :reload
                            

                            connfact.cli

                            batch
                            /subsystem=messaging-activemq/server=default/connection-factory=DockerConnectionFactory:add(entries=[java:jboss/exported/jms/DockerConnectionFactory],connectors=[docker-http-connector])
                            run-batch
                            

                            Again, thanks very much for your help!

                            • 11. Re: Timeout when connecting WildFly 10 remote JMS
                              Miroslav Novak Master

                              Hi Peter, you're welcome and thanks for this tread and providing nice output. It will help others to quickly solve the same issue.

                               

                              Thanks,

                              Mirek