7 Replies Latest reply on Jun 22, 2012 6:05 AM by Abhijit Prusty

    JVM Already Bind-When try to start server with degub port

    Abhijit Prusty Newbie

      Hi All,

       

      I have a Jboss server running with two nodes using the following command, now I have added the below mentioned line to the run script. Now when I start my first node. it starts fine.When I try to run my second node, it gives JVM already in use error as the debug port added to run script i.e. 8787 is already started.

       

      -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

       

      Can any one suggesst me how, can I handle this scenario.

       

      Thanks,

      Abhiji

        • 1. Re: JVM Already Bind-When try to start server with degub port
          Wolf-Dieter Fink Master

          If you have two nodes started on the same server and add the -Xrunjdwp option the address must be different.

          This connection port will be opened by the JVM to connect the remote-debugger and it must be unique.

          • 2. Re: JVM Already Bind-When try to start server with degub port
            Abhijit Prusty Newbie

            Hi Wolf,

             

            Can you let me know how can I mention two different port.

             

            Thanks,

            Abhijit

            • 3. Re: JVM Already Bind-When try to start server with degub port
              Wolf-Dieter Fink Master

              How do you start the JBoss instances?

              I suppose you add "-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" to both run.conf[.bat] right?

              You can't use 8787 port twice, try a different one.

              For the debugger you have to decide which instance do you want.

               

              BTW it will be difficult to debug with two instances

              • 4. Re: JVM Already Bind-When try to start server with degub port
                Abhijit Prusty Newbie

                I start using the run.bat file, but to run both instances I ahve only one run.bat file. Do I need to add the degug line twice with different ports? Is it possible to make separate run.bat for the different isntances

                 

                PFA for my run.bat

                 

                Thanks,

                Abhijit

                • 5. Re: JVM Already Bind-When try to start server with degub port
                  Abhijit Prusty Newbie

                  @echo off

                  rem -------------------------------------------------------------------------

                  rem JBoss Bootstrap Script for Windows

                  rem -------------------------------------------------------------------------

                   

                  rem $Id: run.bat 111395 2011-05-18 07:45:07Z beve $

                   

                  @if not "%ECHO%" == ""  echo %ECHO%

                  @if "%OS%" == "Windows_NT" setlocal

                   

                  if "%OS%" == "Windows_NT" (

                    set "DIRNAME=%~dp0%"

                  ) else (

                    set DIRNAME=.\

                  )

                   

                  rem Read an optional configuration file.

                  if "x%RUN_CONF%" == "x" (  

                     set "RUN_CONF=%DIRNAME%run.conf.bat"

                  )

                  if exist "%RUN_CONF%" (

                     echo Calling %RUN_CONF%

                     call "%RUN_CONF%" %*

                  ) else (

                     echo Config file not found %RUN_CONF%

                  )

                   

                  pushd %DIRNAME%..

                  if "x%JBOSS_HOME%" == "x" (

                    set "JBOSS_HOME=%CD%"

                  )

                  popd

                   

                  set DIRNAME=

                   

                  if "%OS%" == "Windows_NT" (

                    set "PROGNAME=%~nx0%"

                  ) else (

                    set "PROGNAME=run.bat"

                  )

                   

                   

                   

                  rem Setup JBoss specific properties

                  rem -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

                  set JAVA_OPTS=-Dprogram.name=%PROGNAME%  -Dsdp.event.config.mode=global -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%

                   

                  if "x%JAVA_HOME%" == "x" (

                    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.

                  ) else (

                    set "JAVA=%JAVA_HOME%\bin\java"

                    if exist "%JAVA_HOME%\lib\tools.jar" (

                      set "JAVAC_JAR=%JAVA_HOME%\lib\tools.jar"

                    )

                  )

                   

                  rem Add -server to the JVM options, if supported

                  "%JAVA%" -server -version 2>&1 | findstr /I hotspot > nul

                  if not errorlevel == 1 (

                    set "JAVA_OPTS=%JAVA_OPTS% -server"

                  )

                   

                  rem Add native to the PATH if present

                  set JBOSS_NATIVE_HOME=

                  set CHECK_NATIVE_HOME=

                  if exist "%JBOSS_HOME%\bin\libtcnative-1.dll" (

                    set "CHECK_NATIVE_HOME=%JBOSS_HOME%\bin"

                  ) else if exist "%JBOSS_HOME%\..\native\bin" (

                    set "CHECK_NATIVE_HOME=%JBOSS_HOME%\..\native\bin"

                  ) else if exist "%JBOSS_HOME%\bin\native\bin" (

                    set "CHECK_NATIVE_HOME=%JBOSS_HOME%\bin\native\bin"

                  )

                  if "x%CHECK_NATIVE_HOME%" == "x" goto WITHOUT_JBOSS_NATIVE

                   

                  rem Translate to the absolute path

                   

                  pushd "%CHECK_NATIVE_HOME%"

                  set JBOSS_NATIVE_HOME=%CD%

                  popd

                  set CHECK_JBOSS_NATIVE_HOME=

                  set JAVA_OPTS=%JAVA_OPTS% "-Djava.library.path=%JBOSS_NATIVE_HOME%;%PATH%;%SYSTEMROOT%"

                  set PATH=%JBOSS_NATIVE_HOME%;%PATH%;%SYSTEMROOT%

                   

                  :WITHOUT_JBOSS_NATIVE

                  rem Find run.jar, or we can't continue

                   

                  if exist "%JBOSS_HOME%\bin\run.jar" (

                    if "x%JAVAC_JAR%" == "x" (

                      set "RUNJAR=%JBOSS_HOME%\bin\run.jar"

                    ) else (

                      set "RUNJAR=%JAVAC_JAR%;%JBOSS_HOME%\bin\run.jar"

                    )

                  ) else (

                    echo Could not locate "%JBOSS_HOME%\bin\run.jar".

                    echo Please check that you are in the bin directory when running this script.

                    goto END

                  )

                   

                  rem If JBOSS_CLASSPATH empty, don't include it, as this will

                  rem result in including the local directory in the classpath, which makes

                  rem error tracking harder.

                  if "x%JBOSS_CLASSPATH%" == "x" (

                    set "RUN_CLASSPATH=%RUNJAR%"

                  ) else (

                    set "RUN_CLASSPATH=%JBOSS_CLASSPATH%;%RUNJAR%"

                  )

                   

                  set JBOSS_CLASSPATH=%RUN_CLASSPATH%

                   

                  rem Setup JBoss specific properties

                   

                  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 "x%NOPAUSE%" == "x" pause

                   

                  :END_NO_PAUSE

                  • 6. Re: JVM Already Bind-When try to start server with degub port
                    Wolf-Dieter Fink Master

                    You might do this with a copy of run.bat.

                    I think you will run two instance for development right?

                     

                    But why you need two for debugging?

                    • 7. Re: JVM Already Bind-When try to start server with degub port
                      Abhijit Prusty Newbie

                      That was a great help. It's the exactly what I wantred..:)