score:46
First, you need to run Tomcat in debugging mode. The easiest way to do that is to modify the startup file (.bat or .sh depending if you are Windows or not). Find the line near or at the end of the file that contains the start
command, and change it to jpda start
. This will cause Tomcat to start in debugging mode listening on port 8000
.
Next, to connect to this process via Eclipse, select the Run
menu and choose Debug Configurations...
. In the pane on the left, choose Remote Java Application
and click the New launch configuration
button above the list. The important settings to note are the Host
and Port
fields. The host value must match the hostname of the Tomcat process, and the port should be 8000
. You also might need to add entries on the Source
tab to ensure that all of the source code is available to step through.
score:0
Steps to setup the tomcat Debugger with eclipse
Install the following things:
java 1.8+
eclipse EE version
download tomcat 8+
open eclipse and go to
servers
tab and add a new server(window-> show View-> Others -> Search Servers)Mark your project as Dynamic web Project(Rightclick on Project-> project facets -> select Dynamic web module)
Export war (File-> Export-> search war -> select module and choose the path)
Run as -> Run on Server
Start the tomcat Server in Debug or Run Mode
check on
localhost:8080
score:0
Debug worked for me. I was using tomcat 8, configured on centos 7. Debug port opened for me after changing 2 settings.
- Open tomcat/conf/bin/startup.sh and added below lines
export JPDA_ADDRESS=8000
export JPDA_TRANSPORT=dt_socket
- In the same file startup.sh, added jpda before start command.
exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"
Restart the tomcat. In eclipse go to Run>Debug configuration>Remote java application>Add host ip and port(8000) where tomcat is running. In my case i required to open 8000 through firewall too.
firewall-cmd --zone=public --permanent --add-port=8000/tcp
firewall-cmd --reload
score:0
Beside remote debugging, you can debug your app locally within eclipse if you added tomcat in eclipse. just start server and wright click your app and from debug menu hit debug on server. If you have multi module maven project, debug on server just shown up for module with war packaging. If you want debug a class that runs at startup by self, like methods that annotated with @PostConstruct, remember that you should increase server timeout. To do that, go to server view and double click on tomcat and in server preview tab, increase the timeout value.
score:2
- Right Click on the project you want to debug and go to Debug As Menu and in the list click on Debug Configurations.
Then Double click on the Remote Java Application from left menu list. browse for the project u wanna add in then click apply.
- Also change the listening port to 7999, then after you started the web app from your localhost click the debug button on the same window. Then any break point's will be hit after that.
score:3
yes, you need to configure tomcat to accept remote debugging connections. There is a FAQ on how to do it with various IDEs.
score:3
Simply change the line in startup.bat
(if you are using Windows)
from:
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
to:
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
score:12
- Create a new tomcat server
- Create a new dynamic web project
Export war to tomcat server
- Tomcat debug configuration(important), first double click tomcat server, then select "Use Tomcat installation (takes control of Tomcat installation)"
- Add breakpoints
- Run tomcat in debug mode
- Test war in web browser
- Edit source path
- Debug source code in Tomcat
The war file is available here.
Source: stackoverflow.com
Related Query
- debugging java application deployed in tomcat
- Unusual behavior in java application deployed in tomcat
- How to deploy Java web application project from Eclipse to live Tomcat server?
- Automatic Deployment of Java application on Remote Tomcat
- How to debug Groovy code via the remote Java application debugging in Eclipse
- Launching and debugging a Java application on a remote or virtual machine
- how to deploy java web application with mysql database on tomcat server
- Debugging a remote Java application with Eclipse as the server (Socket listen)
- Remote Debugging Java application not show variable values
- Debugging remote application in Eclipse using Tomcat
- Debugging a Spring MVC application running on Tomcat
- How to debug java application in Eclipse deployed in tomcat?
- Set Tomcat <Context> param from deployed Eclipse web application
- deploying Java web application in exploded directory outside the Tomcat server, using Eclipse
- How to define an argument when debugging a remote Java application in Ecilpse?
- Unable to start debugging a java application using eclipse
- system restarts while running a java web application in eclipse with tomcat server
- When I start running my java application through Tomcat server, I encountered this kind of error. What should I do?
- Java application post action works in Eclipse Tomcat but does not work on local Tomcat server
- Edit a deployed application using tomcat server
- Debugging Java application in Eclipse using transport=dt_shmem
- Spring application working in eclipse but same not working when deployed on tomcat 8
- Debugging on Eclipse using Remote Java Application
- Debugging Java application causes high cpu utilization
- how to configure java web application in eclipse to reflect changes in backend jar after deploy on tomcat
- Eclipse Java EE IDE need tomcat source for debugging
- When debugging java application in Eclipse, how do I configure it to not close the files the debugger opened?
- Problems accessing REST endpoints from Springboot application deployed on Tomcat
- Debugging java swing application in eclipse
- using eclipse, how to debug java application build to ear using ant and deployed on weblogic
More Query from same tag
- Logcat scrolls down to bottom
- Getting java.lang.ClassNotFoundException: SessionFactory when I try to deploy the war
- I need to import my apk into eclipse - possible?
- How to disable Tern synchronization in Eclipse Luna?
- eclipse add unimplemented methods including javadoc
- Eclipse complains about "No grammar constraint (DTD or XML Schema) referenced in the document" despite one being specified
- java code template
- Custom widget is not showing up in my eclipse 4 application
- Branch created by someone else is not visible
- Android unable to register external jars
- Android 5.0 is not supporting for lower versions
- How do I specify an old JDK compliance in an Eclipse project?
- Could not find main class : Program will exit
- reuse ElementListSelectionDialog on Eclipse 4 RCP Application
- Official tutorial codes appearing red wave line in Eclipse not allowing me to compile
- "Could not create the JVM" error at Eclipse startup
- protobuf encoding example java
- Make Eclipse RCP Intro part of a perspective
- Maven pointing to the wrong directory of JDK
- NoClassDefFoundError while executing Android JUnit test
- Resolve java.lang.StackOverflowError memory problem
- Eclipselink factory.createEntityManager() stalls with more than one instance running
- Showing project structure and contents on a web page, like Eclipse's package explorer
- Subversive Connector Discovery error
- How to set custom JRE System library path value in Spring Tool Suite?
- Reading files in exported rcp eclipse product
- gitignore in Eclipse workspace rather than each project
- How to Package and deploy a Swings application on other system / network
- Eclipse plugin for javascript development in jsp?
- Connection to database - MySQL