Im trying to enable remote debugging for an eclipse plugin project, for the purpose of using IntelliJ IDEA as a debugger.
The steps I've taken so far:
Launch Eclipse.
Run -> Debug Configurations...
Create a new "Eclipse Application" (as to launch a local workspace which loads the plugin).
Add -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n to VM arguments.
Press the Debug button.
I get the following error:
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp
What steps should I be taking to get IntelliJ IDEA to be able to debug an Eclipse Plugin running in a runtime workspace?
Run -> Debug Configurations...
Add -Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend=n to VM arguments.
This is redundant. Using a debug configuration already starts the application with the eclipse debugger attached to the process. Start it as a run configuration instead if you want to enable debugging through a server socket.
You can then create an additional "remote java application" debug configuration to attach to that socket.
I would suggest you NOT try to launch the Eclipse app from within Eclipse.
Export the app to be a stand alone eclipse application.
Modify the eclipse.ini file and add the necessary debug parameters to the '-vmargs' entry.
Launch the stand alone app as you normally would.
Attach the development Eclipse instance to the test app as you would normally do for a remote debug.
Tomcat Configuration:->
By default remote debug happens at 8000 port.If you want to change this then go to catalina.bat file and update this line
set JPDA_ADDRESS=localhost:8000 to desired port no.
And you can also set this property in setenv.bat file. Generally this file is not there in tomcat so just create one batch file with name
setenv and write this line set JPDA_ADDRESS=localhost:8000.
Now go to bin directory then open command promt and write "catalina jpda start". It will make the tomcat run in debug mode. You can verify it
by seeing something like this "Listening for transport dt_socket at address: 8000"
1)Eclipse
Go to run->debug configuration->Remote Java Application->Click on new Launch configuration
And then fill the detials like project ,port(Give same port no as you have configured in tomcat), host(If you are using local you can give
local then apply and debug
I am using eclipse 2020.09 .
Eclipse remote debug img
2)Intellij Idea:
Go to Add configuration->click on +->and select remote jvm debug->Then give the same port no and name(any name) then apply.
Intellij Idea Remote Debug img
Related
I have a remote Linux server and an application on it which I need to debug. I start the .jar file through the terminal in Intellij with line:
sudo java -Dspring.profiles.active=test -Dspring.config.additional-location=file:/.../external.properties -Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar /.../JARFILE.jar
Jar file is started correctly, the application is working, but I cannot debug it remotely via IDEA with those settings: remote debugging configuration.
It throws an error saying "java.net.ConnectException: Connection timed out: connect." after a few seconds from I clicked the debug button.
What should I do?
You say that you are unable to connect to the JVM via a debugger.
I'd expect that the reason for this error is the fact that you are not launching the JVM with the correct input arguments so that it can run in debug mode.
The easiest fix for this issue would be to allow IntelliJ to run it for you with correct configuration.
You say that you want to deploy the app to a remote server and debug it from there. Why not use this functionality in IntelliJ, which will guarantee that correct flags are set.
I think this value address=*:5005 might be wrong, try running it with address=5005
I have a Java app that I'm attempting to debug inside of (because a particular error only happens when the app is run from inside Docker, which is fun), but I can't figure out how to get IntelliJ to attach for debugging.
I have the Docker Integration plugin installed, but when I go to run my container, the deploy log has a line that says Cannot retrieve debug connection: Debug port not specified. Google told me that I needed to add a debugPort entry to my workspace.xml file, but when I did that, my Run/Debug configuration complained that "Debug port forwarding not found". Clicking "Fix" resulted in a container_settings.json file being created, which IntelliJ immediately informed me wasn't supported in 2017.3+, and that i should use command line options instead. However, I have no idea what those command line options should be.
When I tried specifying the forwarding port in the Run/Debug configuration, the deploy log ended with Cannot retrieve debug connection: java.net.MalformedURLException: unknown protocol: unix, which makes no freaking sense.
Help!
You can even use dcevm / HotswapAgent in dockerized application and modify code/resorces without restart. Look at this project https://github.com/HotswapProjects/hotswap-docklands
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 am currently using intellij idea to code my project that I am working on, after creating of .jar file using OneJar command i deploy the .jar file on my linux server who address is something like 192.164.1.125.there I run the command sudo nohup java -jar fileName.jar & on server to start the jar file in the background and use the rest-client app to send rest calls to my .jar file.Whenever something goes wrong I can only see error message in nohup.out file and what I actually wanted is to debug my jar file using intellij idea i.e how can I debug my .jar running on 192.164.1.125 using intellijIdea running on my client machine.I know I have to use that EditConfigurations option in run menu of intellij and provide IP and Port, but how to do it exactly.
You can do the remote debugging on IntelliJ IDEA 2019.2 version very easily!
Click on "Run" -> "Edit Configurations"
Click on "+" and select "Remote"
Enter your remote IP and select source code folder path
Optional : change the name and port of your wish
Run your remote server jar with the command which is mentioned in the Command line arguments for remote JVM box .
something like this,
sudo nohup java "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8911" -jar fileName.jar &
You are all set. add the breakpoints and click on Debug symbol to debug your remote jar from local
You must run the remote "java -jar .." command in debug mode by adding the additional magic flags. You can then tell your local IntelliJ to create a new debug configuration targeting a remote application - IntelliJ provides the magic flags you need.
The help page for this feature is at https://www.jetbrains.com/idea/help/run-debug-configuration-remote.html
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.