question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ClassNotFoundException: org.apache.logging.log4j.Level when running both examples

See original GitHub issue

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/Level at org.elasticsearch.common.logging.ESLoggerFactory.<clinit>(ESLoggerFactory.java:38) at org.elasticsearch.common.logging.Loggers.getLogger(Loggers.java:101) at org.elasticsearch.common.ParseField.<clinit>(ParseField.java:35) at org.elasticsearch.index.query.AbstractQueryBuilder.<clinit>(AbstractQueryBuilder.java:53) at org.elasticsearch.index.query.QueryBuilders.matchAllQuery(QueryBuilders.java:46) at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.deleteAll(AbstractElasticsearchRepository.java:256) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:377) at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200) at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:641) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:605) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:590) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy50.deleteAll(Unknown Source) at sample.data.jest.aws.SampleJestApplication.run(SampleJestApplication.java:34) at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:818) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:802) at org.springframework.boot.SpringApplication.run(SpringApplication.java:341) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) at sample.data.jest.aws.SampleJestApplication.main(SampleJestApplication.java:67) Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Level at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) ... 32 more

I setup AWS ES stack as well as localhost elastic(in docker) with no luck. I’ve tried spring-boot-sample-data-jest-aws and spring-boot-sample-data-jest examples, but the issue above is the same for both examples

please, help

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Tcharlcommented, Nov 5, 2018

Why slf4j over anything is not sufficient? Adding log4j-core as a dependency would break the logging system of many client app!

0reactions
Tcharlcommented, Nov 27, 2018

Sad to hear 😦. Let’s try to find a way to deal with the logging hell.

Thank you for the investigation!

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.ClassNotFoundException: org.apache.log4j.Level
4. When I try to run the application, I get the following error: Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.
Read more >
Caused By: java.lang.NoClassDefFoundError: org/apache ...
Cause : Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger error indicates that JVM is not able to found org.apache.log4j.Logger class ...
Read more >
How to Troubleshoot java.lang.NoClassDefFoundError: org ...
Our Application supports both Hadoop-2 & Hadoop-3 dependencies. ... Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Level
Read more >
"java.lang.NoClassDefFoundError: org/apache/log4j/Level ...
The error messages are Java exceptions that are caused when it fails to instantiate SLF4J Logger Factory.
Read more >
How to fix java.lang.ClassNotFoundException: org.apache ...
The commons-logging is also smart enough to detect which logging framework are you using e.g if you are using log4j it can detect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found