我有以下設置:一個Spring應用程序,使用SolrJ與slf4j日誌記錄的logback。當我在我的tomcat服務器上啓動應用程序時,出現下面的錯誤。所以,不知何故SolrJ沒有找到slf4j日誌記錄組件,但我確認了.jar文件實際上在我的WAR的正確lib文件夾中。Maven項目:與slf4j和logback日誌記錄SolrJ導致SolrException:加載類'org.slf4j.Logger; org.slf4j.Logger'錯誤
2017-05-12 09:37:54,094 WARN [org.apache.solr.common.SolrException: Error loading class 'org.slf4j.Logger;org.slf4j.Logger'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:556)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:625)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:590)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:583)
at org.apache.solr.logging.LogWatcher.createWatcher(LogWatcher.java:181)
at org.apache.solr.logging.LogWatcher.newRegisteredLogWatcher(LogWatcher.java:134)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:473)
at de.imi.MDMJava.config.AppConfig.solrClient(AppConfig.java:259)
at de.imi.MDMJava.config.AppConfig$$EnhancerBySpringCGLIB$$ece8fb2.CGLIB$solrClient$9(<generated>)
at de.imi.MDMJava.config.AppConfig$$EnhancerBySpringCGLIB$$ece8fb2$$FastClassBySpringCGLIB$$2023340f.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at de.imi.MDMJava.config.AppConfig$$EnhancerBySpringCGLIB$$ece8fb2.solrClient(<generated>)
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:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4810)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1692)
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:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:465)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:415)
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:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
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:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org/slf4j/Logger;org/slf4j/Logger
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:540)
... 103 common frames omitted
] in LogWatcher.java:createWatcher:184: Unable to load LogWatcher org.slf4j.Logger;org.slf4j.Logger: {}
2017-05-12 09:37:55,991 WARN [] in WebSecurity.java:performBuild:300:
我對洛部分的pom.xml看起來是這樣的:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
</dependency>
而且Maven的依賴關係樹看起來如下:
$ mvn dependency:tree -Dverbose | grep slf4j
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.21:compile - omitted for conflict with 1.7.7)
[INFO] | +- (org.slf4j:jcl-over-slf4j:jar:1.7.7:compile - omitted for conflict with 1.7.25)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for conflict with 1.7.25)
[INFO] | +- (org.slf4j:jcl-over-slf4j:jar:1.7.7:compile - omitted for duplicate)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for duplicate)
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for duplicate)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for conflict with 1.7.25)
不幸的是,完全依賴關係樹太長對於這篇文章,但如果你需要任何進一步的信息只是讓我知道。感謝您的任何建議。
編輯1:
有一個在我的 「/ WEB-INF/lib目錄/」 我的WAR文件,它包含所有圖書館目錄下的 「SLF4J-API 1.7.25.jar」 文件。
全Maven的依賴關係樹,我剝不包含 「SLF4J」 部分:
[more dependencies, but no occurence of slf4j...]
[INFO] +- org.springframework.security:spring-security-ldap:jar:4.2.2.RELEASE:compile
[INFO] | +- org.springframework.ldap:spring-ldap-core:jar:2.2.0.RELEASE:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.21:compile - omitted for conflict with 1.7.7)
[INFO] | +- (org.springframework.security:spring-security-core:jar:4.2.2.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- (org.springframework:spring-context:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- (org.springframework:spring-core:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | \- (org.springframework:spring-tx:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] +- org.springframework.security:spring-security-openid:jar:4.2.2.RELEASE:compile
[INFO] | +- com.google.inject:guice:jar:2.0:compile
[INFO] | | \- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] | +- org.openid4java:openid4java-nodeps:jar:0.9.6:compile
[INFO] | | \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] | +- (org.springframework.security:spring-security-core:jar:4.2.2.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework.security:spring-security-web:jar:4.2.2.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-aop:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- (org.springframework:spring-beans:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- (org.springframework:spring-context:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- (org.springframework:spring-core:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- (org.springframework:spring-web:jar:4.3.5.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.20:runtime
[INFO] | | \- xerces:xercesImpl:jar:2.10.0:runtime
[INFO] | | \- (xml-apis:xml-apis:jar:1.4.01:runtime - omitted for conflict with 1.0.b2)
[INFO] | \- (org.apache.httpcomponents:httpclient:jar:4.2.3:compile - scope updated from runtime; omitted for duplicate)
[INFO] +- org.apache.solr:solr-core:jar:6.5.1:compile
[more dependencies, but no occurence of slf4j...]
[INFO] | +- org.restlet.jee:org.restlet:jar:2.3.0:compile
[INFO] | +- org.restlet.jee:org.restlet.ext.servlet:jar:2.3.0:compile
[INFO] | +- (org.slf4j:jcl-over-slf4j:jar:1.7.7:compile - omitted for conflict with 1.7.25)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for conflict with 1.7.25)
[INFO] +- org.apache.solr:solr-solrj:jar:6.5.1:compile
[INFO] | +- (commons-io:commons-io:jar:2.5:compile - omitted for duplicate)
[INFO] | +- (org.apache.httpcomponents:httpclient:jar:4.4.1:compile - omitted for conflict with 4.2.3)
[INFO] | +- (org.apache.httpcomponents:httpcore:jar:4.4.1:compile - omitted for duplicate)
[INFO] | +- (org.apache.httpcomponents:httpmime:jar:4.4.1:compile - omitted for duplicate)
[INFO] | +- (org.apache.zookeeper:zookeeper:jar:3.4.6:compile - omitted for duplicate)
[INFO] | +- (org.codehaus.woodstox:stax2-api:jar:3.1.4:compile - omitted for duplicate)
[INFO] | +- (org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile - omitted for duplicate)
[INFO] | +- (org.noggit:noggit:jar:0.6:compile - omitted for duplicate)
[INFO] | +- (org.slf4j:jcl-over-slf4j:jar:1.7.7:compile - omitted for duplicate)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for duplicate)
[INFO] +- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for duplicate)
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | +- (ch.qos.logback:logback-core:jar:1.2.3:compile - omitted for duplicate)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for duplicate)
[INFO] +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.8.8:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile
[INFO] | +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile - omitted for conflict with 2.5.4)
[INFO] | \- (com.fasterxml.jackson.core:jackson-core:jar:2.8.8:compile - omitted for duplicate)
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.8:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | +- (org.apache.httpcomponents:httpcore:jar:4.4.4:compile - omitted for conflict with 4.4.1)
[INFO] | \- (commons-codec:commons-codec:jar:1.9:compile - omitted for conflict with 1.10)
[INFO] +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- org.jdom:jdom:jar:1.1:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- org.apache.tiles:tiles-extras:jar:3.0.5:compile
[INFO] | +- org.apache.tiles:tiles-core:jar:3.0.5:compile
[INFO] | | +- org.apache.tiles:tiles-api:jar:3.0.5:compile
[INFO] | | | \- (org.apache.tiles:tiles-request-api:jar:1.0.6:compile - omitted for duplicate)
[INFO] | | \- commons-digester:commons-digester:jar:2.0:compile
[INFO] | | \- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] | +- org.apache.tiles:tiles-request-servlet-wildcard:jar:1.0.6:compile
[INFO] | | +- org.apache.tiles:tiles-request-servlet:jar:1.0.6:compile
[INFO] | | | \- (org.apache.tiles:tiles-request-api:jar:1.0.6:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-web:jar:3.2.0.RELEASE:compile - omitted for conflict with 4.3.7.RELEASE)
[INFO] | +- org.apache.tiles:tiles-request-mustache:jar:1.0.6:compile
[INFO] | | +- org.apache.tiles:tiles-request-api:jar:1.0.6:compile
[INFO] | | \- com.github.spullara.mustache.java:compiler:jar:0.8.4:compile
[INFO] | | \- (com.google.guava:guava:jar:12.0:compile - omitted for conflict with 14.0.1)
[INFO] | +- org.apache.tiles:tiles-jsp:jar:3.0.5:compile
[INFO] | | +- org.apache.tiles:tiles-servlet:jar:3.0.5:compile
[INFO] | | | +- (org.apache.tiles:tiles-core:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | | \- (org.apache.tiles:tiles-request-servlet:jar:1.0.6:compile - omitted for duplicate)
[INFO] | | +- org.apache.tiles:tiles-template:jar:3.0.5:compile
[INFO] | | | +- (org.apache.tiles:tiles-api:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | | \- org.apache.tiles:tiles-autotag-core-runtime:jar:1.1.0:compile
[INFO] | | \- org.apache.tiles:tiles-request-jsp:jar:1.0.6:compile
[INFO] | | +- (org.apache.tiles:tiles-request-api:jar:1.0.6:compile - omitted for duplicate)
[INFO] | | \- (org.apache.tiles:tiles-request-servlet:jar:1.0.6:compile - omitted for duplicate)
[INFO] | +- org.apache.tiles:tiles-freemarker:jar:3.0.5:compile
[INFO] | | +- (org.apache.tiles:tiles-servlet:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | +- (org.apache.tiles:tiles-template:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | \- org.apache.tiles:tiles-request-freemarker:jar:1.0.6:compile
[INFO] | | +- (org.apache.tiles:tiles-request-api:jar:1.0.6:compile - omitted for duplicate)
[INFO] | | +- org.freemarker:freemarker:jar:2.3.15:compile
[INFO] | | \- (org.apache.tiles:tiles-request-servlet:jar:1.0.6:compile - omitted for duplicate)
[INFO] | +- org.apache.tiles:tiles-velocity:jar:3.0.5:compile
[INFO] | | +- (org.apache.tiles:tiles-servlet:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | +- (org.apache.tiles:tiles-template:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | +- org.apache.velocity:velocity-tools:jar:2.0:compile
[INFO] | | | +- (commons-collections:commons-collections:jar:3.2:compile - omitted for conflict with 3.2.2)
[INFO] | | | +- oro:oro:jar:2.0.8:compile
[INFO] | | | \- org.apache.velocity:velocity:jar:1.6.2:compile
[INFO] | | | +- (commons-collections:commons-collections:jar:3.2.1:compile - omitted for conflict with 3.2.2)
[INFO] | | | +- (commons-lang:commons-lang:jar:2.4:compile - omitted for conflict with 2.6)
[INFO] | | | \- (oro:oro:jar:2.0.8:compile - omitted for duplicate)
[INFO] | | +- (commons-digester:commons-digester:jar:2.0:compile - omitted for duplicate)
[INFO] | | \- org.apache.tiles:tiles-request-velocity:jar:1.0.6:compile
[INFO] | | +- (org.apache.velocity:velocity-tools:jar:2.0:compile - omitted for duplicate)
[INFO] | | \- (org.apache.tiles:tiles-request-servlet:jar:1.0.6:compile - omitted for duplicate)
[INFO] | +- org.apache.tiles:tiles-el:jar:3.0.5:compile
[INFO] | | \- (org.apache.tiles:tiles-core:jar:3.0.5:compile - omitted for duplicate)
[INFO] | +- org.apache.tiles:tiles-mvel:jar:3.0.5:compile
[INFO] | | +- (org.apache.tiles:tiles-core:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | \- org.mvel:mvel2:jar:2.0.11:compile
[INFO] | +- org.apache.tiles:tiles-ognl:jar:3.0.5:compile
[INFO] | | +- (org.apache.tiles:tiles-core:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | \- ognl:ognl:jar:2.7.3:compile
[INFO] | | \- jboss:javassist:jar:3.7.ga:compile
[INFO] | +- org.apache.tiles:tiles-compat:jar:3.0.5:compile
[INFO] | | +- (org.apache.tiles:tiles-core:jar:3.0.5:compile - omitted for duplicate)
[INFO] | | \- (org.apache.tiles:tiles-jsp:jar:3.0.5:compile - omitted for duplicate)
[INFO] | \- (com.google.guava:guava:jar:12.0.1:compile - omitted for conflict with 14.0.1)
[INFO] +- javax:javaee-web-api:jar:7.0:provided
[INFO] +- org.projectlombok:lombok:jar:1.16.10:provided
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.2:provided
[INFO] +- javax.mail:mail:jar:1.4.7:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- cglib:cglib:jar:2.2.2:compile
[INFO] | \- asm:asm:jar:3.3.1:compile
[INFO] +- org.webjars:jquery:jar:3.2.0:compile
[INFO] +- org.webjars:bootstrap:jar:3.3.7:compile
[INFO] | \- (org.webjars:jquery:jar:1.11.1:compile - omitted for conflict with 3.2.0)
[INFO] +- org.webjars.bower:devbridge-autocomplete:jar:1.3.0:compile
[INFO] | \- org.webjars.bower:jquery:jar:3.2.1:compile
[INFO] +- org.webjars:webjars-locator:jar:0.32:compile
[INFO] | +- org.webjars:webjars-locator-core:jar:0.30:compile
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for conflict with 1.7.25)
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | | \- org.apache.commons:commons-compress:jar:1.9:compile
[INFO] | \- (com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile - omitted for conflict with 2.8.8)
[INFO] \- com.github.dpaukov:combinatoricslib3:jar:3.1.1:compile
編輯2:
這裏是SLF4J-API 1.7的內容WAR包中的.25.jar。 「org/slf4j/Logger.class」似乎存在。當我部署webapp時,slf4j-api-1.7.25.jar擁有644個權限,我的用戶是該文件的所有者。會導致問題嗎?
slf4j-api-1.7.25
├── META-INF
│ ├── MANIFEST.MF
│ └── maven
│ └── org.slf4j
│ └── slf4j-api
│ ├── pom.properties
│ └── pom.xml
└── org
└── slf4j
├── event
│ ├── EventConstants.class
│ ├── EventRecodingLogger.class
│ ├── Level.class
│ ├── LoggingEvent.class
│ └── SubstituteLoggingEvent.class
├── helpers
│ ├── BasicMarker.class
│ ├── BasicMarkerFactory.class
│ ├── BasicMDCAdapter$1.class
│ ├── BasicMDCAdapter.class
│ ├── FormattingTuple.class
│ ├── MarkerIgnoringBase.class
│ ├── MessageFormatter.class
│ ├── NamedLoggerBase.class
│ ├── NOPLogger.class
│ ├── NOPLoggerFactory.class
│ ├── NOPMDCAdapter.class
│ ├── SubstituteLogger.class
│ ├── SubstituteLoggerFactory.class
│ ├── Util$1.class
│ ├── Util.class
│ └── Util$ClassContextSecurityManager.class
├── ILoggerFactory.class
├── IMarkerFactory.class
├── Logger.class
├── LoggerFactory.class
├── Marker.class
├── MarkerFactory.class
├── MDC$1.class
├── MDC.class
├── MDC$MDCCloseable.class
└── spi
├── LocationAwareLogger.class
├── LoggerFactoryBinder.class
├── MarkerFactoryBinder.class
└── MDCAdapter.class
編輯3: @AlexC你是對的。我爲「.Logger」而津津樂道發現這一行我solr.xml:
<str name="class">${loggingClass:org.slf4j.Logger;org.slf4j.Logger}</str>
我把它改爲:
<logging>
<str name="class">${loggingClass:org.slf4j.Logger}</str>
<str name="enabled">${loggingEnabled:true}</str>
<watcher>
<int name="size">${loggingSize:50}</int>
<str name="threshold">${loggingThreshold:WARN}</str>
</watcher>
</logging>
還是同樣的錯誤,但現在隨着 「org.slf4j.Logger」,而不是(與JCL-過SLF4J,的logback核和無):
2017-05-12 14:33:16,411 WARN [java.lang.ClassCastException: interface org.slf4j.Logger
at java.lang.Class.asSubclass(Class.java:3404)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:540)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:625)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:590)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:583)
at org.apache.solr.logging.LogWatcher.createWatcher(LogWatcher.java:181)
at org.apache.solr.logging.LogWatcher.newRegisteredLogWatcher(LogWatcher.java:134)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:473)
[...]
at java.lang.Thread.run(Thread.java:745)
] in LogWatcher.java:createWatcher:184: Unable to load LogWatcher org.slf4j.Logger: {}
編輯4:
也許從我下面的評論中爲大家澄清:「Solr通過SolrJ集成到我的應用程序中。我不運行一個單獨的Solr實例。我知道這應該只用於調試目的,但我使用Solr並不證明獨立的Solr服務器。「
我試圖通過我的pom.xml中的排除刪除slf4j的所有依賴關係。 :
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for duplicate)
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | +- (ch.qos.logback:logback-core:jar:1.2.3:compile - omitted for duplicate)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for duplicate)
[INFO] +- ch.qos.logback:logback-core:jar:1.2.3:compile
只是檢查在運行時環境(例如,在你的WAR/EAR等),是SLF4J-api.jar中存在 –
你應該張貼依賴三,顯示什麼是衝突的根源部分。或者至少有一個是衝突的第一根。 – freedev
我爲您的評論添加了修改。 slf4j-api.jar存在於我的WAR文件中。 – stefanhgm