Search code examples
springlog4jwebsphereslf4j

SLF4J error: This version of SLF4J requires log4j version 1.2.12 or later


When I am trying to deploy the application on Websphere 7.0 I get the error message on console

0000000d SystemErr R SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version

Further when spring internally calling log4j api, following error occurs:

0000000d webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in ServletContext resource

[/WEB-INF/spring_config/jbpm_applicationContext.xml]: Instantiation of bean failed;

nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.NoSuchMethodError: org/apache/log4j/Logger.trace(Ljava/lang/Object;)V

I upgraded the log4j api from 1.2.16 to 1.2.17 but still i got the same error. Additionally, slf4j-api-1.6.1.jar and slf4j-log4j12-1.6.1.jar are being used in classpath.


Solution

  • You should switch classloading policy for your application to "parent last". Then the version of log4j bundled with your application will be used. Please see Class loader settings for details.