I have Tomcat 7 running in my local machine. I deployed a War file and it works fine.
I am trying to debug this application from eclipse.
I set the following in startup.bat file:
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
When I run the startup.bat file from command line, it opens another window and starts tomcat. In the first line I see that debugger is getting started on the port 8000 (something like dt_xxx port 8000). So I can confirm the debugger is started.
I configured Eclipse Remote debugging in the debug configuration and attached source for the war file deployed (selected the project). Gave the port and servername (localhost:8000).
Set a breakpoint in the Servlet which is called from the browser. When I open the URL, I don't see anything happening in eclipse (I expected it to hit the breakpoint).
What could be wrong?
Related
I was having issues installing and running tomcat today and had to do a lot of research to get it running. I'm putting my solution here in case anyone runs into the same problem.
When I opened the url localhost:8080 in my browser, I would get a "refused to connect" error. I checked if the port 8080 was being used by another service, and it was not.
I then noticed that tomcat wasn't starting. I tried opening it through services but that didn't work either. Later services showed tomcat stuck in the "starting" status. I then tried to run tomcat through the command prompt with these commands.
cd: c:/filepathToTomcat/bin
bin>startup`
That gave me this error
jre_home variable undefined and java_home variable undefined
Using the solution to
https://stackoverflow.com/questions/18468681/tomcat-6-java-home
I created a setenv.bat file in the tomcat bin and set the java_home variable.
My setenv.bat file contained
#ECHO OFF
set "JAVA_HOME=C:\Program Files\Java\jdk-19"
set "JRE_HOME="
Tomcat still wouldn't run. A solution on
https://stackoverflow.com/questions/5398654/tomcat-not-starting
suggested using "catalina.bat run" on the command prompt instead of startup.
This showed that tomcat wouldn't start because it couldn't get the java virtual machine to run. I then uninstalled and reinstalled java and tomcat started working for me.
I used Java version 19 and tomcat 10.1.5 on a windows 11.
I've been attempting to set up a remote debug configuration in IntelliJ.
The application itself is deployed via tomcat7 plug on the command line and works as expected.
Now I would like to debug this application and am unsure how to connect a remote debugger in this case.
I have edited tomcat startup.bat
set JDPA_ADDRESS=8080 set JDPA_TRANSPORT=dt_socket
and set up a remote config in IntelliJ
When the debugger configuration gets run, "handshake failed" error appears.
Port 8080 is usually a HTTP port used by Tomcat, your debugger port must be different.
I've been successfully debugging my Java code in Intellij using a .bat file with the following code:
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
#rem to start service in debug mode
%CATALINA_HOME%/bin/catalina.bat jpda start
I run Tomcat using this code and use the localhost configuration in Intellij which is a Remote config with the Host as localhost and port at 8000. This allowed me to debug line by line, however recently Intellij brings up the following error:
"Error: File system caches were invalidated. Rebuild required."
I've tried the following to attempt to fix this:
Rebuild project, File -> Invalidate Caches + IntelliJ restart, complete PC restart, Tomcat restart. None have worked so far; has anyone else encountered this problem? If so, is there a solution?
Many thanks
I am not trying to do any remote debugging in Eclipse. I am just trying to run WebLogic Server (which is in Eclipse) in DEBUG mode. I am getting a strange error message, which is shown in the attached image. The server is not starting from Eclipse when I try after this option. I am using Java 1.6
Do below setting to start debugger, it works fine in my case:
Edit /bin/setDomainEnv.sh file and add this on top:
JAVA_OPTIONS="$JAVA_OPTIONS -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"
The suspend=y will start your server and wait for you to connect with IDE before continue.
If you don't want this, then set to suspend=n instead.
Start/restart your WLS with /bin/startWebLogic.sh
Once WLS is running, you may connect to it using Eclipse IDE.
Go to Menu: Run > Debug Configuration ... > Remote Java Application and create a new entry.
Ensure your port number is matching to what you used above.
I know you can debug by just clicking the debug icon in Eclipse. Is it possible to start WebLogic from the command line with debugging and still debug? When I do that, in Eclipse under server I see that the status is "Started", not "Debugging". Can this only be done by setting up remote debugging?
You need to add parameters to the JAVA_OPTIONS in the startWebLogic.cmd (or startWebLogic.sh):
-Xrunjdwp:transport=dt_socket,server=y,address=1044,suspend=n -Xdebug
Then, in Eclipse you have to use remote debugging indeed.
Add a new Remote Java Application in the Debug Configurations (via the menu: Run - Debug Configurations).
Make sure the correct project is selected (Browse button) and fill in localhost in Host and 1044 in Port. The other options you can leave unchanged.
If you click debug you should be able to see your remote WebLogic running in the Debug perspective.
If you see a WebLogic started under Servers, you are looking at an embedded server and not at the one you started via the command line. Make sure to stop any embedded server before starting via the command line as they will not be able to run on the same port together anyway.