My application uses grails 1.3.7 with quartz scheduler 1.0-RC1 plugin. It runs fine locally on tomcat when I run it using grails run-app. However, when I create a war file using grails prod war and deploy it in WebLogic, I'm getting the below error:

SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
log4j:ERROR Error initializing log4j: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.trace(SLF4JLocationAwareLog.java:107)
        at org.apache.commons.beanutils.BeanUtilsBean.convert(BeanUtilsBean.java:1073)

I figured this is because grails 1.3.7 uses slf4j 1.5.8, but the quartz plugin uses 1.6.0 and hence there's a conflict. I tried to address it by excluding the slf4j-api jar in BuildConfig.groovy like:

plugins {
    compile(":quartz:1.0-RC1") { excludes "slf4j-api" }
}

I was hoping the above config entry would prevent slf4j 1.6.0 from being downloaded and resolve the conflict. But it isn't. When I run grails dependency-report, I still see the conflict and I'm unable to deploy the application in WebLogic.

EDIT: Screenshot of the conflict from grails dependency-report: enter image description here

Any pointers to resolve this?

有帮助吗?

解决方案 2

I resolved this issue by using the code below in BuildConfig.groovy to exclude slf4j-api-1.6.0.jar from the packaged war. The suggestion was posted here

grails.war.resources = { stagingDir ->
    delete(file:"${stagingDir}/WEB-INF/lib/slf4j-api-1.6.0.jar")
}

I also had to add slf4j-api-1.5.8.jar to the project's lib folder.

其他提示

You have conflict of jar file. Weblogic comes with sl4j by default and your war file should also contain sl4j jar file inside WEB-INF\lib folder. You can try changing class loading to parent last from admin console.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top