soaplog4japache-axiswsdl2code

Log4j warning while using axis2-wsdl2code-maven-plugin to generate SOAP client


I am using axis2-wsdl2code-maven-plugin to generate my SOAP service client. The plugin itself works correctly and it generates a correct SOAP client, but I get following warning in console with every build:

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

I know I need to configure Log4j properties, but I haven't found any functional way to do this in context of axis2-wsdl2code-maven-plugin...

This is my pom.xml file:

<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>

Solution

  • This is actually a bug. The fix for AXIS2-5364 added a dependency on log4j to axis2-wsdl2code-maven-plugin. The problem is that some of the code executed by the plugin uses Commons Logging and therefore started to use log4j. That generates the warning you have seen because in a Maven environment, log4j isn't configured.

    What the plugin should do is to redirect logs to SLF4J, because that API is supported by recent Maven versions. The -X option (which enables debug logging on the Maven command line) then works for these logs as well.

    This problem will be addressed in AXIS2-5827.