In a Hybris
developement environement, we are looking for reducing the Hybris
server (Tomcat
) restarts after each classes modification,
Beside the known tools available (JRebel
, HotswapAgent
,...), we are trying to use the tomcat
server's default class/webapp reloading mechanism : reloadable="true"
It's working like a charm when making some changes on classes under the extention webroot
folder,
But it's not the case when the changes are made under the [Extention]/classes
folder.
So the question is :
Is it possible to make hybris server (tomcat) aware of changes on [Extention]/classes folder, and reload the corresponding webapp ? knowing that hybris
has its own ClassLoading mechanism !
Environment :
Hybris 5.4
Tomcat 7.0
JDK 1.8
Best regards
--------EDIT 1-------
The build tool :
We are using only the ant
commands to build/clean... the project,
The IDEs
(eclipse, intelliJ...) are only used for editing the source code.
The folder hierarchy :
[HybrisFolder]
|__bin
|__platform
|__custom
|__[ExtentionFolder]
|__classes
|__web
|__webroot
|__WEB-INF
|__classes
Tryed solutions (that didn't work)
Add the [ExtentionFolder]/classes
folder as watched ressource in tomcat :
- First option :
Add it as a WatchedResource in the webapp context :
<Context reloadable="true" path="[ExtentionName]" docBase="[ExtentionFolder]/web/webroot">
<Manager pathname="" />
<Loader platformHome="[PlatformFolder]" className="de.hybris.tomcat.HybrisWebappLoader" deployName="default" />
<WatchedResource>[ExtentionFolder]/classes</WatchedResource>
</Context>
==> It's not working
- Second option :
Add it as an ExtraResource in the webapp context :
<Context reloadable="true" path="[ExtentionName]" docBase="[ExtentionFolder]/web/webroot">
<Manager pathname="" />
<Loader platformHome="[PlatformFolder]" className="de.hybris.tomcat.HybrisWebappLoader" deployName="default" />
<Resources className="org.apache.naming.resources.VirtualDirContext" extraResourcePaths="/WEB-INF/classes=[ExtentionFolder]/classes"/>
</Context>
==> I get a weird error, like it was a double loading of the same class (the first loading was done by the PlatformInPlaceClassLoader of Hybris, and the second loading by tomcat)
Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException:
Bean named 'myBean' must be of type [x.y.z.DefaultMyBean], but was actually of type [x.y.z.DefaultMyBean]