I have used the ./run.sh script to spin up an instance of ACS with docker. I want to step through the code using the IDE Intellij. This works with the HelloWorldWebScriptIT which doesn't extend any classes. However, DemoComponentIT and CustomContentModelIT which extend AbstractAlfrescoIT seem to pass the tests without stopping at the breakpoints. Am I missing any configuration?
Solved! Go to Solution.
If you have generated your project structure using SDK4, then all the required DockerFiles would already be available.
All you need to do is, to add the below given line in your platform-docker project's DockerFile:
COPY hotswap-agent.properties $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes
After you made the changes and restarted the containers, you need to start remote debug. You should be able to put breakpoints.
For remote debugging follow the instructions given here:
Eclipse: https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/debugging/debug-eclipse.md
See this post, it was similar to your case: https://hub.alfresco.com/t5/alfresco-content-services-forum/sdk-4-hotswap-agent-not-working/m-p/1107...
Can you cross check the DockerFile in your platform-docker Artifact. See if hotswap-agent.properties is being copied to the containers.
"COPY hotswap-agent.properties $TOMCAT_DIR/webapps/share/WEB-INF/classes"
if you can't see above instruction in the DockerFile, then add it and try again.
I currently do not have it in DockerFile. I would like the capabilities of hotswapagent and tried to follow the guide https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/hot-reloading/hotswap-agen...
Configuring HotSwapAgent in the project (Java 8)
However, I got stuck at step 2 on this command:
cp linux_amd64_compiler2/product/libjvm.so /usr/java/default/jre/lib/amd64/server
cp: cannot create regular file ‘/usr/java/default/jre/lib/amd64/server’: No such file or directory
DockerFile contains:
# Hot reload - Hotswap agent
COPY hotswap-agent.properties $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes
# Download and Install the more capable DCEVM, which will allow more changes to classes, such as new methods
RUN mkdir -p dcevm \
&& curl -L -o dcevm/DCEVM-8u181-installer.jar "https://github.com/dcevm/dcevm/releases/download/light-jdk8u181%2B2/DCEVM-8u181-installer-build2.jar" \
&& cd dcevm \
&& jar -xvf DCEVM-8u181-installer.jar \
&& cp linux_amd64_compiler2/product/libjvm.so /usr/java/default/jre/lib/amd64/server
# Download HotSwap Agent - it is used in the Docker Compose file.
RUN cd /usr/local/tomcat \
&& mkdir -p hotswap-agent \
&& curl -L -o lib/hotswap-agent-1.3.0.jar "https://github.com/HotswapProjects/HotswapAgent/releases/download/RELEASE-1.3.0/hotswap-agent-1.3.0.jar"
docker-compose.yml contains:
alfresco-trap-acs:
image: alfresco-content-services-alfresco-trap:development
build:
dockerfile: ./Dockerfile
context: ../../../alfresco-trap-platform-docker/target
environment:
CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8888 -javaagent:/usr/local/tomcat/lib/hotswap-agent-1.3.0.jar"
command: ["catalina.sh", "run"]
ports:
- "${acs.port}:8080"
- "${acs.debug.port}:8888"
volumes:
- alfresco-trap-acs-volume:/usr/local/tomcat/alf_data
- ../../../alfresco-trap-platform/target/classes:/usr/local/tomcat/hotswap-agent/alfresco-trap-platform/target/classes
- ../../../alfresco-trap-integration-tests/target/test-classes:/usr/local/tomcat/hotswap-agent/alfresco-trap-integration-tests/target/test-classes
depends_on:
- alfresco-trap-postgres
If you have generated your project structure using SDK4, then all the required DockerFiles would already be available.
All you need to do is, to add the below given line in your platform-docker project's DockerFile:
COPY hotswap-agent.properties $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes
After you made the changes and restarted the containers, you need to start remote debug. You should be able to put breakpoints.
For remote debugging follow the instructions given here:
Eclipse: https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/debugging/debug-eclipse.md
See this post, it was similar to your case: https://hub.alfresco.com/t5/alfresco-content-services-forum/sdk-4-hotswap-agent-not-working/m-p/1107...
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.