gpt4 book ai didi

java - Guice 2.0 的 ClassNotFoundException

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:05:34 31 4
gpt4 key购买 nike

下面的代码使用 Guice 2.0 会产生一个错误。使用 Guice 1.0 一切都很好。 JDK 是 Java 6 update 15。

public class App {
public static void main(String[] args) {
Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
// just testing
}
});
}
}

错误是:

Exception in thread "main" java.lang.NoClassDefFoundError: [Lorg/aopalliance/intercept/MethodInterceptor;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:78)
at com.google.inject.internal.ProviderMethodsModule.configure(ProviderMethodsModule.java:70)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:232)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.InjectorShell$Builder.build(InjectorShell.java:135)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:102)
at com.google.inject.Guice.createInjector(Guice.java:92)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at App.main(App.java:6)
Caused by: java.lang.ClassNotFoundException: org.aopalliance.intercept.MethodInterceptor
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 14 more

可能是什么问题?

最佳答案

您错过了包含一个 dependency jar在类路径中使用类 org.aopalliance.intercept.MethodInterceptor

关于java - Guice 2.0 的 ClassNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1266587/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com