Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Attaching JProfiler to a java process in container is relatively easy. All that is required is to attach JProfiler agent to the process and expose the relevant port. This github gist pretty much covers it:

Snippet
urlhttps://gist.github.com/Kevin-Lee/cbfbde89d68299304b1b1a2e6371fe06
. Here's how our typical Dockerfile for the UI tests will look like with JProfiler setup:

Code Pro
languagebash
titleDockerfile with JProfiler agent
FROM tomcat:9.0.11-jre8

RUN wget http://download-aws.ej-technologies.com/jprofiler/jprofiler_linux_10_0_1.tar.gz -P /tmp/ && \
        tar -xzf /tmp/jprofiler_linux_10_0_1.tar.gz -C /usr/local &&\
        rm /tmp/jprofiler_linux_10_0_1.tar.gz

EXPOSE 8849

COPY ./magnolia-ee-integration-tests/tests/target/wars/ /usr/local/tomcat/webapps/

ENV CATALINA_OPTS="-Xmx2G -Dmagnolia.update.auto=true -agentpath:/usr/local/jprofiler10.0.1/bin/linux-x64/libjprofilerti.so=port=8849"

RUN touch /usr/local/tomcat/logs/build-log.out

RUN echo "done"


Note that for some reason in order to successfully attach JProfiler to the process, the container needs to be started with -p 8849:8849. \

...