Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException: org.apache.log4j.PropertyConfigurator [2.3.1] #17585

Closed
Pyppe opened this issue Apr 7, 2016 · 5 comments
Closed

ClassNotFoundException: org.apache.log4j.PropertyConfigurator [2.3.1] #17585

Pyppe opened this issue Apr 7, 2016 · 5 comments

Comments

@Pyppe
Copy link

Pyppe commented Apr 7, 2016

Elasticsearch version: 2.3.1
JVM version: 1.8
OS version: Ubuntu 14.04
Description of the problem including expected versus actual behavior:
We have a custom build of elaticsearch with embedded plugins, which we build as a single JAR (using scala & sbt-assembly). Now, if we try to upgrade elasticsearch dependency from 2.2.0 to 2.3.1 we will get java.lang.ClassNotFoundException: org.apache.log4j.PropertyConfigurator on startup.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
Likely root cause: java.lang.ClassNotFoundException: org.apache.log4j.PropertyConfigurator
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:128)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:243)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

Everything works in 2.2.0 so I assume there is something fishy with the maven declarations?

@dadoonet
Copy link
Member

dadoonet commented Apr 7, 2016

I believe that you have to include it explicitly as it's marked as optional: https://github.com/elastic/elasticsearch/blob/2.x/core/pom.xml#L166-L175

@dadoonet dadoonet closed this as completed Apr 7, 2016
@Pyppe
Copy link
Author

Pyppe commented Apr 7, 2016

Yeah, but why is it marked optional if you cannot to start the program without it?

@dadoonet
Copy link
Member

dadoonet commented Apr 7, 2016

Because you can provide another implementation if you wish.

@rmannibucau
Copy link

Hi got the same issue with 2.3.2,

https://github.com/elastic/elasticsearch/blob/2.x/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L243 being called whatever config you do, https://github.com/elastic/elasticsearch/blob/2.x/core/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java#L128 is triggered and load log4j so it is not optional so shouldn't be marked as such in the pom IMO.

Having a es.log flag == jul could allow to skip it and avoid this noclassdeffounderror.

@nik9000
Copy link
Member

nik9000 commented Apr 27, 2016

As of 2.3.something log4j isn't optional in the server. In the client it should be. The problem is that the client shares the same pom and jar as the server. Both of those things are known bad but not actively being worked on other than the initiative to provide a REST based java client.

sscarduzio added a commit to sscarduzio/elasticsearch-readonlyrest-plugin that referenced this issue Jul 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants