https://bz.apache.org/bugzilla/show_bug.cgi?id=58635
Bug ID: 58635 Summary: Break point at java agent code is ignored during catalina.sh jpda run Product: Tomcat 9 Version: 9.0.0.M1 Hardware: All OS: All Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: huxing.zh...@gmail.com Steps to reproduce this issue: 1. prepare a simple java agent, named TestJavaAgent 2. add a break point to the premain method of TestJavaAgent 3. modify bin/setenv.sh: export JPDA_SUSPEND=y export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/test/java/agent.jar" 4. start tomcat in debugging mode: bin/catalina.sh jpda run Expected behavior: The tomcat prompts "Listening for transport dt_socket at address: 8000", and when attach a debugger to port 8000, the process stops at the break point in premain method of TestJavaAgent Actual behavior: The premain method of TestJavaAgent has been executed, and then tomcat prompts "Listening for transport dt_socket at address: 8000", the process never stopped at the break point in premain method of TestJavaAgent Putting $JPDA_OPTS before $CATALINA_OPTS will solve this issue: Index: bin/catalina.sh =================================================================== --- bin/catalina.sh (revision 1715719) +++ bin/catalina.sh (working copy) @@ -279,7 +279,7 @@ 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" + CATALINA_OPTS="$JPDA_OPTS $CATALINA_OPTS" shift fi Note: setting -agentlib=/path/to/agent.jar to JAVA_OPTS won't fix this issue, neither. Because JAVA_OPTS always goes before CATALINA_OPTS. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org