我需要帮助才能让某个项目运行起来。该项目是:http://code.google.com/p/opennetinf/
我按照文档中的说明操作,让项目在Eclipse中运行。现在我想从终端运行这个项目。在项目启动一段时间后终端上有一个很大的例外。 log4j输出的第一行类似于eclipse控制台中的输出。 例外是:
Exception in thread "main" com.google.inject.ProvisionException: Guice provision errors:
1) Error in custom provider, java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at netinf.node.cache.peerside.PeersideCacheModule.provideNetworkCaches(PeersideCacheModule.java:64)
while locating java.util.List<netinf.node.cache.peerside.PeersideCache>
for parameter 0 at netinf.node.cache.CachingInterceptor.setPeersideCaches(CachingInterceptor.java:81)
while locating netinf.node.cache.CachingInterceptor
at netinf.node.module.StandardNodeModule.provideResolutionInterceptors(StandardNodeModule.java:125)
while locating netinf.node.resolution.ResolutionInterceptor[]
for parameter 0 at netinf.node.resolution.impl.ResolutionControllerImpl.initReslolutionInterceptors(ResolutionControllerImpl.java:442)
while locating netinf.node.resolution.impl.ResolutionControllerImpl
while locating netinf.node.resolution.ResolutionController
for parameter 0 at netinf.node.api.impl.NetInfNodeImpl.setResolutionController(NetInfNodeImpl.java:95)
while locating netinf.node.api.impl.NetInfNodeImpl
while locating netinf.node.api.NetInfNode
1 error
at com.google.inject.InjectorImpl$4.get(InjectorImpl.java:767)
at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:793)
at netinf.node.StarterNode.start(StarterNode.java:126)
at netinf.node.StarterNode.main(StarterNode.java:75)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:106)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:48)
at com.google.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
at com.google.inject.SingleMethodInjector.inject(SingleMethodInjector.java:84)
at com.google.inject.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:99)
at com.google.inject.ConstructorInjector.construct(ConstructorInjector.java:94)
at com.google.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:111)
at com.google.inject.InjectorImpl$4$1.call(InjectorImpl.java:758)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:811)
at com.google.inject.InjectorImpl$4.get(InjectorImpl.java:754)
at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:89)
at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:95)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:48)
at com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:811)
at com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)
at com.google.inject.Scopes$1$1.get(Scopes.java:54)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:48)
at com.google.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
at com.google.inject.SingleMethodInjector.inject(SingleMethodInjector.java:84)
at com.google.inject.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:99)
at com.google.inject.ConstructorInjector.construct(ConstructorInjector.java:94)
at com.google.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:111)
at com.google.inject.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:811)
at com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)
at com.google.inject.Scopes$1$1.get(Scopes.java:54)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:48)
at com.google.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
at com.google.inject.SingleMethodInjector.inject(SingleMethodInjector.java:84)
at com.google.inject.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:99)
at com.google.inject.ConstructorInjector.construct(ConstructorInjector.java:94)
at com.google.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:111)
at com.google.inject.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:811)
at com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)
at com.google.inject.Scopes$1$1.get(Scopes.java:54)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:48)
at com.google.inject.InjectorImpl$4$1.call(InjectorImpl.java:758)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:804)
at com.google.inject.InjectorImpl$4.get(InjectorImpl.java:754)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:101)
... 48 more
Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
at org.slf4j.impl.JDK14LoggerAdapter.warn(JDK14LoggerAdapter.java:450)
at org.eclipse.jetty.util.log.Slf4jLog.warn(Slf4jLog.java:40)
at org.eclipse.jetty.util.log.Log.warn(Log.java:237)
at org.eclipse.jetty.util.component.AbstractLifeCycle.setFailed(AbstractLifeCycle.java:198)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at netinf.node.cache.peerside.PeersideAccessServer.start(PeersideAccessServer.java:64)
at netinf.node.cache.peerside.PeersideCache.<init>(PeersideCache.java:79)
at netinf.node.cache.peerside.PeersideCacheModule.provideNetworkCaches(PeersideCacheModule.java:77)
... 53 more
那我做了什么: 我通过Eclipse Export Dialog(Export - &gt; Runnable Jar)导出了项目。图书馆处理无关紧要。使用这三种方法中的每一种都会得到相同的例外。
所以我的问题是:这个异常告诉我什么?我该如何解决这个问题?
答案 0 :(得分:3)
这似乎是与Slf4j相关的类路径错误。看看build file,这个项目似乎使用了Slf4j 1.5.6。
确保以下2个jar文件位于类路径中:
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
还要确保类路径中没有其他slf4j jar。