Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependency log4j error

Hello everyone I have error which breaks up my build for no reason, here is the error message :

error: error reading
/.m2/repository/com/sun/jdmk/jmxtools/1.2.1/jmxtools-1.2.1.jar;
error in opening zip file error: error
reading
/.m2/repository/com/sun/jmx/jmxri/1.2.1/jmxri-1.2.1.jar;
error in opening zip file

I'm using this dependency :

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.15</version>
  <scope>provided</scope>
</dependency>

How can I fix this ?

like image 353
ant Avatar asked Feb 22 '10 11:02

ant


People also ask

Does Maven use log4j?

As you can see in this answer, maven supports SLF4J logging. If you just add the Log4j to SLF4j adapter to the plugin. By adding this dependency, log4j will redirect to SLF4j and SLF4j redirects to the maven logging.

Does log4j 1.2 17 have vulnerability?

Included in Log4j 1.2 is a SocketServer class that is vulnerable to deserialization of untrusted data which can be exploited to remotely execute arbitrary code when combined with a deserialization gadget when listening to untrusted network traffic for log data.

What is meant by log4j?

log4j is a reliable, fast and flexible logging framework (APIs) written in Java, which is distributed under the Apache Software License. log4j is a popular logging package written in Java. log4j has been ported to the C, C++, C#, Perl, Python, Ruby, and Eiffel languages.


1 Answers

You most likely don't need jmxtools or jmxri, so you can probably exclude them from your dependencies:

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
    <scope>provided</scope>
    <exclusions>
        <exclusion>
          <groupId>com.sun.jdmk</groupId>
          <artifactId>jmxtools</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jmx</groupId>
          <artifactId>jmxri</artifactId>
        </exclusion>
    </exclusions>
</dependency>
like image 174
Martin Avatar answered Sep 24 '22 08:09

Martin