Tomcat startup ignores jpda parameter for debugging

I am trying to start Tomcat 7 in debug mode. If I type ./catalina.sh jpda start , then tomcat works as if the jpda option is missing and produces:

 Michaels-MacBook-Pro:bin clairewilgar$ ./catalina.sh jpda start Using CATALINA_BASE: /Users/clairewilgar/Downloads/apache-tomcat-7.0.42-MIS Using CATALINA_HOME: /Users/clairewilgar/Downloads/apache-tomcat-7.0.42-MIS Using CATALINA_TMPDIR: /Users/clairewilgar/Downloads/apache-tomcat-7.0.42-MIS/temp Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Using CLASSPATH: /Users/clairewilgar/Downloads/apache-tomcat-7.0.42-MIS/bin/bootstrap.jar:/Users/clairewilgar/Downloads/apache-tomcat-7.0.42-MIS/bin/tomcat-juli.jar 

and does not change CATALINA_OPTS or anything else. If I try to connect through Eclipse, I get an error

"Starting a workflow" has encountered a problem. Failed to connect to the remote virtual machine. Connection rejected.

I tried changing the port to jpda port on 8001, but I did not try to declare JPDA parameters in the terminal before calling catalina.sh, but that does not make any difference. My catalytic .sh JPDA lines look like this:

 if [ "$1" = "jpda" ] ; then if [ -z "$JPDA_TRANSPORT" ]; then JPDA_TRANSPORT="dt_socket" fi if [ -z "$JPDA_ADDRESS" ]; then JPDA_ADDRESS="8000" fi if [ -z "$JPDA_SUSPEND" ]; then JPDA_SUSPEND="n" fi if [ -z "$JPDA_OPTS" ]; then JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND" fi CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS" shift fi 

Are there other reasons why the JPDA may not work? I use OSX (Mountain Lion) if there is something related to what I might have missed. Thanks in advance.

EDIT: My catalina.out file to run ./catalina.sh jpda start is located at http://pastebin.com/Z4GSvckr

+7
java tomcat macos jpda
source share
5 answers

Same problem if you start it with startup.sh ? You may need to edit startup.sh to call catalina.sh with the jpda parameter.

Have you tried to set the variables manually? I never had this problem at my end, but I usually did something like the one described in this wiki .

Also, if the above variables are already set in your environment, they will not be reset in catalina.sh script ( -z ).

You can also try adding setup.sh to the bin folder containing:

 JPDA_TRANSPORT="dt_socket" JPDA_ADDRESS="8000" JPDA_SUSPEND="n" JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND" CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS" 

With this change, you can simply start tomcat using startup.sh start .

+5
source share

This could be a problem with IPv4 and IPv6.

 netstat -an | grep 8000 

I once had a problem when I could not connect to the "localhost" port 13306, but could connect to the port "127.0.0.1" 13306

localhost was mapped to an IPv6 address when a process listened for an IPv4 address

+1
source share

you can change this line in catlina.sh:

 if [ -z "$JPDA_SUSPEND" ]; then JPDA_SUSPEND="n" fi 

to:

 if [ -z "$JPDA_SUSPEND" ]; then JPDA_SUSPEND="y" fi 

or set env-var "JPDA_SUSPEND" to "y" - before calling catalina.sh

0
source share

I had the same problem as my startup.sh file contained the following lines:

 exec "$PRGDIR"/"$EXECUTABLE" start " $@ " 

Therefore, the team. /startup.sh jpda start was sent to Catalina.sh as the launch of jpda start and therefore the debugging options were ignored, so I had to change this line to

 exec "$PRGDIR"/"$EXECUTABLE" " $@ " 

Regards, Borys

0
source share

Change the last line of this file: "startup.sh" ( "startup.bat" if you are using Windows)

Instead of this:

 exec "$PRGDIR"/"$EXECUTABLE" start " $@ " 

Use this:

 exec "$PRGDIR"/"$EXECUTABLE" jpda start " $@ " 
0
source share

All Articles