Search code examples
javaeclipsedebuggingtomcatjpda

Debug Apache Tomcat. Oops! Google Chrome could not connect. Why?


I have next task: Debug Apache Tomcat in Eclipse.

My steps:

  • Run Tomcat: ./startup.sh
  • Check - open in browser localhost:8080/MyProject - SUCCESS.
  • in file catalina.sh I added next lines:

export JPDA_ADDRESS=8000 export JPDA_TRANSPORT=dt_socket

  • in file startup.sh:

I comment this line:

#exec "$PRGDIR"/"$EXECUTABLE" start "$@"

and added next line:

exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"

  • Run Tomcat: startup.sh
  • Check - in browser try open localhost:8080/MyProject - FAIL. At the next step I will try add settings in Eclipse for remote debug Tomcat, but I have Fail on previous step.

Why did this happen??

Maybe, it is depends on OS type? I use Ubuntu 11.10...


Solution

  • 1.) No pun intended: did you stop tomcat after modifying .sh files and before runing startup.sh?

    2.) Check tomcat log for errors.

    3.) I run Tomcat on debug this way:

    • Created a MyCatalinaStart.sh (bat on windows) with the following

    export JPDA_ADDRESS=8000

    export JPDA_TRANSPORT=dt_socket

    export JPDA_SUSPEND=n

    catalina.sh jpda start

    • Started Tomcat from it. The sh or bat files require NO modification, they came ready to receive inputs