为了项目的目的,我必须坚持使用Java 1.6进行开发,我使用了async client jar文件并将其合并到我的项目中以实现async功能,并使用java 1.6开发和导出了一个JAR。这个 jar 包含在另一个在 java 7 上运行的 web 项目的构建路径中。它在 java 7 64 位和 tomcat7 64 位上工作正常。但是当使用 java 7 32 位和 tomcat7 32 位时,看到以下错误:
java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type taticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory; used in the signature
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:299)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at com.ning.http.client.AsyncHttpClient.<clinit>(AsyncHttpClient.java:146)
at com.netspective.ems.invoker.AsyncApiInvoker.post(AsyncApiInvoker.java:39)
at com.netspective.ems.invoker.AsyncApiInvoker.post(AsyncApiInvoker.java:32)
at com.netspective.ems.invoker.AsyncApiInvoker.post(AsyncApiInvoker.java:73)
at com.netspective.ems.api.ExceptionApi.notify(ExceptionApi.java:42)
at com.netspective.ems.NetspectiveEMS.prepareAndPostDetails(NetspectiveEMS.java:101)
at com.netspective.ems.NetspectiveEMS.log(NetspectiveEMS.java:168)
at com.netspective.watchtower.sdk.log4j.WatchtowerClientAppender.append(WatchtowerClientAppender.java:32)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:856)
at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:155)
at org.apache.commons.discovery.resource.names.DiscoverNamesInFile.findResourceNames(DiscoverNamesInFile.java:178)
at org.apache.commons.discovery.tools.DiscoverClass.find(DiscoverClass.java:323)
at org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:520)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:370)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:270)
at gov.max.service.appendixb.persistence.restlet.resources.common.ServiceConfig.<clinit>(ServiceConfig.java:22)
at gov.max.service.appendixb.filter.security.SecurityFilter.init(SecurityFilter.java:129)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
我在项目中使用了以下 jar
async-http-client.jar
com.fasterxml.jackson.core.jar
com.fasterxml.jackson.databind.jar
com.springsource.org.joda.time-1.6.0.jar
jackson-annotations-2.0.2.jar
jackson-databind-2.0.5-sources.jar
jackson-datatype-joda-2.0.4.jar
json-1.5.jar
slf4j-api-1.7.0.jar
有没有办法解决这个异常?感谢您的任何建议。