Discussion:
Seeking help for a HotSwapAgent's Wicket plugin
Francesco Chicchiriccò
2018-07-13 14:53:06 UTC
Permalink
Hi all,
at Syncope we recently switched from JRebel to HotSwapAgent, mostly because the MyJRebel program has ended.
All works quite well for Java classes, but we do have issues with HTML and properties files (for Resource Bundles) used by Wicket.

Please consider that we do package our Wicket application as JAR with web-fragment [1], and HTML and properties files are kept under src/main/resources [2].

I have started building a Wicket plugin for HotSwapAgent following the instructions at [3] and the samples at [4]: the MyFaces plugin [5] looks promising, at least because it says that it's clearing out the Resource Bundle cache.

So my question is: assuming that HotSwapAgent correctly replaces the HTML and properties file in the classloader, how can I trigger Wicket to reload?

TIA
Regards.

[1] https://github.com/apache/syncope/tree/master/client/console
[2] https://github.com/apache/syncope/tree/master/client/console/src/main/resources/org/apache/syncope/client/console
[3] http://hotswapagent.org/mydoc_custom_plugins.html
[4] https://github.com/HotswapProjects/HotswapAgent/blob/master/README.md#java-frameworks-plugins
[5] https://github.com/HotswapProjects/HotswapAgent/blob/master/plugin/hotswap-agent-myfaces-plugin/src/main/java/org/hotswap/agent/plugin/myfaces/MyFacesPlugin.java

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Thomas Heigl
2018-07-13 16:50:16 UTC
Permalink
Hi Francesco,

I faced the same situation last week.

I wrote a Wicket plugin that clears the Localizer cache. It does not clear
the resource bundle cache because I use Spring's ReloadableResourceBundle,
but that should be very easy to add.

Configuration is a little more difficult than with JRebel. I had to add
src/main/resources as extraClasspath for some reason, to get it to reload
HTML and property files.

Here is a gist with my Wicket plugin and my working
hotswap-agent.properties:

https://gist.github.com/theigl/6ff4a505eac8f166b9bd079017884474

Best,

Thomas
Post by Francesco Chicchiriccò
Hi all,
at Syncope we recently switched from JRebel to HotSwapAgent, mostly
because the MyJRebel program has ended.
All works quite well for Java classes, but we do have issues with HTML and
properties files (for Resource Bundles) used by Wicket.
Please consider that we do package our Wicket application as JAR with
web-fragment [1], and HTML and properties files are kept under
src/main/resources [2].
I have started building a Wicket plugin for HotSwapAgent following the
instructions at [3] and the samples at [4]: the MyFaces plugin [5] looks
promising, at least because it says that it's clearing out the Resource
Bundle cache.
So my question is: assuming that HotSwapAgent correctly replaces the HTML
and properties file in the classloader, how can I trigger Wicket to reload?
TIA
Regards.
[1] https://github.com/apache/syncope/tree/master/client/console
[2] https://github.com/apache/syncope/tree/master/client/
console/src/main/resources/org/apache/syncope/client/console
[3] http://hotswapagent.org/mydoc_custom_plugins.html
[4] https://github.com/HotswapProjects/HotswapAgent/
blob/master/README.md#java-frameworks-plugins
[5] https://github.com/HotswapProjects/HotswapAgent/
blob/master/plugin/hotswap-agent-myfaces-plugin/src/main/
java/org/hotswap/agent/plugin/myfaces/MyFacesPlugin.java
---------------------------------------------------------------------
Francesco Chicchiriccò
2018-07-16 11:54:54 UTC
Permalink
Hi Thomas,
thanks for your reply.

I have taken your WicketPlugin, reworked it a bit and generated

https://gist.github.com/ilgrosso/c12fa371a5033de1e92b0a35115b6456

Unfortunately, it does not seem to work: once started Tomcat with hotswap-agent enabled, I can successfully reload Java classes, but changes to properties files just have no effect.

I have also been debugging the WicketPlugin class, and I can see that the Command is effectively invoked and completes with no exceptions.

What could I be missing? Also, do you have any idea why I don't get any change in HTML files reloaded? I have added my src/main/resources folder to extraClassPath as you did.

Maybe something missing in my WicketApplications' settings?

Thanks for your support.
Regards.
Post by Thomas Heigl
Hi Francesco,
I faced the same situation last week.
I wrote a Wicket plugin that clears the Localizer cache. It does not clear
the resource bundle cache because I use Spring's ReloadableResourceBundle,
but that should be very easy to add.
Configuration is a little more difficult than with JRebel. I had to add
src/main/resources as extraClasspath for some reason, to get it to reload
HTML and property files.
Here is a gist with my Wicket plugin and my working
https://gist.github.com/theigl/6ff4a505eac8f166b9bd079017884474
Best,
Thomas
Post by Francesco Chicchiriccò
Hi all,
at Syncope we recently switched from JRebel to HotSwapAgent, mostly
because the MyJRebel program has ended.
All works quite well for Java classes, but we do have issues with HTML and
properties files (for Resource Bundles) used by Wicket.
Please consider that we do package our Wicket application as JAR with
web-fragment [1], and HTML and properties files are kept under
src/main/resources [2].
I have started building a Wicket plugin for HotSwapAgent following the
instructions at [3] and the samples at [4]: the MyFaces plugin [5] looks
promising, at least because it says that it's clearing out the Resource
Bundle cache.
So my question is: assuming that HotSwapAgent correctly replaces the HTML
and properties file in the classloader, how can I trigger Wicket to reload?
TIA
Regards.
[1] https://github.com/apache/syncope/tree/master/client/console
[2] https://github.com/apache/syncope/tree/master/client/
console/src/main/resources/org/apache/syncope/client/console
[3] http://hotswapagent.org/mydoc_custom_plugins.html
[4] https://github.com/HotswapProjects/HotswapAgent/
blob/master/README.md#java-frameworks-plugins
[5] https://github.com/HotswapProjects/HotswapAgent/
blob/master/plugin/hotswap-agent-myfaces-plugin/src/main/
java/org/hotswap/agent/plugin/myfaces/MyFacesPlugin.java
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Thomas Heigl
2018-07-16 15:53:21 UTC
Permalink
Hi Francesco,

Do you have the appropriate Wicket settings enabled?

I'm using this configuration in development mode:

private static void initResourceSettings(WebApplication app) {
final ResourceSettings resourceSettings = app.getResourceSettings();
if (!isDeployment(app)) {
resourceSettings.setDefaultCacheDuration(Duration.seconds(0));
resourceSettings.setResourcePollFrequency(Duration.seconds(5));
}
}
Best,

Thomas
Hi Thomas,
thanks for your reply.
I have taken your WicketPlugin, reworked it a bit and generated
https://gist.github.com/ilgrosso/c12fa371a5033de1e92b0a35115b6456
Unfortunately, it does not seem to work: once started Tomcat with
hotswap-agent enabled, I can successfully reload Java classes, but changes
to properties files just have no effect.
I have also been debugging the WicketPlugin class, and I can see that the
Command is effectively invoked and completes with no exceptions.
What could I be missing? Also, do you have any idea why I don't get any
change in HTML files reloaded? I have added my src/main/resources folder to
extraClassPath as you did.
Maybe something missing in my WicketApplications' settings?
Thanks for your support.
Regards.
Post by Thomas Heigl
Hi Francesco,
I faced the same situation last week.
I wrote a Wicket plugin that clears the Localizer cache. It does not
clear
Post by Thomas Heigl
the resource bundle cache because I use Spring's
ReloadableResourceBundle,
Post by Thomas Heigl
but that should be very easy to add.
Configuration is a little more difficult than with JRebel. I had to add
src/main/resources as extraClasspath for some reason, to get it to reload
HTML and property files.
Here is a gist with my Wicket plugin and my working
https://gist.github.com/theigl/6ff4a505eac8f166b9bd079017884474
Best,
Thomas
On Fri, Jul 13, 2018 at 4:53 PM, Francesco Chicchiriccò <
Post by Francesco Chicchiriccò
Hi all,
at Syncope we recently switched from JRebel to HotSwapAgent, mostly
because the MyJRebel program has ended.
All works quite well for Java classes, but we do have issues with HTML
and
Post by Thomas Heigl
Post by Francesco Chicchiriccò
properties files (for Resource Bundles) used by Wicket.
Please consider that we do package our Wicket application as JAR with
web-fragment [1], and HTML and properties files are kept under
src/main/resources [2].
I have started building a Wicket plugin for HotSwapAgent following the
instructions at [3] and the samples at [4]: the MyFaces plugin [5]
looks
Post by Thomas Heigl
Post by Francesco Chicchiriccò
promising, at least because it says that it's clearing out the Resource
Bundle cache.
So my question is: assuming that HotSwapAgent correctly replaces the
HTML
Post by Thomas Heigl
Post by Francesco Chicchiriccò
and properties file in the classloader, how can I trigger Wicket to
reload?
Post by Thomas Heigl
Post by Francesco Chicchiriccò
TIA
Regards.
[1] https://github.com/apache/syncope/tree/master/client/console
[2] https://github.com/apache/syncope/tree/master/client/
console/src/main/resources/org/apache/syncope/client/console
[3] http://hotswapagent.org/mydoc_custom_plugins.html
[4] https://github.com/HotswapProjects/HotswapAgent/
blob/master/README.md#java-frameworks-plugins
[5] https://github.com/HotswapProjects/HotswapAgent/
blob/master/plugin/hotswap-agent-myfaces-plugin/src/main/
java/org/hotswap/agent/plugin/myfaces/MyFacesPlugin.java
---------------------------------------------------------------------
Loading...