Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error during starting tomcat in remote debug mode

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.
like image 758
Ashis Jena Avatar asked Feb 09 '16 15:02

Ashis Jena


People also ask

How do I start Tomcat in remote debug mode?

Go to "Run->Debug Configurations...". Click on "Remote Java Applications", then click "New". Type in the title. Note that port 8000 from the Tomcat instructions.

How do I start Tomcat remotely?

Enter in the host pc's ip address. 3. Once you have connected you will see the list of services on the host pc. To start and stop (or restart at once), just right click on the Apache Tomcat service.

Why is my Tomcat not starting?

Most common issue with Tomcat note starting is that Java is not configured properly, user trying to start Tomcat does not have permissions to do so, or another program is using port 8080 on that server.


2 Answers

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.

like image 148
Jamie Avatar answered Oct 17 '22 14:10

Jamie


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.

like image 35
Ron Avatar answered Oct 17 '22 16:10

Ron