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.
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.
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.
I am attempting to Debug a simple Java Server Application hosted on localhost on any given port. Within Eclipse I run it in debug mode to wait on an incoming connection. When I run my a browser to retrieve data from the server I get nothing. If I run the Application outside of Eclipse, everything is fine and my pages are served.
Is there anything I need to do in Eclipse to enable ports or anything?
I saw this post:
How does Eclipse debug code in an application server?
but that is only informational. Any help would be great.
To debug applications that run on another JVM or even on another machine, start them with these flags:
java -Xdebug -Xnoagent \
-Djava.compiler=NONE \
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
Enter the hostname and port to connect for debugging:
Run → Debug Configuration... menu
Create a new debug configuration of the Remote Java Application type.
This configuration allows you to enter the hostname and port for the connection.
Eclipse Settings:
1.Click the Run Button
2.Select the Debug Configurations
3.Select the “Remote Java Application”
4.New Configuration
a) Name : GatewayPortalProject
b) Project : GatewayPortal-portlet
c) Connection Type: Socket Attach
d) Connection Properties:
i) localhost ii) 8787
For JBoss:
1.Change the /path/toJboss/jboss-eap-6.1/bin/standalone.conf in your vm as follows:
Uncomment the following line by removing the #:
JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"
For Tomcat :
In catalina.bat file :
Step 1:
CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
Step 2:
JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
Step 3: Run Tomcat from command prompt like below:
catalina.sh jpda start
Then you need to set breakpoints in the Java classes you desire to debug.
Hope this helps.
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.
I configured the debug configurations for remote debugging my maven project. I set the host as localhost and the port as 7000. I even ran the following command as the launch was not working:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=7000,suspend=n
However it is still not launching the remote VM and I cannot proceed with my debugging.
It gives the same error as:
Failed to connect to remote VM.Connection refused.
How should I proceed with solving this problem ?
you can issue the follwoing command from command prompt. mvnDebug jetty:run-exploded antrun:run Then you wil come to know on which port your jetty is listening to after that go to run->debug configuration from there you can debug your server.
In debug configuration you can find the option Remote Java Application here create one new debug configuration for new Remote java Application and also here you can define your new server
again mvnDebug jetty:run-exploded now you should see your new port.