Remote debugging with Eclipse

Hi, Im trying to debug my remote container running with Okteto in Eclipse and I don’t know how to do it.

Hello!

This are the steps to remote debugging with Eclipse.

Deploy your app in Okteto

You can use this example to test it: GitHub - okteto/microservices-demo: A sample application with Go, Java, Javascript, Kafka and Postgres

Once you have it locally, just run okteto up vote and wait until it deploys all the services and starts a dev session with your vote service.

You will see something like this in the logs: Listening for transport dt_socket at address: 5005
Which means that the container app is listening on that port.

If you check the okteto manifest in the repository, you will see for that service:

dev:
  vote:
    command: mvn spring-boot:run
    sync:
      - ./vote:/app
    forward:
    - 5005:5005

That means that okteto will open a connection between your local 5005 and the remote container 5005 port.

Now we just need to connect our Eclipse Debugger to that container!

Eclipse Configuration

Open the repository in your Eclipse IDE locally.

Go to Run → Debug Configurations → Remote Java Application

And create one as this example (notice that we are attaching the connection to a remote container listening on that port from your localhost in the port specified in the okteto manifest)

Now you can Right Click on the service you want to debug (for this example VOTE service).
Don’t forget to add your breakpoints :blush:

→ Debug Us → Debug Configurations → The one you created

Debugging

If everything goes well, now the you are connected to that remove JVM. You just need to hit the endpoint of the service so that the code stops where you added the breakpoint.

https://vote-{OKTETO_NAMESPACE}.{OKTETO_DOMAIN}

And you should see the Debug view of Eclipse:

Enjoy it!