0

I am building a maven project where i faced this issue. Here is log trace

`Exception in thread "main" java.lang.ClassFormatError: Incompatible magic value 3130930938 in class file org/slf4j/LoggerFactory
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)`

Here are my dependencies in pom.xml

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.5</version>
</dependency>
<dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
       <version>1.6.4</version>
   </dependency> 
<dependency>

I already tried different options like clearing out java cache etc but didn't worked for me.

I appreciate any help. Thanks

2 Answers2

0

All artifacts in the group org.slf4j must have the same version when used in the POM. Otherwise runtime errors are then result.

Michael-O
  • 18,123
  • 6
  • 55
  • 121
0

Thanks for all your help. I resolved this issue finally. Here is the culprit

Step 1: I converted the magic value into ascii and got the following output "??6?". I checked the slf4j api in my maven's m2 directory and found another version(1.5.6) of slf4j also present there. I removed the slf-4j (1.5.6).

Step 2:

I removed the slf4j bundle (which gave error) in eclipse/configuration/org.eclipse.osgi and retry with maven build command. which is successfull.