SDK 4 hotswap-agent not working.

cancel
Showing results for 
Search instead for 
Did you mean: 
rohit9637
Established Member

SDK 4 hotswap-agent not working.

I have followed the https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/hot-reloading/hotswap-agen... for setting up hot reloading using hotswap-agent.

I am using the ACS 6.1 so followed the setup method for JAVA 11.

I have attached the logs.

5 Replies
abhinavmishra14
Advanced

Re: SDK 4 hotswap-agent not working.

Looking at your log, it looks like the error is because of : java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandler. 

From java9 onwards there are some changes for java.xml.bind. Check here, It says deprecated: https://docs.oracle.com/javase/9/docs/api/java.xml.bind-summary.html 

javax.xml.bind is sub package of Module java.xml.bind. So Module javax.xml.bind will not be available on classpath by default.

You are trying to use java11 here as i understand. There might be some custom code which could be causing this error : java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandler. 

 

See if jaxb-api is part of your classpath or not. Otherwise try to include it as a dependency. 

<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.3.0</version>
</dependency> 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
rohit9637
Established Member

Re: SDK 4 hotswap-agent not working.

Thanks, it was helpfull.

But still, hot reloading is not working with hotswapagent.

I am getting the following log.

HOTSWAP AGENT: 12:05:19.758 DEBUG (org.hotswap.agent.command.impl.SchedulerImpl) - Executing executeCommand: initClassLoader(org.mozilla.javascript.DefiningClassLoader@40b307a5)
alfresco | HOTSWAP AGENT: 12:05:19.839 DEBUG (org.hotswap.agent.util.classloader.ClassLoaderDefineClassPatcher) - Classloader org.mozilla.javascript.DefiningClassLoader@40b307a5 patched with plugin classes from agent classloader jdk.internal.loader.ClassLoaders$AppClassLoader@2cdf8d8a.
alfresco | HOTSWAP AGENT: 12:05:19.839 DEBUG (org.hotswap.agent.config.PluginConfiguration) - Classloader does not contain 'hotswap-agent.properties', using parent file 'jar:file:/usr/java/dcevm-11.0.1+7/lib/hotswap/hotswap-agent.jar!/hotswap-agent.properties'
alfresco | HOTSWAP AGENT: 12:05:19.839 DEBUG (org.hotswap.agent.annotation.handler.InitHandler) - Init plugin class org.hotswap.agent.plugin.watchResources.WatchResourcesPlugin at classloader org.mozilla.javascript.DefiningClassLoader@40b307a5.
alfresco | HOTSWAP AGENT: 12:05:19.839 DEBUG (org.hotswap.agent.plugin.watchResources.WatchResourcesPlugin) - Init plugin at classLoader org.mozilla.javascript.DefiningClassLoader@40b307a5
alfresco | HOTSWAP AGENT: 12:05:19.839 DEBUG (org.hotswap.agent.plugin.watchResources.WatchResourcesPlugin) - ClassLoader org.mozilla.javascript.DefiningClassLoader@40b307a5 does not contain hotswap-agent.properties file, WatchResources skipped.
alfresco | HOTSWAP AGENT: 12:05:19.839 DEBUG (org.hotswap.agent.annotation.handler.InitHandler) - Init plugin class org.hotswap.agent.plugin.hotswapper.HotswapperPlugin at classloader org.mozilla.javascript.DefiningClassLoader@40b307a5.
alfresco | HOTSWAP AGENT: 12:05:19.839 DEBUG (org.hotswap.agent.plugin.hotswapper.HotswapperPlugin) - Init plugin at classLoader org.mozilla.javascript.DefiningClassLoader@40b307a5
alfresco | HOTSWAP AGENT: 12:05:19.840 DEBUG (org.hotswap.agent.plugin.hotswapper.HotswapperPlugin) - ClassLoader org.mozilla.javascript.DefiningClassLoader@40b307a5 does not contain hotswap-agent.properties file, hotswapper skipped.
abhinavmishra14
Advanced

Re: SDK 4 hotswap-agent not working.

I have not followed each and every steps as mentioned in the link you have posted, but the debug message says:

Classloader does not contain 'hotswap-agent.properties', using parent file 'jar:file:/usr/java/dcevm-11.0.1+7/lib/hotswap/hotswap-agent.jar!/hotswap-agent.properties'

It seems the hotswap-agent.properties can not be found and that's why its not working. Please check the setup. 

On the other hand, i have setup a project using SDK4 which runs ACS6.1. I can make the changes in java classes and it loads properly. Refer the project: https://github.com/abhinavmishra14/acs6.x-aio-demo-community/archive/master.zip 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
rohit9637
Established Member

Re: SDK 4 hotswap-agent not working.

I have downloaded your project. Made changes to hello world webscript class. It didn't reflect even after refreshing webscript.

I have also made changes in the log statement in the same class still didn't reflect in logs.

abhinavmishra14
Advanced

Re: SDK 4 hotswap-agent not working.

Before uploading the project to github, i missed to add 'COPY' instructions in DockerFile. I have added it now.

Download the project again, or just add this line into acs6.x-aio-demo-community/acs6-aio-demo-project-platform-docker/src/main/docker/Dockerfile:

COPY hotswap-agent.properties $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes

https://github.com/abhinavmishra14/acs6.x-aio-demo-community

See some screenshots below where i tried making the changes and it reflects properly :

Initial Log:

Made changes to the webscript, updated the values and added additional logs:

See updated message:

Updated logs:

Note- Remember to start remote debugging

For remote debugging follow the instructions given here: https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/debugging/debug-eclipse.md

~Abhinav
(ACSCE, AWS SAA, Azure Admin)