I configure launch.json to launch Java debugger and working successfully. After a short while, I see error ERROR: transport error 202: recv error: Connection reset by peer. I did google it, and it was suggested to change the debug argument from:
-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:52252
to:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:52252
The debug arguments above are auto generated by vscode. How I can change it? I didn't find a way to configure such argument. The only option is to configure a task to run the command, and configure a debug option to run the task to launch the debugger and attached to that debugger session.
I am checking if there is a way to change the part to server=y as it is much easier.
Stack Overflow seems to have these answers. I never tested them myself though.
How to set java vmargs in vscode at workspace level
vsCode java.test.config vmArgs not working
Thanks to your mention, there is an article with a lot of details to configure a launch request with a preLaunchTask task configuration at https://github.com/microsoft/vscode-java-debug/blob/388c842bcc854a9e2f7f1e8fc5aa9520cb7fecf6/Configuration.md#attach-to-a-debuggee
If it helps, one of the SO questions, and a comment here, has a link to the VSCode configuration reference, https://code.visualstudio.com/docs/java/java-debugging#_attach . There you can see the attach request options.
My understanding of the attach vs launch is that
launch runs your App, and then automatically attaches a debugger to it.
attach is used only in cases where you have an already running JVM, lets say on some remote server, and you want to debug it.
How are you running starting your JVM? My guess would be that if you are starting the JVM from terminal, then put the server=y option there. If you want the VSCode to run the JVM, which I assume is the case, then the launch request is what you want.
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'm trying debug servlet class in aem. But i got problem, breakpoint I check is not working.
Can you please help me in this case ?
Thanks all!
Are you sure the doCode() method is being called? Is the log line getting printed?
If yes, it might be possible that you have skipped all breakpoints by going to Run -> Skip all breakpoints
Still doesn't work? Try to build again. If build automatically is turned off, classes may not be refreshed. Code being executed could be different.
To start an AEM instance in debug mode, you usually have to append (according to Adobe documentation)-
-Xmx512m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
Your start command should then look something like this-
java -Xmx4096m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar <name-of-jar>.jar
In case the debugger is not working, there could be 2 common reasons (and maybe more!)-
-Xmx - the value might be too low. Increase it to a higher value. I usually use -Xmx4096m to assign 4GB of memory to my AEM instance.
You've probably skipped all breakpoints. Just go to the debug window in your IDE (Eclipse or IntelliJ) and make sure "Skip all breakpoints" is not active
In case the debugger does not connect, then please check the port. The debug configuration port should match the address=8000 in the start command.
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
I am using Eclipse plugin "IBM Worklight Developer Edition".
I am trying to debug the adapter procedure code. For that I tried to do some debug configurations but it said Server already running(debug button disabled). So I stopped the server then again tried debug configuration, this time the button was enabled but on console I got "ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options."
Please help me to do debug configuration.
You must start the server using the "Run" button instead of "Debug". You have set jdwp option in launch configurations and hit "Debug", while hitting "Debug" sets another jdwp option, so you get that error.
It would great if you could edit your question and supply more information...
Worklight version
Java or JS?
The full error exception and trace
What is the problem you are trying to debug?
If you are trying to debug Java in your adapters, you can follow the instructions in this video:
https://www.youtube.com/watch?v=UJnDqRbBFFU
If you are trying to debug JavaScript in your adapters, you can review the answer in this question:
IBM Worklight 6.0 - How to enable/view WL.Logger.debug in adapters?
this is pretty straightforward. you have the same argument twice somewhere in your vm arguments. Try referring to this post: ERROR: Cannot load this JVM TI agent twice starting Oracle WebLogic Server 12.1.3.0
I had following errors in my Intellij Idea when debugging
I Was able to fix it by unchecking the below mentioned "Pass environment variables" option in debug configuration "Startup/Connection" tab
set JPDA_ENABLE=0 in your start script
I ran into the same problem using IBM WebSphere Server 8.5 integrated into Intellij IDEA Ultimate v2022.1.3. I solved it by going to change the server settings from the WAS console. In fact, by default the server enables debugging service at server startup. To solve it, just check the relevant item.
Go to: Server > WebSphere Application Server > yourServer
Under the configuration tab, click on 'Debug service', and remove the check from 'Enable service at server startup' as shown in the following image. Uncheck 'Enable Service at server startup'
Make sure to save your changes
Disable the service during server startup
Try this instead: use run command to launch program