Liferay ext project在install war包之后需要重启服务器,重启服务器中会执行ExtHotDeployListener中的逻辑,这里有一个坑,如果是第二次以后install ext war包,会发现新修改的文件不起作用,原因如下

ExtHotDeployListener.java

protected void doInvokeDeploy(HotDeployEvent hotDeployEvent)
throws Exception { ServletContext servletContext = hotDeployEvent.getServletContext(); String servletContextName = servletContext.getServletContextName(); if (_log.isDebugEnabled()) {
_log.debug("Invoking deploy for " + servletContextName);
} String xml = HttpUtil.URLtoString(
servletContext.getResource(
"/WEB-INF/ext-" + servletContextName + ".xml")); if (xml == null) {
return;
} if (_log.isInfoEnabled()) {
_log.info(
"Registering extension environment for " + servletContextName);
} /*
* Ext 项目在重启tomcat的时候会checkd liferay-portal/tomcat-xxx/webapps/ROOT/WEB-INF/ext-project-***-ext.xml是否存在
* 如果存在,就不执行后面的逻辑,也就不会执行installExt(***),那么也不会重新拷贝替换的文件
*
*/
if (ExtRegistry.isRegistered(servletContextName)) {
if (_log.isInfoEnabled()) {
_log.info(
"Extension environment for " + servletContextName +
" has been applied.");
} return;
} Map<String, Set<String>> conflicts = ExtRegistry.getConflicts(
servletContext); if (!conflicts.isEmpty()) {
StringBundler sb = new StringBundler(); sb.append(
"Extension environment for " + servletContextName +
" cannot be applied because of detected conflicts:"); for (Map.Entry<String, Set<String>> entry : conflicts.entrySet()) {
String conflictServletContextName = entry.getKey();
Set<String> conflictFiles = entry.getValue(); sb.append("\n\t");
sb.append(conflictServletContextName);
sb.append(":"); for (String conflictFile : conflictFiles) {
sb.append("\n\t\t");
sb.append(conflictFile);
}
} _log.error(sb.toString()); return;
} installExt(servletContext, hotDeployEvent.getContextClassLoader()); FileAvailabilityUtil.reset(); if (_log.isInfoEnabled()) {
_log.info(
"Extension environment for " + servletContextName +
" has been applied. You must reboot the server and " +
"redeploy all other plugins.");
}
}

xxx-ext.xml格式如下


<ext-info>
<servlet-context-name>hsf-plugins-shared-ext</servlet-context-name>
<files>
<file>xxxx-ext.xml</file>
<file>ext-impl/classes/com/liferay/portal/action/xxx.class</file>
....
<file>ext-web/docroot/html/js/xxx.js</file>
<file>web.xml</file>
</files>
</ext-info>

解决方案

1>. 去除掉doInvokeDeploy中这段逻辑,不管是否包含ext-project-***-ext.xml都执行install


if (ExtRegistry.isRegistered(servletContextName)) {
if (_log.isInfoEnabled()) {
_log.info(
"Extension environment for " + servletContextName +
" has been applied.");
} return;
}

2>. 在第二次install ext project war包之后需要删除liferay-portal/tomcat-xxx/webapps/ROOT/WEB-INF/ext-project-***-ext.xml,然后重启tomcat

最新文章

  1. hive 调优总结
  2. 七牛云存储Python SDK使用教程 - 上传策略详解
  3. 手机App开发
  4. input内容改变触发事件,兼容IE
  5. webx学习笔记
  6. Sass中常用的函数
  7. 正经学C#_变量与其转换:《c#入门经典》
  8. iPad和iPhone开发的比较
  9. [Angular 2] Using ng-model for two-way binding
  10. 调用awk的三种方式
  11. 华为MAC Flapping , MAC的漂移
  12. UVa 10905 - Children&#39;s Game 排序,题目没有说输入是int 难度: 0
  13. Data URI scheme - 数据的uri模式
  14. 【SpringBoot系列2】SpringBoot整合Redis
  15. 使用XMing+putty运行linux图形界面程序
  16. Vxlan抓包
  17. lakala GradientBoostedTrees
  18. linux 测试网络延迟
  19. [UI] 精美UI界面欣赏[12]
  20. js跳出循环:break 、continue 、return

热门文章

  1. ffmpeg+HLS实现直播与回放
  2. Zeppelin的入门使用系列之创建新的Notebook(一)
  3. linux 下 安装mysql
  4. java不定参数列表---乔老师没讲,但是传智有讲
  5. CentOS 7 配置 http 服务器
  6. [原创]SQL表值函数:把用逗号分隔的字符串转换成表格数据
  7. php学习笔记-php中把浮点数转化为整数
  8. VCF文件处理工具PyVCF
  9. 在Eclipse里面配置Struts2
  10. jQuery :odd 选择