我正在将HazelCast从2.5升级到3.8,但升级后我会遇到异常:
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Recursive load of: .
.
.
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827)
at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:136)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:547)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:884)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
at com.google.inject.internal.SingleFieldInjector.<init>(SingleFieldInjector.java:42)
at com.google.inject.internal.MembersInjectorStore.getInjectors(MembersInjectorStore.java:131)
at com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:98)
有人有任何想法吗?
答案 0 :(得分:0)
这是guice中的错误,当guice无法初始化注入类时由于缺少接口实现绑定或者在构造函数初始化期间失败,它会显示此错误而不是实际错误, 你可以查一下 https://github.com/google/guice/issues/785
以下程序失败并出现相同错误
`package com.guicetest;
import javax.inject.Inject;
import javax.inject.Provider;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Provides;
/* Dependencies:
Class01
Class04
Class03
Class02
@Provides Class01
Class03
Class01
Class04
Class05
Class01
Class05
Interface01
*/
public class MyTest {
public static void main(String[] args) {
Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
}
@Provides
public Class02 providesClass02(Provider<Class01> arg) {
return null;
}
});
}
}
class Class01 {
@Inject
public Class01(Provider<Class04> arg1, Provider<Class03> arg2) {
}
}
class Class02 {
}
class Class03 {
@Inject
public Class03(Provider<Class01> arg) {
}
}
class Class04 {
@Inject
public Class04(Provider<Class05> arg1, Provider<Class01> arg2) {
}
}
class Class05 {
@Inject
public Class05(Provider<Interface01> arg) {
}
}
interface Interface01 {
}`
您可以通过在LocalCache上将调试点放在异常原因并展开loader对象中来找到实际错误,您将能够找到实际错误, Finding actual error in intellij IDE