4 Replies Latest reply on Jul 18, 2007 10:59 AM by B S

    JNDI lookup problem from remote client present in External N

    vedgunjan singh Newbie

      Hi,

      We are using JBoss 4.0.5.GA as our application server.

      The scenario is like this.

      Machine A) IP Address: 192.168.XXX.YYY. [It's the Server] On this Machine Jboss4.0.5.GA and MySQL are running.

      The outside system (basically the external clients) refers to this machine through address 220.225.ZZZ.XXX. This is the public ip address.
      i.e the external_host_name = 220.225.ZZZ.XXX.

      Machine B) it?s an external client. It is looking up for service which is running on Machine A through JNDI.
      In the client code, the jndi provider URL is set up to "jnp://220.225.ZZZ.XXX:1099" when the initial context is created for the RMI access.

      The client code which is running on Machine B) is doing a lookup for the service, using the following jndi.propterties:
      Code:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=jnp://220.225.ZZZ.XXX:1099

      The two machines are running on different network.

      When am running the code on the Machine B), and trying to access the service running on Machine A), it is throwing java.naming.CommunicationException: connection refused, cannot connect to url: 220.225.36.247.

      Can you guide us where we are going wrong and whether we are missing any setting in the JBoss Server?

      I need this fix very urgently...please guide be to the solution.

      Thanks and Regards.
      Ved.

        • 1. Re: JNDI lookup problem from remote client present in Extern
          Umakanth Srinivasan Newbie

          use -Djava.rmi.server.hostname=220.225.ZZZ.XXX in your server startup script. That will solve the problem

          • 2. Re: JNDI lookup problem from remote client present in Extern
            vedgunjan singh Newbie

            Hi kanth_seenu,

            I already tried this, but it didnt work.

            Am missing any more setting or jars needed for remote lookup i,e from from external client.

            Thanks for any suggestion and help.

            Regards.
            Ved

            • 3. Re: JNDI lookup problem from remote client present in Extern
              vedgunjan singh Newbie

              Hi,
              I'm posting my run.bat for your reference.Please let me know whether what i tried was correct or not.

              @echo off
              rem -------------------------------------------------------------------------
              rem JBoss Bootstrap Script for Win32
              rem -------------------------------------------------------------------------
              
              rem $Id: run.bat 56327 2006-08-28 10:34:13Z dimitris@jboss.org $
              
              @if not "%ECHO%" == "" echo %ECHO%
              @if "%OS%" == "Windows_NT" setlocal
              
              set DIRNAME=.\
              if "%OS%" == "Windows_NT" set DIRNAME=%~dp0%
              set PROGNAME=run.bat
              if "%OS%" == "Windows_NT" set PROGNAME=%~nx0%
              
              rem Read all command line arguments
              
              REM
              REM The %ARGS% env variable commented out in favor of using %* to include
              REM all args in java command line. See bug #840239. [jpl]
              REM
              REM set ARGS=
              REM :loop
              REM if [%1] == [] goto endloop
              REM set ARGS=%ARGS% %1
              REM shift
              REM goto loop
              REM :endloop
              
              rem Find run.jar, or we can't continue
              
              set RUNJAR=%DIRNAME%\run.jar
              if exist "%RUNJAR%" goto FOUND_RUN_JAR
              echo Could not locate %RUNJAR%. Please check that you are in the
              echo bin directory when running this script.
              goto END
              
              :FOUND_RUN_JAR
              
              if not "%JAVA_HOME%" == "" goto ADD_TOOLS
              
              set JAVA=java
              
              echo JAVA_HOME is not set. Unexpected results may occur.
              echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
              goto SKIP_TOOLS
              
              :ADD_TOOLS
              
              set JAVA=%JAVA_HOME%\bin\java
              
              if exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
              echo Could not locate %JAVA_HOME%\lib\tools.jar. Unexpected results may occur.
              echo Make sure that JAVA_HOME points to a JDK and not a JRE.
              
              :SKIP_TOOLS
              
              rem Include the JDK javac compiler for JSP pages. The default is for a Sun JDK
              rem compatible distribution to which JAVA_HOME points
              
              set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar
              
              rem If JBOSS_CLASSPATH is empty, don't include it, as this will
              rem result in including the local directory, which makes error tracking
              rem harder.
              
              rem Setup JBoss specific properties
              set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
              set JBOSS_HOME=%DIRNAME%\..
              
              if "%JBOSS_CLASSPATH%" == "" (
               set JBOSS_CLASSPATH=%JAVAC_JAR%;%RUNJAR%;C:\Program Files\pl\bin;%JBOSS_HOME%\YagnaRules
              ) else (
               set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;%JAVAC_JAR%;%RUNJAR%;C:\Program Files\pl\bin;%JBOSS_HOME%\YagnaRules
              )
              
              
              set PATH=%PATH%;C:\Program Files\pl\bin;;%JBOSS_HOME%\YagnaRules
              
              
              rem Add -server to the JVM options, if supported
              "%JAVA%" -version 2>&1 | findstr /I hotspot > nul
              if not errorlevel == 1 (set JAVA_OPTS=%JAVA_OPTS% -server)
              
              rem JVM memory allocation pool parameters. Modify as appropriate.
              set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m
              
              set JAVA_OPTS=%JAVA_OPTS% -Djava.rmi.server.hostname=220.225.ZZZ.XXX
              
              rem With Sun JVMs reduce the RMI GCs to once per hour
              set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
              
              rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
              rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
              
              rem Setup the java endorsed dirs
              set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed
              
              echo ===============================================================================
              echo.
              echo JBoss Bootstrap Environment
              echo.
              echo JBOSS_HOME: %JBOSS_HOME%
              echo.
              echo JAVA: %JAVA%
              echo.
              echo JAVA_OPTS: %JAVA_OPTS%
              echo.
              echo CLASSPATH: %JBOSS_CLASSPATH%
              echo.
              echo ===============================================================================
              echo.
              
              :RESTART
              "%JAVA%" %JAVA_OPTS% "-Djava.endorsed.dirs=%JBOSS_ENDORSED_DIRS%" -classpath "%JBOSS_CLASSPATH%" org.jboss.Main %*
              if ERRORLEVEL 10 goto RESTART
              
              :END
              if "%NOPAUSE%" == "" pause
              
              :END_NO_PAUSE
              
              


              • 4. Re: JNDI lookup problem from remote client present in Extern
                B S Newbie

                Hi,

                I just wanted to check on the status, I am running with similar problem and wanted to know if your issue is fixed ?

                If yes can you guide me through it ?