cancel
Showing results for 
Search instead for 
Did you mean: 

Java Cap remote debugging not working with Java 17

nuramon9999
Explorer
0 Kudos

Hello dear community,

Since our setup of our Java CAP application, we have ben able to remotely connect to our deployed application on the provider account following this and similar guides, like debugging instructions for SapMachine. Since we upgraded our Java version to Java 17, we have not been able to connect to our deployed application even with different variants in our manifest.yml.

This is our current manifest.yml (commented out are other attempts that did not resolve the issue):

Following the instructions in the SapMachine guide, in Step 2 we also had an error which we could not really identify and thus had to stop the process:
cf ssh javacap -c "export JAVA_PID=`ps -C java -o pid=` && app/META-INF/.sap_java_buildpack/sap_machine_jre/bin/jcmd $JAVA_PID VM.start_java_debugging"

-> /bin/bash: line 0: export: `2064': not a valid identifier


This is what our mta.yaml for the application we deploy looks like:

The observed behaviour is the following:

-> SSH is enabled

-> Connection through commandline is successful and behaves like we are used to:

> When we try to start the debugger and connect to the application through VS-Code the connection is being refused and the connection breaks:

additional info: here is our launch config to attach to the running ssh-connection:

This exact setup worked with our Java11 application and then somehow stopped working.

If there is any other information I can supply, please inform me.

Thank you in advance,

Pascal.

View Entire Topic
0 Kudos

Hi,

there should be no change regarding debugging in SapMachine 17. From what I see the problem stems from the "export JAVA_PID=`ps -C java -o pid=`" command. Can you check if just

cf ssh javacap -c "ps -C java -o pid="

returns more than one entry?

Best regards,

Ralf

nuramon9999
Explorer
0 Kudos

Hello Ralf,

When I run the command 'cf ssh javacap -c "ps -C java -o pid="', the response is ' 8 ' including a big spacing offset in front of the 8.
Thank you for your answer,

Pascal.

nuramon9999
Explorer
0 Kudos

Hello Ralf,

We still have not found a solution for the issue, is there any more feedback you can provide?

Best of wishes,

Pascal Ehrlich

christoffer_fuss
Participant
0 Kudos

Hi Pascal,

we have no problems with remote debugging with SapMachine 17. This is our config
mta.yaml

launch.json


Then I use those 2 commands:

cf ssh datatraincap-srv -c "export JAVA_PID=`ps -C java -o pid=` && app/META-INF/.sap_java_buildpack/sap_machine_jre/bin/jcmd $JAVA_PID VM.start_java_debugging"

and then:
cf ssh datatraincap-srv -N -T -L 8000:localhost:8000

If you are working on windows you have to use a normal terminal and no powershell.


This worked on java 11, 14 und 17.

Hope this helps,

Best regards,

Chris

0 Kudos

Hi,

since it seems the output of ps on your system causes the problem, you should split up the command. First call

cf ssh javacap -c "ps -C java -o pid="

to get the pid of the java process and then

cf ssh javacap -c "app/META-INF/.sap_java_buildpack/sap_machine_jre/bin/jcmd <pid> VM.start_java_debugging"

with <pid> being the pid of the java process. This should work.

Best regards,

Ralf