7 Replies Latest reply on Jan 16, 2014 7:33 AM by marco.battaglia

    JNDI Lookup Failing

    jim_b_o

      Running WildFly 8.0.0.Alpha3.  Can connect successfully to http://localhost:8080 in web browser, but when trying JNDI lookup I have no luck.  Here's everything I believe to be relevant:

       

        <dependency>

                                              <groupId>org.wildfly</groupId>

                                              <artifactId>wildfly-ejb-client-bom</artifactId>

                                              <version>8.0.0.Alpha3</version>

        <type>pom</type>

                                              <scope>compile</scope>

        </dependency>


                          Properties env = new Properties();

                          env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());

                          env.put(Context.PROVIDER_URL, "remote://localhost:8080");

                          InitialContext context = new InitialContext(env);

                          context.lookup("jms/RemoteConnectionFactory");


      INFO: XNIO Version 3.1.0.CR3

      Jul 28, 2013 5:46:40 PM org.xnio.nio.NioXnio <clinit>

      INFO: XNIO NIO Implementation Version 3.1.0.CR3

      Jul 28, 2013 5:46:40 PM org.jboss.remoting3.EndpointImpl <clinit>

      INFO: JBoss Remoting version 4.0.0.Beta1

      Exception in thread "main" javax.naming.NamingException: Failed to connect to any server. Servers tried: [remote://localhost:8080]

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

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

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

                at org.jboss.naming.remote.client.HaRemoteNamingStore.list(HaRemoteNamingStore.java:295)

                at org.jboss.naming.remote.client.RemoteContext.list(RemoteContext.java:119)

                at org.jboss.naming.remote.client.RemoteContext.list(RemoteContext.java:123)

                at javax.naming.InitialContext.list(InitialContext.java:455)

                at WildFlyLookup.main(WildFlyLookup.java:26)

       

      Any ideas?

        • 1. Re: JNDI Lookup Failing
          nickarls

          8080 is the web port and not used for JNDI.

          Try checking the documentation for local JNDI access (@Resource injection might be even more straightforward if you're just working with local JMS)

          • 2. Re: JNDI Lookup Failing
            sfcoy

            Nicklas Karlsson wrote:

             

            8080 is the web port and not used for JNDI.

            I would not bet on that...

            • 3. Re: JNDI Lookup Failing
              nickarls

              The HTTP upgrade works with plain JNDI lookups?

              • 4. Re: JNDI Lookup Failing
                jaikiran

                jim_b_o wrote:

                 

                                    env.put(Context.PROVIDER_URL, "remote://localhost:8080");

                Change the protocol to http-remoting. Like this:

                 

                env.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");

                • 5. Re: JNDI Lookup Failing
                  jaikiran

                  Nicklas Karlsson wrote:

                   

                  The HTTP upgrade works with plain JNDI lookups?

                  Yes it does. In fact, even the EJB invocations are now backed by HTTP upgrade http://jaitechwriteups.blogspot.in/2013/07/wildfly-800alpha3-released-with-support.html

                  • 6. Re: JNDI Lookup Failing
                    nickarls

                    jaikiran pai wrote:

                     

                    Nicklas Karlsson wrote:

                     

                    The HTTP upgrade works with plain JNDI lookups?

                    Yes it does. In fact, even the EJB invocations are now backed by HTTP upgrade http://jaitechwriteups.blogspot.in/2013/07/wildfly-800alpha3-released-with-support.html

                     

                    My summer vactation was longer than I thought! ;-)

                    So after the "single port communication"-vision is complete, you would have to do your firewalling on HTTP header rules? Or?

                    • 7. Re: JNDI Lookup Failing
                      marco.battaglia

                      Hi

                      it works fine in these two scenario:

                       

                      scenario 1

                      -client is on localhost

                      -the provider URL is: http-remote://localhost:8080

                      -the server starts in localhost

                       

                      scenario 2

                      - client is on the same machine

                      - the provider URL is: http-remote://192.168.100.145:8080

                      - server starts with binding-address for example -b 192.168.100.145

                       

                      It doesn' work in these two scenario:

                       

                      scenario 3

                      - client is on a different machine for example 192.168.100.144

                      -  the provider URL is: http-remote://192.168.100.145:8080

                      - server starts with binding-address for example -b 192.168.100.145

                       

                      scenario 4

                      - client is on the same machine

                      - the provider URL is: http-remote://192.168.100.145:8080

                      - server starts with binding-address for example -b 192.168.100.145

                      - the loopback network interface is down (ifconfig lo down)

                       

                      It seems that during remote contracting there is a reference to localhost