A sample app for debugging Java code using Dynatrace
For the simplest setup, use with GitHub codespaces. Docker in Docker is configured so the Java application can be started within the codespace. Port 8080 is exposed in order to access the application from your local machine. The steps below follow the guide for deploying OneAgent with application only monitoring
- Clone the sample app from this repository or spin up an environment using codespaces:
git clone https://github.com/jhendrick/tutorial-java-workshop.git
cd tutorial-java-workshop
Note, even if you use codespaces, you will need to clone the repository locally in order to connect the source code repo later in the live debugger.
- Update the Dockerfile with your Dynatrace environment URL and custom label
For example: <environmentURL> could be {environmentID}.live.dynatrace.com
ENV DT_LIVEDEBUGGER_LABELS=name:value
- Sign in to Docker with your Dynatrace environment ID as username.
docker login <environmentURL> -u <environmentID>
-
Enter your <PAAS_TOKEN> when prompted.
-
Build and run the app
docker build -t tutorial-java-workshop .
docker run -p 8080:8080 tutorial-java-workshop
-
Open the app at http://localhost:8080
-
You can set a breakpoint in TodoController.java on line 32 or anywhere in the addTodo() function