Log4j2 missing from io.vertx.core.logging

842 views
Skip to first unread message

Kevin

unread,
Nov 12, 2016, 5:21:43 PM11/12/16
to vert.x
I'm trying to configure a basic REST service to use Log4j 2's Async Logger and subsequently Filebeat and getting this error when I 'java -jar ...'

java.lang.ClassNotFoundException: io.vertx.core.logging.Log4j2LogDelegateFactory


I peaked inside the fat jar and only see:

io/vertx/core/logging/Log4jLogDelegate.class
io/vertx/core/logging/Log4jLogDelegateFactory.class
io/vertx/core/logging/Logger.class
io/vertx/core/logging/LoggerFactory.class

Isn't there supposed to be a  

Log4j2LogDelegateFactory.class
?

Can't find any references to it being removed

Thanks

Alexander Lehmann

unread,
Nov 12, 2016, 6:53:58 PM11/12/16
to vert.x
The class is present in a vertx 3.3.3 project I build with fatjar (if the fatjar contains all classes from vertx-core it should be present), maybe you are excluding some files from the jar?

Kevin

unread,
Nov 12, 2016, 8:36:04 PM11/12/16
to vert.x
this is my pom.xml:

         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>
  <groupId>io.vertx.blog</groupId>
  <artifactId>my-first-app</artifactId>
  <version>1.0-SNAPSHOT</version>

  <dependencies>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <version>3.0.0</version>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
      <version>3.0.0</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-unit</artifactId>
      <version>3.0.0</version>
      <scope>test</scope>
    </dependency>


    <!-- Logging
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>2.7</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>2.7</version>
    </dependency>
  -->
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer
                  implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Main-Class>io.vertx.core.Starter</Main-Class>
                    <Main-Verticle>io.vertx.blog.first.MyFirstVerticle</Main-Verticle>
                  </manifestEntries>
                </transformer>
              </transformers>
              <artifactSet/>
              <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

I just do 'mvn clean package' and then 'java -jar -Dvertex... -jar target/... -conf'. I'm currently commenting out Log4j2 and using v1... am I excluding something on purpose?

Kevin

unread,
Nov 12, 2016, 10:01:12 PM11/12/16
to vert.x
I found the error: I need to use 3.3.3 - I edited the Maven versions and it worked, the Log4j2 is not in 3.0.0 
Reply all
Reply to author
Forward
0 new messages