splunk / splunk-library-javalogging

Splunk logging appenders for popular Java Logging frameworks
http://dev.splunk.com/view/splunk-logging-java/SP-CAAAE2K
Apache License 2.0
135 stars 175 forks source link

java.lang.NoSuchFieldError: DEFAULT error occurred when using splunk-library-javalogging #23

Closed liuxiaopiao closed 8 years ago

liuxiaopiao commented 8 years ago

I am trying to enable logging to HTTP Event Collector in the Java project with java.util.logging. The code is very simple:

import java.util.logging.; import com.splunk.logging.; ...................... Logger logger = Logger.getLogger("splunkLogger"); logger.info("This is a test event for Logback test");

And the property file is like this: splunkLogger.level = INFO splunkLogger.handlers = com.splunk.logging.HttpEventCollectorLoggingHandler com.splunk.logging.HttpEventCollectorLoggingHandler.url = https://192.168.99.100:8088/services/collector com.splunk.logging.HttpEventCollectorLoggingHandler.level = INFO com.splunk.logging.HttpEventCollectorLoggingHandler.token = 00E4854F-53D4-4A1E-934C-EF5945DF790D com.splunk.logging.HttpEventCollectorLoggingHandler.disableCertificateValidation=true

When I run the java code with -Djava.util.logging.config.file=config/jdklogging.properties, the error popped up: Exception in thread "Timer-0" java.lang.NoSuchFieldError: DEFAULT at org.apache.http.impl.nio.client.HttpAsyncClientBuilder.build(HttpAsyncClientBuilder.java:603) at com.splunk.logging.HttpEventCollectorSender.startHttpClient(HttpEventCollectorSender.java:234) at com.splunk.logging.HttpEventCollectorSender.postEvents(HttpEventCollectorSender.java:277) at com.splunk.logging.HttpEventCollectorMiddleware.postEvents(HttpEventCollectorMiddleware.java:86) at com.splunk.logging.HttpEventCollectorSender.postEventsAsync(HttpEventCollectorSender.java:256) at com.splunk.logging.HttpEventCollectorSender.flush(HttpEventCollectorSender.java:152) at com.splunk.logging.HttpEventCollectorSender.run(HttpEventCollectorSender.java:175) at java.util.TimerThread.mainLoop(Unknown Source)

Could you please give me a help on this? Thank you very much!

liuxiaopiao commented 8 years ago

Fixed the issue by re-org the dependent jar files. Close the issue. Thanks everyone.