How to setup remote debug on initialization? - intellij-idea

I'm trying to set up a remote debug properly. I have already set a remote debug and it works, but it not working on an application initialization stage, which means I can not see how a cache fills and so on.
My environment: Payara 4 (it is Glassfish) and IntelliJ IDEA Community Edition.
How to make a correct setup?

You can suspend the JVM on remote debugging by using suspend=y which make the JVM to wait until the remote debugger is attached.
So the debugger's JVM options will be as below
Java 5-8
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
Java 9 and later
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
Note: Adjust the port based on your settings.

Related

IntelliJ Remote debugger connects successfully but doesn't stop

I'm trying to do a remote debug on IntelliJ. I have my remote debug setup using this command in IntelliJ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=40779 Currently when I hit local server with port 40779 and I check the logs I see that logging works so the code does execute. I set the breakpoint at the log just for sanity check to make sure that it would suspend at the point however it doesn't. I'm currently using Intellij 2020.2. I tried upgrading to Intellij 2020.3 and also the latest version 2021.1. I also tried invalidating the cache/restarting and also removing/adding all my breakpoints again.
The files I'm setting the breakpoints are Kotlin files and my Kotlin plugin version 203-1.5.0-release-759-IJ7717.8. I can also successfully run debug and connect to remote server Connected to the target VM, address: 'localhost:40779', transport: 'socket' but when I make a request to that server, the breakpoints don't stop.

JProfiler doesn't detect running AdoptOpenJDK 11 openJ9

I'm trying to profile a Java app running with AdoptOpenJDK 11 version OpenJ9.
My problem is that, when I try to attach JProfiler on my app, it doesn't detect the running instance.
I'm using the last version of JProfiler (11.1.4).
Is it compatible with this JRE?
Is there something to do/configure to make it working?
Best regards
As of JProfiler 11.0, attach mode is not supported for OpenJ9 JVMs. Also, attach mode is not enabled by default for OpenJ9.
When passing the -agentpath VM parameter as given by the integration wizards, profiling OpenJ9 JVMs is fully supported.

How to debug custom mule 4 SDK connector?

I have a custom mule 4 SDK connector, I want to debug runtime and design time.
Just connect a Java debugger to the JVM. The connector is Java code.
To debug runtime:
Go to your Anypoint Studio, open "Run Configurations", select your Mule project from "Mule Applications" on the left (you need to run it at least once for it to appear here). Then in the "Arguments" tab add to the VM arguments: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 - this will enable to attach to your debugger from the IDE you use for SDK development.
In your IDE add a debug config with connection type "Socket Attach", provide host (localhost) and port (1044).
Now you can set breakpoints in your IDE then start the Mule project in Anypoint Studio. When it is at the point of launching the runtime JVM (watch the Console) it will stop and wait for you to start the debug config set above and execution shall hit your breakpoints.
To debug design-time:
Go to where you installed Anypoint Studio, find AnypointStudio.ini
Add following contents after the -vm plugins line:
-vmargs
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8888
also uncomment following two lines near the end, so they look like this:
#To_debug_the_mule_instance_uncomment_the_following_line
-Dmule.tooling.debug=true
#To_specify_the_debug_port_for_the_design_time_mule._E.g._To_debug_connectors_code_at_design_time.
-Dmule.toolingInstance.debugPort=8000
In your IDE create two "Socket Attach" type debug config, for localhost and ports 8888 and 8000.
Start Anypoint Studio. It will wait for you to start the debug config for port 8888, then it will come up. A minute later start the debug config for port 8000 - this is the one attaching to the design-time JVM. You can watch the threads starting in the Debug perspective of your IDE.
Just select Connect Java Debugger checkbox in Window -> Preferences -> Anypoint Studio -> Debugger

Can I debug annotation processor using IntelliJ Idea-community edition?

I followed pretty much everything in this blog to debug my annotation processor. However, I'm not able to attach the debugger I'm getting the below error.
Unable to open debugger port (localhost:5005): java.net.ConnectException "Connection refused (Connection refused)"
Is it really possible to debug annotation processer using community edition or does it requires licenced version?
Remote Debug configuration
Here is my configuration
I have debug Build process set to on.

How to start WebLogic in profiling mode?

No information found for this. Is there any way to start weblogic in profiling mode? Or, maybe, it's activated by default?
Profiling action can be initiated 2 ways
1) Pass the profiling action while you execute the startWeblogic.sh. Following parameters can be appended
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
2) The same parameters can be appended from startup tab in weblogic server
Here's what i got. Mainly focused on remote profiling using NetBeans
generated remote profiling package for target OS and JVM architecture (32 or 64 bit) (Netbeans -> Profile -> Attach Profiler -> Change link, select OS and Java platform -> click "Create a remote profiling package" link)
copy this package to target machine
execute calibration script (calibrate.bat / calibrate.sh (chmod +x))
add specific argument to java_otps with path to this package
-agentpath:PathToProfilerPackage\lib\deployed\jdk16\windows-amd64\profilerinterface.dll=PathToProfilerPackage\lib,5140
restart weblogic. Startup will be interrupted until remote profiler connected
connect to a server using NetBeans profiler. Weblogic startup will continue.
However, i still can't download heap dump (which is available when attaching to local java.exe Weblogic process) but that's something.