---
title: "weblogic部署出现包冲突的解决办法"
author: "luowei31"
date: "2012-01-02T11:32:34Z"
tags: []
categories: ["编程语言"]
slug: "weblogic"
draft: false
lastmod: "2012-01-02T11:33:02Z"
id: 1333141
url: "https://luowei31.iteye.com/blog/1333141"
---

由于有些客户在同一个server里部署多个应用，各个应用使用的jar包版本有所不同或者公共weblogic包里有不同版本的jar或其他原因，造成在部署我们的应用时，包冲突，导致部署失败；为了避免包冲突，可以通过配置，使得web应用启动时类装载采用从web-inf开始装载，具体方法是：通过对weblogic.xml添加如下参数实现，同时需要增加相应的必需包，例如xalan.jar 和xerces-2.6.2.jar（除非应用本身的lib里已包含），以保证系统能成功部署：

&lt;container-descriptor&gt;

              &lt;servlet-reload-check-secs&gt;-1&lt;/servlet-reload-check-secs&gt;

              &lt;prefer-web-inf-classes&gt;true&lt;/prefer-web-inf-classes&gt;

&lt;/container-descriptor&gt;

 

 

 

 

 

如果使用了log4j，则日志的使用配置应在web.xml里进行配置，否则可能应用无法正常启动，配置内容如下：  
&lt;context-param&gt;  
  &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;  
  &lt;param-value&gt;/WEB-INF/classes/log4j.properties&lt;/param-value&gt;  
 &lt;/context-param&gt;  
      及如下listener:  
&lt;listener&gt;  

&lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener&lt;/listener-class&gt;  
&lt;/listener&gt;

 

原文链接：[http://minnanlin88.iteye.com/blog/322682](http://minnanlin88.iteye.com/blog/322682)