AnsweredAssumed Answered

Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path.

Question asked by smartkit on Jan 4, 2015
Latest reply on Jan 4, 2015 by smartkit
Hi,

I am trying "mvn clean install" the "Activiti-5.17-snapshot" under "Spring-boot" archetype, the jar repackaged successfully.

Then "docker build -t <Docker image id> ." successfully. While after running "docker run -p 8082:8082 <Docker image id>", the MVN console thrown: "Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path."

And the POM dependency showed that:

"spring-boot-starter" need log4j-over-slf4j;
"Activiti-Explorer" need slf4j-log4j12.jar;

And the "org.activiti.explorer.demo.DemoDataGenerator.java"  comes from "Activiti-Explorer".

More Stack trace as following:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
   at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:199)
   at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
   at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
   at com.rushucloud.eip.Application.main(Application.java:49)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:483)
   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
   at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ExceptionInInitializerError: null
   at org.apache.log4j.Logger.getLogger(Logger.java:40)
   at org.jboss.logging.Log4jLogger.<init>(Log4jLogger.java:31)
   at org.jboss.logging.Log4jLoggerProvider.getLogger(Log4jLoggerProvider.java:29)
   at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:33)
   at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:28)
   at org.jboss.logging.Logger.getLogger(Logger.java:2163)
   at org.jboss.logging.Logger$1.run(Logger.java:2263)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.jboss.logging.Logger.getMessageLogger(Logger.java:2227)
   at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
   at org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:29)
   at org.hibernate.validator.internal.util.Version.<clinit>(Version.java:27)
   at org.hibernate.validator.internal.engine.ConfigurationImpl.<clinit>(ConfigurationImpl.java:66)
   at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)
   at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:276)
   at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:223)
   at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor$Jsr303ValidatorFactory.run(ConfigurationPropertiesBindingPostProcessor.java:362)
   at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.afterPropertiesSet(ConfigurationPropertiesBindingPostProcessor.java:174)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)
   … 21 common frames omitted
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
   at org.apache.log4j.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:51)
   … 41 common frames omitted

Any idea?

Thanks,
Yangbo

Outcomes