Remote Debugging of Openshift Application not working

Answered

Hello everybody, 

I'm trying to debug an application running on a remote openshift environment with Intellij Idea but I can't connect the debugger to the application. 

My Dockerfile exposes port 9009 as remote debug port. Therefore my Intellij Debug Config looks like this: 

My local machine and the remote container run JDK 1.8. I also enabled openshift port forwarding via the command line as follows: 

So the application is running in openshift, port forwarding is started and when I try to run the debug config from Intellij the last 4 lines above pop up at the port forwarding console and Intellij shows the following error message: 

After a lot of reading which gave varying hints I added several environment variables in openshift to be sure:

Has anyone an idea what might be the problem? If further information is needed, just tell me what's missing. 

I'm happy for every hint. 

 

Regards, 

Christoph

0
7 comments

Make sure that docker uses localhost and not its IP address (in 172.17.0.0/16 IP range) by executing "lsof" or "netstat" commands. Post the output here in case you think docker has been binded correctly. 

0
Avatar
Permanently deleted user

Thanks for your answer. I need to admit that I'm quite new to all of this, so where exactly should I execute these commands? The application is built and deployed by a jenkins pipeline automatically. So all the docker stuff is in the Jenkinsfile and the Dockerfile of the project. 

0

> where exactly should I execute these commands?

On the machine where docker daemon is started. Am I right that it is located on your local computer? 
You can execute the commands in command line, or in terminal (based on your OS)

0
Avatar
Permanently deleted user

I have a local Docker Desktop instance running, but that shouldn't have anything to do with the application in openshift or am I wrong? When I change some code and do a commit, the Jenkinspipeline is triggered and builds a new image on a remote jenkins server. After that the image is automatically pushed to openshift and a new deployment is triggered. This way the application is running more or less 24/7 and then I try to hook in with my debug config from my local machine, which fails. 

When I built and ran the application locally by hand without the Jenkinsfile (gradle build, docker build, docker-compose up) I've been able to debug the application with my remote debug config from Intellij. 

0

In case the application is running in openshift (remote server), please define host's IP/hostname in IntelliJ IDEA debug configuration. As I see, IntelliJ IDEA is trying to connect to the localhost (your local machine), but not to remote. 

0
Avatar
Permanently deleted user

The application is running on a remote server. The localhost variant should work because of the oc port-forwarding. If I use the following debug config: 

I get the following error: 

So I guess it's the same, just that I don't need the oc port-forwarding. 

I just tried to verify that my firewall requests have been implemented correctly (allow tcp for dtc-plausibilisierung-??????????? on ports 8080, 443 and 9009) by using nmap as follows:

The censored address is the one I can put in a browser to see the index.html of the service. Now I guess the problem is that port 9009 is closed, but I have no idea how to open it on my application in openshift. 

0
Avatar
Permanently deleted user

Adding the environment variable JAVA_TOOL_OPTIONS with the value "-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n" made it work. The other environment variables from above are obsolete...

0

Please sign in to leave a comment.