Debugger failed to attach: handshake failed - received >GET /api/domai< - expected >JDWP-Handshake< - maven

I am trying to debug a basic Quarkus app by running the command ./mvnw compile quarkus:dev on IntelliJ (as stated in the Quarkus docs) and it seems to run ok (gives me the following message: Listening for transport dt_socket at address: 5005)
I can call the APIs on port 8080 and all fine but when I try to call the same API on port 5005 I get the following error Debugger failed to attach: handshake failed - received >GET /api/domai< - expected >JDWP-Handshake<.
I tried configuring a Remote Debug configuration as shown in the image but doesn't seem to work.
Does anyone know how to solve this?

One process can listen on multiple TCP/IP sockets for multiple things.
The debug port is the port 5005 where you attach the remote debugger to.
The API calls still need to go to port 8080, though. When you hit a breakpoint, you will see it in your debugger.

Related

ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter

I am trying to connect my application to Signoz. It only works when both application and Signoz are running in the same machine. If I pull the application in another machine, I am getting timed out error.
ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export spans. The request could not be executed. Full error message: connect timed out
My application is deployed in Wildfly so I have add the following JAVA_OPTS to the standalone.conf.bat
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:c:/signoz/opentelemetry-javaagent.jar -Dotel.metrics.exporter=none -Dotel.exporter.otlp.endpoint=http://MyOtherServer:4318 -Dotel.resource.attributes=""service.name=MyService"""
opentelemetry-javaagent by default expects gRPC protocol that is usualy listening on port 4317.
If your collector listens on 4318, it is otlp-http. That means you must also set
-Dotel.exporter.otlp.protocol=http/protobuf
Source: https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md#otlp-exporter-span-metric-and-log-exporters

How to debug remote spring boot appliaction in IntelliJ Ultimate with gradle project tool

I am new to IntelliJ and gradle and I want to debug my Spring boot application remotely , request is coming from UI and I need to debug the request ,
But not getting success , tried many thing followed JetBrain site and also tried to configure the debug setup.
but I m really getting frustrated, I guess I am not starting server in debug mode or doing something wrong.
Could anyone tell me how to set up the configuration in IntelliJ with Gradle Spring project?
getting error like:
Unable to open debugger port (localhost:8082): java.io.IOException "handshake failed - connection prematurally closed"
Edit: do I need to do anything else , my app is running on 8082 port no.
I am running my app normally as I do via cmd line ./gradlew bootRun
Unless you made some modifications to the Gradle build configuration (which I doubt being the case since you mentioned being new to Gradle), you should be able to start you application with a debugger attached to it using the --debug-jvm flag:
$ ./gradlew run --debug-jvm
and since you are using Spring Boot, you should rather use the bootRun task:
$ ./gradlew bootRun --debug-jvm
Once above command fired, your application will start and you should see below line in output:
Listening for transport dt_socket at address: 5005
stating that the JVM debugger is waiting for a client to attach on port 5005 which should be the same as your IntelliJ IDEA | Remote JVM Debug configuration port. Change the port from 8082 to 5005 for your Store_Debug configuration then click on the 🐛 icon and you should see a message stating that your debugger is attached:
Connected to the target VM, address: 'localhost:5005', transport: 'socket'

Jmeter plugin perfMon not listening to localhost

In jMeter, I have installed perfMon plugin that listens to 4444 port successfully. My application runs on localhost:8080. It seems when I give default http port as 8080 as per the attached image, api works fine but no graph for perfMon metric plugin. But when I give http default port as 4444, perfMon shows graph but API fails giving 404.
How can I run both my application in localhost:8080 and listen to same port using server agent/ perfMon agent (which runs on 4444 port)?
FYI. I need to monitor the tomcat server(where my tested application resides).For that I have installed server-agent in my tomcat server.Edited jmeter.properties like below: remote_hosts=localhost:4444
I am running my application in tomcat of docker container and I have installed perfMon server agent locally at my system /opt directory. Does it has to installed somewhere specific directory ?
In server agent console, I am getting error
ERROR 2018-03-09 13:25:19.126 [kg.apc.p] (): Error getting metric
org.hyperic.sigar.SigarException: No such process: 728
at org.hyperic.sigar.SigarProxyCache.invoke(SigarProxyCache.java:220)
at com.sun.proxy.$Proxy0.getProcCpu(Unknown Source)
at kg.apc.perfmon.metrics.CPUProcMetric.getValue(CPUProcMetric.java:35)
at kg.apc.perfmon.PerfMonMetricGetter.getMetricsLine(PerfMonMetricGetter.java:114)
at kg.apc.perfmon.PerfMonWorker.processSenders(PerfMonWorker.java:280)
at kg.apc.perfmon.PerfMonWorker.run(PerfMonWorker.java:243)
at java.lang.Thread.run(Thread.java:748)
as I have set the pid in metric parameter as follows(my tomcat pid =728 in docker)
every time after hitting API in jMeter, it is saying client disconnted
I got the solution. When it says "client disconnected", it is not an error, it is info. I forgot to change pid in metric parameter whenever I run the server.

Getting NettyTcpClient connection error with Spring WebSocket with amqp broker (rabbitmq) while running in docker

I am trying to use the rabbitmq as the StompBroker in the WebSocketConfig. Have added the dependencies reactor-core and reactor-net
It works fine when starting up locally (localhost) but when I try to start the project as a docker container (rabbitmq image is correctly built with STOMP plugin), I get below error.
r.io.net.impl.netty.tcp.NettyTcpClient : Failed to connect to /127.0.0.1:61613. Attempting reconnect in 5000ms
I tried setting the setRelayHost("rabbitmq") and setRelayPort(61613) (since rabbitmq is the service name in the docker compose, using it to resolve the host name). No luck still.

Impossible to run web application in debug mode with intelliJ on ubuntu with glassfish server

In intelliJ 12.0 on ubuntu 12.04 with glassfish 3.1.2.2, I'm trying to launch my web application in debug mode but I've got this error message:
Error starting domain domain1.
The server exited prematurely with exit code 134.
Before it died, it produced the following output:
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:741]
I try to change the port 9009 in the domain.xml by another one but it was unsuccessful.
Could you help me to fix this problem?
Thank you
I had this same problem too a few weeks ago. I dont remember 100% what I changed but I know it has to do with the file $GLASSFISH_HOME/glassfish/domains/domain1/config/domain.xml. If I recall I think I changed the following line:
<java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=9009" system-classpath="" classpath-suffix="">
In particular server and suspend flags. When I set them like this the error you described above went away.
I had the same problem, and was because the debug port 9009 had beeen occupied by the DbVisualizer application. DbVisualizer uses some random ports, and at this time, it chosed the 9009. In my case, I only had to close DbVisualizer and GlassFish started up in debug mode fine.
So, check out no processes have occupied your Glassfish debug port.
Another possible solution is to change this port, or use shared memory.
Regards
In recent versions of IntelliJ the application is aware of invalid settings for debug mode. If this is the case, when you open the Run/Debug configuration of your Java EE server, in the bottom you will see a warning message:
Just press the fix button and you will fix your 'domain.xml' configuration file.
This is also explained in this tutorial: https://www.jetbrains.com/help/idea/2016.1/developing-a-java-ee-application.html
For the future poor soul that has the same issue as me:
One of the tools that comes with Gigabyte mainboards (gCloud I believe) registers a Windows service on port 9009. This port then shows up in netstat -ano as being in use by PID 4 (Windows system something).

Resources