2016-12-22 60 views
0

我正在使用axis2-wsdl2code-maven-plugin來生成我的SOAP服務客戶端。該插件本身工作正常,並生成一個正確SOAP客戶端,但我獲得以下控制檯的警告,每次構建:使用axis2-wsdl2code-maven-plugin生成SOAP客戶端時發生Log4j警告

log4j:WARN No appenders could be found for logger (org.apache.axiom.locator.DefaultOMMetaFactoryLocator). 
log4j:WARN Please initialize the log4j system properly. 

我知道我需要來配置Log4j屬性,但我還沒有發現任何功能的方式爲此在axis2-wsdl2code-maven-plugin背景...

這是我pom.xml文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <artifactId>powerauth-java-client-axis</artifactId> 
    <version>0.13.0</version> 
    <name>powerauth-java-client-axis</name> 
    <description>PowerAuth 2.0 Service Client - Axis</description> 

    <parent> 
     <groupId>io.getlime.security</groupId> 
     <artifactId>powerauth-parent</artifactId> 
     <version>0.13.0</version> 
     <relativePath>../pom.xml</relativePath> 
    </parent> 

    <dependencies> 
     <dependency> 
      <groupId>org.apache.axis2</groupId> 
      <artifactId>axis2</artifactId> 
      <version>1.6.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.axis2</groupId> 
      <artifactId>axis2-adb</artifactId> 
      <version>1.6.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.axis2</groupId> 
      <artifactId>axis2-transport-http</artifactId> 
      <version>1.6.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.axis2</groupId> 
      <artifactId>axis2-transport-local</artifactId> 
      <version>1.6.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.ws.commons.axiom</groupId> 
      <artifactId>axiom-api</artifactId> 
      <version>1.2.20</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.ws.commons.axiom</groupId> 
      <artifactId>axiom-impl</artifactId> 
      <version>1.2.20</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.ws.security</groupId> 
      <artifactId>wss4j</artifactId> 
      <version>1.6.19</version> 
     </dependency> 
     <dependency> 
      <groupId>wsdl4j</groupId> 
      <artifactId>wsdl4j</artifactId> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <!-- tag::wsdl[] --> 
      <plugin> 
       <groupId>org.apache.axis2</groupId> 
       <artifactId>axis2-wsdl2code-maven-plugin</artifactId> 
       <version>1.6.4</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>wsdl2code</goal> 
         </goals> 
         <configuration> 
          <packageName>io.getlime.powerauth.soap</packageName> 
          <wsdlFile>${basedir}/src/main/resources/soap/wsdl/service.wsdl</wsdlFile> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <!-- end::wsdl[] --> 
     </plugins> 
    </build> 

</project> 
+0

您是否嘗試將log4j.properties文件添加到src/main/resources?我認爲在maven項目中,src/main/resources中的東西都包含在classpath中。 –

+0

是的,我確實嘗試過 - 如果沒有警告,它仍然不起作用。該項目[在github上提供](https://github.com/lime-company/lime-security-powerauth/tree/master/powerauth-java-client-axis),我使用'mvn package -am - pl powerauth-java-client-axis'。 –

+0

您可以嘗試使用'-Dlog4j.configuration = log4j.properties'構建正在運行的maven目標嗎? –

回答

2

這其實是一個錯誤。對AXIS2-5364fix增加了對log2j-axis2-wsdl2code-maven-plugin的依賴性。問題是插件執行的一些代碼使用Commons Logging,因此開始使用log4j。這會產生你看到的警告,因爲在Maven環境中,log4j沒有配置。

該插件應該做的是將日誌重定向到SLF4J,因爲該API是supported by recent Maven versions-X選項(啓用Maven命令行上的調試日誌記錄)也適用於這些日誌。

此問題將在AXIS2-5827中解決。

相關問題