2

I run Java appliaction on Ubuntu virtual machine with command:

java -showversion -server -Xmx512M -Drps.home=${RPS_HOME} \
-Dcontainer.host=${CONTAINER_HOST} \
-Djava.util.logging.config.file=4ドル \
-classpath ${RPS_LIBS} com.softel.rps.impl.core.SPEngine ${CONFIG} \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999

I opened port 9999 with command (an also forwarded port in VirtualBox):

sudo ufw allow 9999/tcp

And I try to attach debugger with IntelliJ IDEA: IDEA debug

And finally i end up with error

IOException "handshake failed - connection prematurally closed"

Im not very well experienced in remote debugging. Can you tell me is it possible to attach debugger to java -server process?

asked Jul 24, 2017 at 13:03
1
  • Yes, it's possible, see stackoverflow.com/a/42392922/104891. Verify with telnet that you can connect to the specified host/port, the issue may be with the configuration or your network settings. For instance, localhost on your screenshot looks suspicious since you are connecting to a different machine (VM). Unless you have port forwarding enabled from localhost to the VM, it will not work. Commented Jul 24, 2017 at 13:18

2 Answers 2

3

Try to specify -agentlib options before everything else:

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999
-showversion -server -Xmx512M -Drps.home=${RPS_HOME} \
-Dcontainer.host=${CONTAINER_HOST} \
-Djava.util.logging.config.file=4ドル \
-classpath ${RPS_LIBS} com.softel.rps.impl.core.SPEngine ${CONFIG}
answered Jul 25, 2017 at 15:58
Sign up to request clarification or add additional context in comments.

Comments

0

Start your application with the command below:

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar .\your_app.jar -showversion -server

and start a remote debugger from your idea (mine is the idea):

Edit Configuration > (+) add Remote JVM Debug with default option :)

enter image description here

FabioL
1,0097 silver badges23 bronze badges
answered May 24, 2023 at 12:28

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.