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: com.google.common.base.Splitter #25

Open
gmanjon opened this issue Jul 31, 2018 · 9 comments
Open

ClassNotFoundException: com.google.common.base.Splitter #25

gmanjon opened this issue Jul 31, 2018 · 9 comments
Assignees

Comments

@gmanjon
Copy link

gmanjon commented Jul 31, 2018

Environment info:

logzip-log4j2 version: 1.0.9
java version: 1.8
AS: Wildfly 12
Docker image: jboss/wildfly:12.0.0.Final (CENTOS 7)
OS Host: Ubuntu 16.04

Appender config:

<LogzioAppender name="Logzio">
    <logzioToken>$LOGZIO_TOKEN</logzioToken>
    <logzioType>java</logzioType>
    <additionalFields>env=$ENV</additionalFields>
    <debug>true</debug>
    <logzioUrl>https://listener.logz.io:8071</logzioUrl>
</LogzioAppender>

Exception stacktrace:

wildfly    | Caused by: java.lang.NoClassDefFoundError: com/google/common/base/Splitter
wildfly    | 	at io.logz.log4j2.LogzioAppender.<init>(LogzioAppender.java:236)
wildfly    | 	at io.logz.log4j2.LogzioAppender.<init>(LogzioAppender.java:41)
wildfly    | 	at io.logz.log4j2.LogzioAppender$Builder.build(LogzioAppender.java:113)
wildfly    | 	at io.logz.log4j2.LogzioAppender$Builder.build(LogzioAppender.java:60)
wildfly    | 	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
wildfly    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
wildfly    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
wildfly    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
wildfly    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
wildfly    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
wildfly    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
wildfly    | 	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
wildfly    | 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
wildfly    | 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
wildfly    | 	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
wildfly    | 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
wildfly    | 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
wildfly    | 	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
wildfly    | 	at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
wildfly    | 	at ***********
wildfly    | 	at java.lang.Class.forName0(Native Method)
wildfly    | 	at java.lang.Class.forName(Class.java:348)
wildfly    | 	at org.jboss.invocation.proxy.AbstractProxyFactory.afterClassLoad(AbstractProxyFactory.java:91)
wildfly    | 	at org.jboss.invocation.proxy.AbstractClassFactory.defineClass(AbstractClassFactory.java:162)
wildfly    | 	at org.jboss.invocation.proxy.AbstractProxyFactory.getCachedMethods(AbstractProxyFactory.java:146)
wildfly    | 	at org.jboss.as.ejb3.component.stateless.StatelessComponentDescription$3.configure(StatelessComponentDescription.java:145)
wildfly    | 	at org.jboss.as.ee.component.DefaultComponentViewConfigurator.configure(DefaultComponentViewConfigurator.java:67)
wildfly    | 	at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:92)
wildfly    | 	... 9 more

If I open de uber jar logzio-log4j2-appender-1.0.9.jar the shadded package /io/logz/sender/com/google/common/base/ doesn't contain the class Splitter.class (view attached image)

image

@gmanjon
Copy link
Author

gmanjon commented Jul 31, 2018

Adding guava dependency to pom.xml fixes the problem

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>20.0</version>
</dependency>

@idohalevi
Copy link
Contributor

@gmanjon
What is the logzio-sender-version you're using?

@gmanjon
Copy link
Author

gmanjon commented Aug 12, 2018

The only dependency I added to my pom.xml is

<dependency>
    <groupId>io.logz.log4j2</groupId>
    <artifactId>logzio-log4j2-appender</artifactId>
    <version>1.0.9</version>
</dependency>

@idohalevi
Copy link
Contributor

@gmanjon
Can you try to use 1.0.11?

@gmanjon
Copy link
Author

gmanjon commented Aug 13, 2018

1.0.11 or 1.0.10?

No 1.0.11here https://mvnrepository.com/artifact/io.logz.log4j2/logzio-log4j2-appender

@idohalevi
Copy link
Contributor

@gmanjon
I'm sorry I meant logzio-sender-version versoin and not logzio-log4j2-appender version

@idohalevi
Copy link
Contributor

@gmanjon Should be fixed in the latest version

@asafm
Copy link
Contributor

asafm commented Dec 19, 2018

@gmanjon - can we close this issue?

@selalerercapitolis
Copy link

Was this issue resolved? Got this error with 1.0.10:

Starting java process (JAVA_OPTS=-Xmx900m)(PATH=/usr/java/openjdk-13/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)...
07:12:47.006 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoClassDefFoundError: com/google/common/base/Splitter
at io.logz.log4j2.LogzioAppender.<init>(LogzioAppender.java:236) ~[logzio-log4j2-appender-1.0.10.jar!/:?]
at io.logz.log4j2.LogzioAppender.<init>(LogzioAppender.java:41) ~[logzio-log4j2-appender-1.0.10.jar!/:?]
at io.logz.log4j2.LogzioAppender$Builder.build(LogzioAppender.java:113) ~[logzio-log4j2-appender-1.0.10.jar!/:?]
at io.logz.log4j2.LogzioAppender$Builder.build(LogzioAppender.java:60) ~[logzio-log4j2-appender-1.0.10.jar!/:?]
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1002) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:942) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:934) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:552) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:241) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:288) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:579) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:285) ~[log4j-core-2.12.1.jar!/:2.12.1]
at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.loadConfiguration(Log4J2LoggingSystem.java:183) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.loadConfiguration(Log4J2LoggingSystem.java:174) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:66) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:57) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.initialize(Log4J2LoggingSystem.java:156) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:318) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:288) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]

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