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

log4j2 JsonLayout not loading #34333

Closed
jordansissel opened this issue Oct 5, 2018 · 1 comment
Closed

log4j2 JsonLayout not loading #34333

jordansissel opened this issue Oct 5, 2018 · 1 comment

Comments

@jordansissel
Copy link
Contributor

I was helping a user out with some Elasticsearch log processing, and I recalled that Logstash offers JsonLayout for its logs, and until #8786 is resolved, I was hoping to offer a workaround.

When attempting to use this in Elasticsearch, it crashes on startup with an exception. I searched existing issues which seem to point to a necessary security policy, but my error isn't identical and even with the workaround security policy (I think?) loaded it still fails.

Tested with:

  • Elasticsearch 6.4.2
  • openjdk version "1.8.0_181"
  • Fedora 28

log4j2.properties:

appender.console.layout.type = JsonLayout
appender.console.layout.compact = true
appender.console.layout.eventEol = true

Elasticsearch output:

% bin/elasticsearch 
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/FilterProvider
	at org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:158)
	at org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:69)
	at org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:99)
	at org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:77)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:163)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:119)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:294)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
	at org.elasticsearch.cli.Command.main(Command.java:90)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.FilterProvider
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 24 more
@vladimirdolzhenko
Copy link
Contributor

@jordansissel sorry, I'd like to close this issue as a duplicate of issue you've mentioned.

From my end I try to raise a problem again.

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

2 participants