0

Hybris开发环境中,我们正在寻找在每次修改类后减少Hybris服务器( )重新启动,Tomcat

除了可用的已知工具(JRebel, HotswapAgent,...),我们正在尝试使用tomcat服务器的默认类/webapp 重新加载机制:reloadable="true"

extention webroot对文件夹下的类进行一些更改时,它就像一个魅力,

[Extention]/classes但在文件夹下进行更改时并非如此。

所以问题是:

是否可以让 hybris 服务器(tomcat)知道 [Extention]/classes 文件夹的更改,并重新加载相应的 webapp ?知道hybris有自己的ClassLoading机制!

Environment :
Hybris 5.4
Tomcat 7.0
JDK 1.8

此致


--------编辑 1--------

构建工具:

我们只使用ant命令来构建/清理......项目,IDEs(eclipse,intelliJ......)仅用于编辑源代码。

文件夹层次结构:

 [HybrisFolder]
          |__bin
              |__platform
              |__custom
                  |__[ExtentionFolder]
                       |__classes
                       |__web
                           |__webroot
                               |__WEB-INF
                                   |__classes

尝试过的解决方案(不起作用)

[ExtentionFolder]/classes在 tomcat 中添加文件夹作为监视的资源:

  • 第一个选项:

在 webapp 上下文中将其添加为 WatchedResource :

<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>

==> 它不工作

  • 第二种选择:

在 webapp 上下文中将其添加为 ExtraResource :

<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>

==> 我得到一个奇怪的错误,就像它是同一个类的双重加载(第一次加载是由Hybris的PlatformInPlaceClassLoader完成的,第二次加载是由 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]
4

0 回答 0