1 2 Previous Next 16 Replies Latest reply on Oct 26, 2011 12:29 AM by jaikiran

    hostname

    kuvera

      My JBoss 4.2.0 CR2 is bound to address 0.0.0.0 because I need access from localhost, as well as from the internet. Actually I now have two such environments: a windows for development, and a linux for production.

      I have EJB's deployed.

      jndi.properties for the clients points to the FQ domain name of the server, on the standard port 1099.

      Client program to EJB communication fails because RMI on the remote client obviously uses the server's simple one-word hostname instead of its FQDN. How do I get around this?


      javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: kuvera; nested exception is:
      java.net.UnknownHostException: kuvera]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      ...
      Caused by: java.rmi.UnknownHostException: Unknown host: kuvera; nested exception is:
      java.net.UnknownHostException: kuvera
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:572)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
      ...
      Caused by: java.net.UnknownHostException: kuvera
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:430)
      ...


        • 1. Re: hostname
          monk2005

          I have the same problem. Does any one run into a problem like this and have a solution for??

          Thanks in advance

          • 2. Re: hostname
            monk2005

            Finally solved!

            1)
            Make sure that your server OS host file does the accurate transilation
            eg.

            127.0.0.1 localhost
            <external IP address> <computer name> <computer name with fully qualified domain name>

            2) Make sure that your server jndi.properties file uses the following instead of localhost:1099

            java.naming.provider.url=jnp://<computer name with fully qualified domain name>:1099

            this should do it - have fun!

            • 3. Re: hostname
              monk2005

              One more thing I forgot to mention.

              3) Start the server with -b option (bind address)

              eg.
              run -c <server name [if not given default]> -b <computer name with fully qualified domain name>

              Laterz

              • 4. Re: hostname
                mithilwane

                Did all this but still getting an exception

                • 5. Re: hostname
                  mithilwane

                  Basically now when i run the client from a remote m/c the name resolution does occur but rmi fails.

                  Any Ideas

                  • 6. Re: hostname
                    jaikiran

                    You will have to provide us more details about what you have done so far and what you are trying to do. Also, post the JBoss server version, the Java version and the entire exception stacktrace.

                    • 7. Re: hostname
                      mithilwane

                      JBoss version is 4.2.2 and jdk is 1.5.0_14

                      my hosts file has two entries

                      127.0.0.1 localhost
                      192.168.0.230 linuxserver myserver.server.com


                      jndi props looks like this

                      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                      java.naming.provider.url=jnp://myserver.server.com:1099

                      i get this exception in my client

                      Running default port
                      D:\WorkCVS\EMS
                      Exception:javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: myserver.server.com; nested exception is:
                      java.net.UnknownHostException: myserver.server.com]
                      javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: myserver.server.com; nested exception is:
                      java.net.UnknownHostException: myserver.server.com]
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                      at javax.naming.InitialContext.lookup(InitialContext.java:351)
                      at com.alphion.fm.client.FaultManageClient.init(FaultManageClient.java:48)
                      at com.lopsys.nms.client.fault.FaultManagerGUIClient.init(FaultManagerGUIClient.java:54)
                      at com.alphion.main.MainFrame.(MainFrame.java:111)
                      at com.alphion.main.MainFrame.main(MainFrame.java:571)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:585)
                      at com.alphion.main.EMSSplash.main(EMSSplash.java:57)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:585)
                      at com.alphion.main.WelcomeFrame.main(WelcomeFrame.java:167)
                      Caused by: java.rmi.UnknownHostException: Unknown host: myserver.server.com; nested exception is:
                      java.net.UnknownHostException: myserver.server.com
                      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:572)
                      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
                      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
                      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
                      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
                      ... 16 more
                      Caused by: java.net.UnknownHostException: myserver.server.com
                      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
                      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
                      at java.net.Socket.connect(Socket.java:520)
                      at java.net.Socket.connect(Socket.java:470)
                      at java.net.Socket.(Socket.java:367)
                      at java.net.Socket.(Socket.java:180)
                      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
                      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
                      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
                      ... 21 more
                      java.lang.reflect.InvocationTargetException
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:585)
                      at com.alphion.main.EMSSplash.main(EMSSplash.java:57)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:585)
                      at com.alphion.main.WelcomeFrame.main(WelcomeFrame.java:167)
                      Caused by: java.lang.NullPointerException
                      at com.alphion.fm.client.FaultManageClient.addAlpClientEventListener(FaultManageClient.java:75)
                      at com.lopsys.nms.client.fault.FaultManagerGUIClient.init(FaultManagerGUIClient.java:55)
                      at com.alphion.main.MainFrame.(MainFrame.java:111)
                      at com.alphion.main.MainFrame.main(MainFrame.java:571)
                      ... 10 more

                      • 8. Re: hostname
                        hsaha

                        It is quite clear from the exception that jboss is not able to resolve the hostname. Pls cross-check the following:
                        - Did you restart jboss after changing the host entries?
                        - Is the client in windows/linux? If windows, you need to change the correct file - C:\WINDOWS\system32\drivers\etc\hosts

                        Let us know whether it works..

                        • 9. Re: hostname
                          mithilwane

                          The hosts file that i specified is the one from the server m/c.

                          • 10. Re: hostname
                            jaikiran

                            So, are you able to ping myserver.server.com from the machine where this exception is occuring?

                            • 11. Re: hostname
                              mithilwane

                              Resolved thanx

                              • 12. Re: hostname
                                kennychaffin

                                Thanks for the commentary above. Adding the remote machine to my windows hosts file solved my similar problem.

                                • 13. Re: hostname
                                  kobiianko

                                  I'm having the same problem,

                                  the solution suggested here, does not seem to be a good one cause I don't wanna make all my users change there hosts file.

                                   

                                  Is there a way to make jboss run on IP address only?

                                   

                                  I'm having this problem on JBOSS 5.1, with JBOSS 4.0.5 it works fine(using only IP address)

                                  • 14. Re: hostname
                                    ivanbest

                                    In your jboss conf - change the following:

                                    • <jboss_home>\server\<your_server>\deploy\jbossws.sar\jbossws.beans\META-INF\jboss-beans.xml

                                    property alwaysModifySOAPAddress should be false 

                                    • bind the IP during Jboss start (ex. ./run.sh -b 192.168.2.3)  (do not use -b 0.0.0.0)

                                     

                                    Tested with Jboss 4.2.3.GA

                                     

                                    Enjoy

                                    1 2 Previous Next