4 Replies Latest reply on May 14, 2013 2:47 AM by Wolf-Dieter Fink

    remote JNDI using IP

    cacao Newbie

      I am able to setup and run a program that writes to and reads from a JMS queue in JBoss EAP 6.0.0.GA. 

      I am able to run the program when i use the URL remote://localhost:4447 in the code. However when i try to run the program remotely or using my machine's IP in the above URL, i get an error saying the lookup service could not be performed.

      I think this should be some configuration to be done in the standalone-ful.xml that i am using the start my JBoss. Can somebody help pointing out what needs to be done ?

      I am binding my IP at start time using -b 0.0.0.0

       

      Thanks!

        • 1. Re: remote JNDI using IP
          cacao Newbie

          I started the server with -b <my-ip> and i am able to get the same code working now.

          • 2. Re: remote JNDI using IP
            Stephen Coy Master

            Hi there,

             

            JBossAS/WildFly is configured this way by default for security reasons. It forces administrators to deliberately expose their server to the world, instead of doing it inadvertently.

             

            Instead of using the "-b" command line option, you can indeed configure this in your "standalone*.xml" file.

             

            Define an interface:

             

            {code:xml}        <interface name="external">

                        <inet-address value="your.ip.address"/>

                    </interface>{code}

             

            Define a socket-binding:

             

            {code:xml}<socket-binding name="ext-remoting" port="4447" interface="external" />{code}

             

            Change the remoting subsystem connector declaration:

             

            {code:xml}<connector name="remoting-connector" socket-binding="ext-remoting" security-realm="ApplicationRealm"/>{code}

            1 of 1 people found this helpful
            • 3. Re: remote JNDI using IP
              cacao Newbie

              Hey Stephen, thanks for the pointers. However, after these changes, i am still facing an issue. The standalone java program that i am using to send/retrieve JMS messages is working when run locally on my machine (using my IP in the URL). However, when i run the same program from another machine, i get this exception. (I have used all the jar files as were needed on my local machine when running the program):

               

              Exception in thread "main" javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed]
              at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:51)
              at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:151)
              at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
              at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
              at javax.naming.InitialContext.init(Unknown Source)
              at javax.naming.InitialContext.<init>(Unknown Source)
              at org.local.jms.Jmsdemo.getInitialContext(Jmsdemo.java:157)
              at org.local.jms.Jmsdemo.sendMessage(Jmsdemo.java:50)
              at org.local.jms.Jmsdemo.main(Jmsdemo.java:38)
              Caused by: java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
              at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:87)
              at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:68)
              at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:196)
              at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:169)
              at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:134)
              ... 7 more
              Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
              at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:315)
              at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:214)
              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
              at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
              at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
              at org.xnio.nio.NioHandle.run(NioHandle.java:90)
              at org.xnio.nio.WorkerThread.run(WorkerThread.java:184)
              at ...asynchronous invocation...(Unknown Source)
              at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)
              at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)
              at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)
              at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)
              at org.jboss.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:105)
              at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:67)
              ... 10 more

              • 4. Re: remote JNDI using IP
                Wolf-Dieter Fink Master

                If you run the client local the security 'ApplicationRealm' is bypassed.

                In case you run the client on a different machine you need to add a application user to the ApplicationRealm by using bin/add-user.sh (follow the instructions and select application user).

                In your InitialContext you need to set the user and the password.