Cannot debug Java project in IDEA IntelliJ 12

On OSX with Tomcat7 and IDEA IntelliJ 12.

Startup configuration works fine. Debug configuration complains about:

    /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 that didn't help.

The note that β€œonce I deleted it from system variables (inside the read-only IDEA) the problem has been fixed” makes sense. So I tried to remove this whole 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

Did not help. Any help would be greatly appreciated. Thank!

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
+5
source share
1 answer

The problem was that Catalina.sh called setenv.sh, which set JAVA_OPTS as follows:

    JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"

, setenv.sh, , .

IntelliJ debug catalina_idea_debug.sh, catalina.sh setenv.sh. .

+3

All Articles