Tomcat 迁移 至 weblogic部署war包,log4j问题 完整版
来源:互联网 发布:ubuntu 打印机 编辑:程序博客网 时间:2024/05/18 00:26
一、异常场景:
发布war包到tomcat,jetty中正常部署,war包解压后用weblogic部署正常,war包直接在weblogic上部署异常:
Cannot set web app root system property when WAR file is not expanded
激活更改期间出错, 有关详细信息, 请查看日志。
消息图标 - 错误 java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter:
class path resource [log4j.properties] cannot be resolved to absolute file path
because it does not reside in the file system:zip:
/home/oracle/domain/servers/AdminServer/tmp/_WL_user/teenagers-report/9dj5sc/war/WEB-INF/lib/_wl_cls_gen.jar!/log4j.properties
消息图标 - 错误 Invalid 'log4jConfigLocation' parameter: class path resource [log4j.properties]
cannot be resolved to absolute file path because it does not reside in the file system:
zip:/home/oracle/domain/servers/AdminServer/tmp/_WL_user/teenagers-report/9dj5sc/war/WEB-INF/lib/_wl_cls_gen.jar!/log4j.properties
web.xml配置以及log4j位置:
<!-- 如果是部署到Weblogic 则需要注释,因为Weblogic本身就支持log4J -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>6000</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
二、原因搜集:
weblogic自身对log4j支持,在war部署时候,与org.springframework.web.util.Log4jConfigListener冲突
解决方案如下:
第一步:注释如下配置:
<!-- 如果是部署到Weblogic 则需要注释,因为Weblogic本身就支持log4J -->
<!--
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>6000</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
-->
第二步 在web-inf下面建一个名为:weblogic.xml的文件,文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
<session-descriptor>
<cookie-path>/</cookie-path>
</session-descriptor>
<jsp-descriptor>
<keepgenerated>true</keepgenerated>
<page-check-seconds>60</page-check-seconds>
<precompile>true</precompile>
<precompile-continue>true</precompile-continue>
</jsp-descriptor>
<container-descriptor>
<optimistic-serialization>true</optimistic-serialization>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
<prefer-application-packages>
<package-name>org.slf4j</package-name>
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>
参考文档1
参考文档2
发布war包到tomcat,jetty中正常部署,war包解压后用weblogic部署正常,war包直接在weblogic上部署异常:
Cannot set web app root system property when WAR file is not expanded
激活更改期间出错, 有关详细信息, 请查看日志。
消息图标 - 错误 java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter:
class path resource [log4j.properties] cannot be resolved to absolute file path
because it does not reside in the file system:zip:
/home/oracle/domain/servers/AdminServer/tmp/_WL_user/teenagers-report/9dj5sc/war/WEB-INF/lib/_wl_cls_gen.jar!/log4j.properties
消息图标 - 错误 Invalid 'log4jConfigLocation' parameter: class path resource [log4j.properties]
cannot be resolved to absolute file path because it does not reside in the file system:
zip:/home/oracle/domain/servers/AdminServer/tmp/_WL_user/teenagers-report/9dj5sc/war/WEB-INF/lib/_wl_cls_gen.jar!/log4j.properties
web.xml配置以及log4j位置:
<!-- 如果是部署到Weblogic 则需要注释,因为Weblogic本身就支持log4J -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>6000</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
二、原因搜集:
weblogic自身对log4j支持,在war部署时候,与org.springframework.web.util.Log4jConfigListener冲突
解决方案如下:
第一步:注释如下配置:
<!-- 如果是部署到Weblogic 则需要注释,因为Weblogic本身就支持log4J -->
<!--
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>6000</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
-->
第二步 在web-inf下面建一个名为:weblogic.xml的文件,文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
<session-descriptor>
<cookie-path>/</cookie-path>
</session-descriptor>
<jsp-descriptor>
<keepgenerated>true</keepgenerated>
<page-check-seconds>60</page-check-seconds>
<precompile>true</precompile>
<precompile-continue>true</precompile-continue>
</jsp-descriptor>
<container-descriptor>
<optimistic-serialization>true</optimistic-serialization>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
<prefer-application-packages>
<package-name>org.slf4j</package-name>
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>
参考文档1
参考文档2
0 0
- Tomcat 迁移 至 weblogic部署war包,log4j问题 完整版
- ant 部署war包到tomcat,weblogic服务器上
- ant 部署war包到tomcat,weblogic服务器上
- WebLogic下部署war包
- WebLogic下部署war包
- WebLogic下部署war包
- Tomcat 部署war包
- Tomcat 部署War包
- tomcat部署war包
- weblogic在现有domain下部署war包问题
- Weblogic war包部署时获取Web根目录问题
- weblogic部署WAR的问题
- Tomcat下部署war包
- tomcat下部署war包
- war包部署到tomcat
- 部署war包到tomcat
- tomcat快速部署war包
- tomcat中部署war包
- 高德地图在angularJS中的InfoWindow动态添加按钮
- 第7章 理解Linux文件权限
- linux shell 技巧
- POJ 3526 The Teacher’s Side of Math 已翻译
- Android RxJava使用介绍(三) RxJava的操作符
- Tomcat 迁移 至 weblogic部署war包,log4j问题 完整版
- 排序二叉树
- 大数据平台Lambda架构浅析(全量计算+增量计算)
- LeetCode - 263. Ugly Number
- Android RxJava使用介绍(四) RxJava的操作符
- 使用Angular2与WebApi开发SPA类型的企业应用 - Part 1- 概览
- 2016 NOIP第三题 海港
- VC++ 无法将“char *”转换为“const wchar_t *const”
- hadoop学习之Mapreduce(2.4.1):写mapreduce程序时编写自己的writable类