According to home page of gradle tomcat plugin FAQ section:
How do I remote debug my Tomcat started up by the plugin?
I need to add the following environment property:
GRADLE_OPTS = -Xdebug Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
During run of container I should see information that it listens on particular port: Listening for transport dt_socket at address: 5005, but in my case it's not working.
How I can configure it properly ? I'm running intellij idea 14.1 Ultimate.
In my case it worked as I started the Tomcat in the IDE itself and not the CLI.
For that I created two run/debug configurations, one for Tomcat and one to Remote connect the debugger to the Tomcat process.
For the Remote configuration, use the port 5005 like mentioned in the plugin FAQ debug section.
For the Tomcat configuration, you have to set the JVM settings explicitly. Simply put -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 as a value into the JVM options textfield in the Gradle run/debug config.
After both configurations have been created and properly configured, first run the Tomcat process and then connect to it by debugging the Remote configuration.
You can find an entire spring-mvc example and an detailed solution here.
Related
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 am trying to debug maven project with Jetty server in eclipse (Spring Tool Suite Version: 3.4.0). I have added the below in my POM.xml
-javaagent:"${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar" -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n
MAVEN_OPTS
-Xmx512m -XX:MaxPermSize=256m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
I start the server with jetty:run-forked
I have created a new debug configuration - Remote Java Application with below attributes,
Connection type : Standard (Socket Attach)
Host: Localhost
Port: 8000
The server gets started and I could run the application but the debug is not working. (I have already verified skip breakpoints it's unchecked)
I have also referred the below questions but the issue is not resolved yet. Please help.
Question1
Question2
Don't use jetty:run-forked as that will spawn a new JVM.
The process of forking a new JVM means that the maven JVM settings will not propagate.
It can't propagate those settings (like port), as they are now used by the maven JVM, and cannot be used by the forked JVM (eg: Bind Exception).
I've deployed application on provider server on URL:
http://my.domain.net/my-spring-boot-app/
Provider use Tomcat as java app container. App connects to PostgreSQL, and it can do this only from this server host - because it is a restriction (probably on pg_conf). That it's important, because an error shows only on server site. How can I debug remotely my Spring Boot (war!) application, when I use maven & eclipse pack?
I don't know about the PostgreSQL issue but seems to me that this has nothing to do with data access layer or tools as it is basically a Java application which implies the rules for all JVM applications.
So in order to set up your server for remote debug, you have to hack the jvm (catalina in your case as you are running a Tomcat server) startup options by adding below entry to your startup script:
For a Windows system:
set CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n %CATALINA_OPTS%"
For a *nix system:
export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n $CATALINA_OPTS"
There is a shortcut to the below instruction, using the catalina startup script options, if that represents an alternative for you: catalina jpda start
You application is then up and listening on the configured port (8787 is this sample, which you must be open), and you can then attach your IDE (Eclipse) to debug the application remotely:
Navigate to Run -> Debug Configurations
Create a new Remote Java Application configuration
In the Connect tab setup the run configurations including the Host and Port
From the Common tab, check the Debug option.
Apply and Run you configuration.
I want to set up breakpoints and remote debugging for a Jboss application in Intellij. From this blog post, I believe the first step is to run jboss in debug mode. I have Jboss 5.1.0.GA. so I don't have the same files (standalone.sh) as mentioned in How to start JBOSS 7 in debug mode?">this Stack Overflow which covers it for Jboss 7.
How do I do this for Jboss-5.1.0.GA? In run.conf, I see these two lines:
# Sample JPDA settings for remote socket debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
# Sample JPDA settings for shared memory debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,address=jboss,server=y,suspend=n"
Is all I need to do uncomment one of those? Then in Intellij what would be the corresponding settings? Here:
We have to do 2 changes to debug remote java application that is running in JBoss
Configure in JBoss
Creating remote debugger in in eclipse
Open run.conf.bat(windows) or run.conf(Linux) file in JBoss bin folder.
go to the below lines
`# Sample JPDA settings for remote socket debugging`
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
and remove hash in JAVA_OPTS
# Sample JPDA settings for remote socket debugging
JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
Restart the server if it is started.
2. In Eclipse, Run -> Debug configuration -> Remote Java Application and create a new.
Note that you have to give port that is mentioned in run.conf.bat file
I know this is an old post but just answering it speciffic to intelliJ IDE
Step 1
In the JBOSS start-up we add the below line
JPDA options. Uncomment and modify as appropriate to enable remote debugging.
set JAVA_OPTS=-classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n %JAVA_OPTS%
Step 2
Run JBoss with the above script
Step 3
In intelliJ under run/debug configuration add jboss like the screen grab below
Step 4
Start the JBoss config in debug mode by clicking on the debug icon.
How can I configure remote debugging in Eclipse with JBOSS server 4.x version?
So far,
Step1: I have modified the run.confg file. By uncommenting the below line. Sample JPDA settings for remote socket debugging:
JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
Step2 : Then I configured Eclipse in debug configurations. It's saying:
Failed to connect to remote VM. Connection refused.
What you are asking is not specific to either Java EE or JBoss 4.x - you can debug any Java process in case you specified the remote debugging runtime parameters when starting the JVM.
In your setting the -Xdebug parameter is missing, so your line would be:
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
Now it should be able to connect, in case you are using the correct host and your specified port 8787. In case it's still not working, it's most likely a firewall issue blocking the port.