当模块类加载器顺序时,罗马0.9无法正常工作:父级最后

时间:2015-06-17 12:08:23

标签: log4j websphere classloader websphere-7

项目描述: WebSphere Application Server 7.Maven项目,它使用Rome0.9。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<ul id="mixers">

  <li>
    <div class="align-table">
      <div class="color-img t-align">
        <img width="65" height="65" src="http://mosaicshack.com/wp-content/uploads/2015/04/Opulence_Teal_Gold.jpg" class="attachment-thumb-blend wp-post-image" alt="Opulence Teal Gold">
      </div>
      <div class="t-align">
        <div class="percent-mix ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">
          <div class="ui-slider-range ui-widget-header ui-slider-range-max" style="width: 0%;"></div>
          <a class="ui-slider-handle ui-state-default ui-corner-all" href="#" style="left: 100%;"></a>
        </div>
        <div class="mix-value">0</div>
      </div>
    </div>
  </li>
</ul>

<ul>

  <li class="t-align-row">
    <ul class="align-table">
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
      <li class="t-align">
        <div class="place">
          <img width="33" height="33" src="" class="attachment-thumb-blend wp-post-image" alt="Tile">
        </div>
      </li>
    </ul>
  </li>
</ul>

我正在解决log4j没有记录的问题。问题是log4j.properties已在父项目中设置。 这就是我将模块的类加载器顺序更改为Parent Last的原因。 它修复了log4j的问题,但是应用程序现在抛出以下异常:

<dependency>
    <groupId>rome</groupId>
    <artifactId>rome</artifactId>
    <version>0.9</version>
</dependency> 

我检查了父加载的库,它们包含相同版本的Rome - 0.9。

似乎我在项目中遗漏了一些依赖项。我想知道是否有办法找出哪些库丢失了?

也许你可以建议任何其他解决方案?

1 个答案:

答案 0 :(得分:0)

我没有搜索丢失的已加载库的解决方案。 但是这个解决方法对我有用: 我在主servlet类的静态块中重新配置了log4j。

static Logger logger = LoggerFactory.getLogger(FeedAggregatorServlet.class);
static {
     Properties p = new Properties();
     ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
     try {
         p.load(classLoader.getResourceAsStream("/FeedAggregatorlog4j.properties"));
     } catch (IOException e) {
         e.printStackTrace();             
     }
    PropertyConfigurator.configure(p);
}