2014-09-30 93 views
0

我在發佈幾個API的websphere中部署實用程序jar。現在這些API將被一個web應用程序調用。現在這個jar使用log4j2進行日誌記錄。我試圖通過添加兩個log4j2 jar包(log4j-api-2.0.2.jar & & log4j-core-2.0.2.jar)來創建一個超級jar文件。我正在通過使用ant來構建實用程序jar。Websphere Log4j2類路徑問題

這裏是螞蟻代碼的片段,構建了罐子,我

<!--Creates the client jar file --> 
<target name="clientjar" depends="compile"> 


    <jar destfile="${dist.dir}/client/myUtility.jar" basedir="${class.dir}">  

     <zipgroupfileset dir="${lib.dir}" includes="*.jar" /> 

     <manifest> 
      <attribute name="Built-By" value="${user.name}" /> 
      <attribute name="Build-Date" value="${timestamp}" /> 
      <section name="${ant.project.name}"> 
       <attribute name="Implementation-Title" value="${project.implementation.title}"/> 
       <attribute name="Specification-Version" value="${project.version}"/> 
      </section> 
     </manifest> 

    </jar> 
</target> 

我的問題時是坐在同一個JVM的Web應用程序調用的jar API,log4j的吐出以下錯誤消息

錯誤StatusLogger Log4j2找不到日誌記錄實現。請將log4j-core添加到類路徑中。使用SimpleLogger登錄到控制檯...

任何指針都會有幫助。

回答

0

如果您將log4j-core jar解壓縮並將其重新壓縮爲更大jar文件的一部分,請確保包含最初在log4j-core jar中的所有文件。它包含log4j-api將查找的許多配置文件。如果這些文件不存在,您將遇到您遇到的錯誤。

+0

我沒有比較重新壓縮的版本和原始版本。除了manifest.mf文件外,一切似乎都沒問題。清單文件似乎不同於原始jar附帶的清單文件。你認爲這是一個問題嗎? – echo 2014-10-02 12:36:56