Error during starting tomcat in remote debug mode
Asked Answered
S

3

9

Tomcat is not starting in debug mode. Getting below logs.

C:\ApacheSoft\apache-tomcat-7.0.67\bin>catalina.bat jpda start
Using CATALINA_BASE:   "C:\ApacheSoft\apache-tomcat-7.0.67"
Using CATALINA_HOME:   "C:\ApacheSoft\apache-tomcat-7.0.67"
Using CATALINA_TMPDIR: "C:\ApacheSoft\apache-tomcat-7.0.67\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.7.0_79"
Using CLASSPATH:       "C:\ApacheSoft\apache-tomcat-7.0.67\bin\bootstrap.jar;C:\ApacheSoft\apache-tomcat-7.0.67\bin\tomcat-juli.jar"
=transport=dt_socket was unexpected at this time.
Shelve answered 9/2, 2016 at 15:51 Comment(1)
This helped me serverfault.com/questions/634426/…Carnivorous
S
23

Let me guess, you read a link called "HOW TO REMOTELY DEBUG APPLICATION RUNNING ON TOMCAT FROM WITHIN INTELLIJ IDEA" on blog.trifork.com.

The instructions say to do this for Windows in your setenv.bat:

set JPDA_OPTS="-agentlib:jdwp=transport=dt_socket, address=1043, server=y, suspend=n"

Yeah, that's not going to work. catalina.bat adds its own quotes, so it winds up trying to do this:

if not ""-agentlib:jdwp=transport=dt_socket, address=1043, server=y, suspend=n"" == "" goto gotJpdaOpts

A better plan is to do this:

set JPDA_OPTS=-agentlib:jdwp=transport=dt_socket,address=1043,server=y,suspend=n

I know this is from almost a year ago, but I ran into this, and ultimately had to remove "@echo off" from the Tomcat batch files and chase this down myself. Hopefully, this will get voted up so that it can save someone else this grief.

Soble answered 17/12, 2016 at 2:23 Comment(2)
This was exactly the issue I had. Thanks for saving me no end of pain !Disinter
It is strange, it used to work, then it stop working but thank you I did this and it saved meProptosis
L
1

There is another possibility that you configure both two different ways to enable JPDA in jvm during starting tomcat in remote debug mode.

In windows, there're several ways to enable JPDA in jvm. 1.one way is :

open the startup.bat.

add the lines below

set JPDA_ADDRESS=8001
set JPDA_TRANSPORT=dt_socket
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%

2.the second way is:
create a setenv.bat file under CATALINA_HOME/bin directory. and add the line below:

set JPDA_OPTS=-agentlib:jdwp=transport=dt_socket, address=1043, server=y, suspend=n

of course, they're other ways. I have the same problem with you, but then I found I configured in these ways both, it will result in the failure to open the JPDA port, without any error details. Then I chose the method 1 only, the port was opened successfully. Hope this can help other newbies on this.

Lapin answered 25/8, 2017 at 8:29 Comment(0)
D
0

The space char in C:\Program Files\Java\jdk1.7.0_79 cause the problem. Replace it with short name could solve the problem.

Execute command dir c:\PROGRA~1\Java\jdk1.7.0_79 and check the file list to verify whether PROGRA~1 is correct. If not, try PROGRA~2 and so on...

Then change environment variable JAVA_HOME or JRE_HOME to try again.

Dunnage answered 9/2, 2016 at 16:57 Comment(1)
Could you paste the content of catalina.bat? I think it's modified and something is wrong.Dunnage

© 2022 - 2024 — McMap. All rights reserved.