07-18-2018 04:26 AM
I have a test project in Eclipse generated with maven archetype (allinone option).
I followed some tutorial on webscript in alfresco platform.
The example work fine but unfortunately the hot reloading ( configuration) of freemarker template or javascripts file does not work.
Hot reload of regular java class, also work fine, but hot reload of other resource does not work.
I can see (in the console) the hotswap message:
message Watch event 'ENTRY_MODIFY'
but when I try to test non change I do not see any changes.
For every small change (except java changes), I am forced to perform the whole procedure
clean install -DskipTests = true alfresco: run
I would appreciate your suggestions to solve the problem before starting with a serious development project.
Thank you for your help!
Best regards.
07-18-2018 04:31 PM
I #solved the problem!. Follow the solution (for others with the same problem).
1. I followed Using HotSwapAgent | Alfresco Documentation
2. Setup a new AllInOne project whit eclipse
3. Check patch the JVM whith DCEVM (Quick Start | HotswapAgent ) but is ok
4. Setup in Eclipse a new Maven Build "Run Configuration" whith goal
clean package -DskipTests=true alfresco:run
VM arguments:
-Xms256m -Xmx2G -javaagent:[PATH_TO_HOTSWAP_AGENT]/hotswap-agent-1.0.jar -XXaltjvm=dcevm
In previous configuration I had used "hotswap-agent-core-1.3.0.jar" because the "hotswap-agent-1.3.0.jar" library did'nt work (a handful of exceptions after launch). I this case Alfresco doc. suggests to use 1.0 version of agent.
I think this was the main problem!
5. Create a new configuration file named "hotswap-agent.properties" in the folder $PLATFORM_PROJECT_FOLDER/src/main/resource whith only the following line
autoHotswap=true
6. Run the Maven Build (prepared before: step 4)
7. The All-In-One project contains an HelloWorld Web Script implemented in Java and JS. Point the browser to http://localhost:8080/alfresco/s/sample/helloworld and we can see messages from Java and from JS.
Now I can edit and hot-reload: Java class (HelloWorldWebScript), FreeMarker file (helloworld.get.html.ftl), Javascript file (helloworld.get.js).
When I save on eclipse the hot-reload happens immediately and I can see the changes on the browser !!
Thank you to Krutik for help.
07-18-2018 05:10 AM
As a temporary solution.
Refresh Webscript : http://localhost:8081/share/service/index //For share
Refresh Webscript : http://localhost:8080/alfresco/service/index //For alfresco repository
Clear Cache : http://localhost:8081/share/page/caches/report?clear=true //For share client side script...
I am also facing the same issue, but freemarker and javascript file are gettting hot reloaded on repository server.But facing same issues in share for freemarker and javascript file.
07-18-2018 07:15 AM
Thank you for the answer.
I tried your solution but nothing has changed.
I got the same results: I changed a freemarker string but on the browser I saw the old version of string. The same happens on javascript files.
I tried also to insert the <cache> section on the xml descriptor for the web script:
<webscript>
<shortname>Get all whitepapers</shortname>
<description>Returns a list of active whitepapers</description>
<url>/someco/whitepapers</url>
<url>/someco/whitepapers.json</url>
<url>/someco/whitepapers.html</url>
<format default="json">extension</format>
<authentication runas="admin">guest</authentication>
<transaction>none</transaction>
<cache>
<never>true</never>
<mustrevalidate/>
</cache>
</webscript>
I'm following the Jeff Potts's tutorial https://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html
Bye.
07-18-2018 08:14 AM
You need to hit refresh webscript button on bottom of URL...pt : http://localhost:8080/alfresco/service/index.....have you done that?
07-18-2018 08:48 AM
Explore our Alfresco products with the links below. Use labels to filter content by product module.