maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curtis Rueden <>
Subject Re: Maven - slf4j noclassdeffound error
Date Thu, 24 Oct 2013 15:12:31 GMT
Hi all,

> 5. consider if you really want the API or an implementation package
> for runtime use

The typical pattern with SLF4J is to depend only on org.slf4j:slf4j-api at
compile time, and then add an implementation binding at runtime. For SLF4J
1.6+, you don't even need an implementation at runtime; it will default to
no-op with only a single one-line warning. You have to be careful though:
it's best to add the implementation binding only for end-user application
components (i.e., components not intended for reuse), and/or add the
dependency non-transitively using test or optional scope; see:

Anyway, I know that's a tangent from the original topic. It seems the OP
doesn't care about SLF4J; it's just a transitive dependency which should
get pulled in.

> Exception in thread "main" java.lang.NoClassDefFoundError:

Personally, I cannot reproduce this problem on my OS X 10.9 system. The
exact POM and Java source posted works for me from both the command line
and using IntelliJ IDEA 12.1.6 downloaded today.

So I agree with Wayne to start double-checking your assumptions. See if
"mvn" works on the command line, "mvn dependency:tree" or "dependency:list"
as suggested by others, maybe try in NetBeans and/or Eclipse... and if your
IntelliJ is old try upgrading it and reimporting the project from scratch.


On Thu, Oct 24, 2013 at 8:33 AM, Wayne Fay <> wrote:

> >       <dependency>
> >           <groupId>org.slf4j</groupId>
> >           <artifactId>slf4j-api</artifactId>
> >           <version>1.7.5</version>
> >> >> Exception in thread "main" java.lang.NoClassDefFoundError:
> >> >> org/slf4j/LoggerFactory
> At this point (with the dependency specifically declared in the pom),
> you have to start questioning everything:
> 1. are you sure that's the right dependency declaration and version?
> sometimes projects "move" and start producing new versions under a
> different groupId.
> 2. are you sure org.slf4j.LoggerFactory is supposed to be in that jar
> with that version?
> 3. go into .m2 and find the slf4j-api-1.7.5.jar file, open it up with
> a zip tool, confirm it is a real jar (zip) and not HTML error message
> 4. also confirm it has org.slf4j.LoggerFactory inside
> 5. consider if you really want the API or an implementation package
> for runtime use
> Wayne
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message