On OSX w/Tomcat7 and IDEA IntelliJ 12.
The run configuration works fine. The debug configuration complains with:
/usr/local/Cellar/tomcat/7.0.37/libexec/bin/catalina.sh run
Error occurred during initialization of VM
agent library failed to init: jdwp
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Disconnected from server
I found this post from '11 but it's not helping.
The note about "once I removed it from system variables (inside the IDEA it is read only) problem was fixed" makes sense. So I tried removing this entire block from catalina.sh
if [ -z "$JPDA_OPTS" ]; then
JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
fi
Didn't help. Any help would be greatly appreciated. Thanks!
java run command:
+ eval exec '"/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java"' '"-Djava.util.logging.config.file=/Users/ryan/Library/Caches/IntelliJIdea12/tomcat/Unnamed_secure_post_3/conf/logging.properties"' -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:65523,suspend=y,server=n -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager '-Djava.endorsed.dirs="/usr/local/Cellar/tomcat/7.0.37/libexec/endorsed"' -classpath '"/usr/local/Cellar/tomcat/7.0.37/libexec/bin/bootstrap.jar:/usr/local/Cellar/tomcat/7.0.37/libexec/bin/tomcat-juli.jar"' '-Dcatalina.base="/Users/ryan/Library/Caches/IntelliJIdea12/tomcat/Unnamed_secure_post_3"' '-Dcatalina.home="/usr/local/Cellar/tomcat/7.0.37/libexec"' '-Djava.io.tmpdir="/usr/local/Cellar/tomcat/7.0.37/libexec/temp"' org.apache.catalina.startup.Bootstrap start
Problem was catalina.sh was calling setenv.sh which was setting JAVA_OPTS like this:
JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"
I don't know where this setenv.sh came from, as a co-worker's homebrew install of tomcat didn't have this file.
For now, I've configured IntelliJ debug to use catalina_idea_debug.sh, which is simply a copy of catalina.sh minus the call to setenv.sh. Works fine now.