问题
I have exploded war file based on JSF in wildfly 10. I have multiple jar files with XHTML and CDI beans which are present inside the lib of exploded war. If I change the content in XHTML file present in source related to the jar present in lib means, the content needs to be reloaded without updating the jar file in lib folder and redeploying the war file.
How to achieve this functionality? This is already available in netbeans / eclipse IDE as "Copy static resources". But this is not working for the jar.
Environment: Server : Wildfly 10 project type: JSF maven
回答1:
I think the problem is that the resource you update is packaged in a jar located in the exploded wars WEB-INF/lib, whereby the whole jar needs to be replaced in WEB-INF/lib and wildfly needs to reload this jar.
Only resources in the exploded war can be updated, which means to replace the old resource with the modified one. This is an old issue with web-fragments lots of people have faced. We have solved it by implementing the web fragments with packaging war and using overlay in the main war, which copies all web-fragments content to that main war project, which are separated by unique namespaces.
I don't know if wildfly can be configured to reload library jars, if you achieve to redeploy a jar in WEB-INF/lib of the exploded war.
See the following discussions maybe you find more help:
Hot redeploy files in web fragment project in IntelliJ
https://developer.jboss.org/thread/252106
How to force jboss to load classes from jars in webapp's lib
https://www.protechtraining.com/bookshelf/jboss_admin_tutorial/class_loading?ncr=1
https://access.redhat.com/solutions/334963
来源:https://stackoverflow.com/questions/55371871/how-to-programmatically-hot-reload-static-resources-like-xhtml-in-wildfly-server