Reputation: 113
I have a standalone java application deployed on IBM Bluemix as Cloud Foundry Java buildpack.
Is there a way to perform remote debugging on it in Eclipse?I could find only docs for remote debugging of Java Liberty buildpack applications.
Upvotes: 0
Views: 663
Reputation: 6885
The socket listen way mentioned in the other answer is certainly convenient, but expects you to have a public IP assigned to your debug machine(or you have to configure some port forwarding on your router). This might not always be possible.
So the another way to do it is enable debugging on your Java app and use ssh port forwarding to connect to the app instance. Following are the steps
JBP_CONFIG_DEBUG
with value {enabled: true}
and restarting the application.Set up the SSH tunnel for the debug framework via JDWP
cf ssh -N -T -L 8000:localhost:8000 <APP_NAME>
After the ssh tunnel is opened, you use the Socket Attach debug type from eclipse on localhost:8000
Prerequisites before cf ssh
: cf api
, cf login
, cf target
Upvotes: 2
Reputation: 1912
There are some instructions in the Java buildpack documentation at https://docs.cloudfoundry.org/buildpacks/java/java-tips.html#debugging
The debugger should now be running. If you switch to the Debug perspective, you should see your application listed in the Debug panel and it should say Waiting for vm to connect at port
.
Next, push your application to Cloud Foundry and instruct Cloud Foundry to connect to the debugger running on your local machine using the following instructions:
-agentlib:jdwp=transport=dt_socket,address=YOUR-IP-ADDRESS:YOUR-PORT
.Upon completion, you should see that your application has started and is now connected to the debugger running in your IDE. You can now add breakpoints and interrogate the application just as you would if it were running locally.
Upvotes: 1