Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 谷歌Guice可以';我找不到课_Java_Dependency Injection_Guice - Fatal编程技术网

Java 谷歌Guice可以';我找不到课

Java 谷歌Guice可以';我找不到课,java,dependency-injection,guice,Java,Dependency Injection,Guice,我正在用GoogleGuice编写程序,但我遇到了一个例外!为了测试,我写了一个小程序,但它不工作太多 所有课程都有: Main.java: ITest.java: Test.java: TestModule.java: pom.xml中的依赖项 <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifact

我正在用GoogleGuice编写程序,但我遇到了一个例外!为了测试,我写了一个小程序,但它不工作太多


所有课程都有:

Main.java:

ITest.java:

Test.java:

TestModule.java:


pom.xml中的依赖项

    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>4.0</version>
    </dependency>

com.google.inject
圭斯
4

异常堆栈跟踪:

"C:\Program Files\Java\jdk1.8.0_101\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=D:\Rostislav\IDEs\IntelliJ IDEA Community Edition 2016.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_101\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\access-bridge.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\rt.jar;D:\Rostislav\Projects\OSLoader\OSLoaderServer\target\classes;C:\Documents and Settings\Администратор\.m2\repository\org\xerial\sqlite-jdbc\3.8.11.2\sqlite-jdbc-3.8.11.2.jar;C:\Documents and Settings\Администратор\.m2\repository\com\netflix\rxjava\rxjava-core\0.20.7\rxjava-core-0.20.7.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-core\1.1.4.Final\weld-core-1.1.4.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\enterprise\cdi-api\1.0-SP4\cdi-api-1.0-SP4.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-api\1.1.Final\weld-api-1.1.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-spi\1.1.Final\weld-spi-1.1.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\annotation\jsr250-api\1.0\jsr250-api-1.0.jar;C:\Documents and Settings\Администратор\.m2\repository\org\javassist\javassist\3.14.0-GA\javassist-3.14.0-GA.jar;C:\Documents and Settings\Администратор\.m2\repository\com\google\guava\guava\r06\guava-r06.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\spec\javax\interceptor\jboss-interceptors-api_1.1_spec\1.0.0.Beta1\jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\interceptor\jboss-interceptor-spi\2.0.0.CR1\jboss-interceptor-spi-2.0.0.CR1.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\interceptor\jboss-interceptor-core\2.0.0.CR1\jboss-interceptor-core-2.0.0.CR1.jar;C:\Documents and Settings\Администратор\.m2\repository\org\slf4j\slf4j-ext\1.5.10\slf4j-ext-1.5.10.jar;C:\Documents and Settings\Администратор\.m2\repository\ch\qos\cal10n\cal10n-api\0.7.2\cal10n-api-0.7.2.jar;C:\Documents and Settings\Администратор\.m2\repository\org\slf4j\slf4j-api\1.5.10\slf4j-api-1.5.10.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-build-config\1.1.4.Final\weld-build-config-1.1.4.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\org\json\json\20160212\json-20160212.jar;C:\Documents and Settings\Администратор\.m2\repository\com\google\inject\guice\4.0\guice-4.0.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Documents and Settings\Администратор\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Documents and Settings\Администратор\.m2\repository\com\j256\ormlite\ormlite-core\4.47\ormlite-core-4.47.jar;C:\Documents and Settings\Администратор\.m2\repository\com\j256\ormlite\ormlite-jdbc\4.47\ormlite-jdbc-4.47.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;D:\Rostislav\IDEs\IntelliJ IDEA Community Edition 2016.2.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.dugin.rostislav.image.Main
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/cache/RemovalListener
    at com.google.inject.internal.InheritingState.<init>(InheritingState.java:67)
    at com.google.inject.internal.InjectorShell$Builder.getState(InjectorShell.java:209)
    at com.google.inject.internal.InjectorShell$Builder.lock(InjectorShell.java:115)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:96)
    at com.google.inject.Guice.createInjector(Guice.java:73)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at com.dugin.rostislav.image.Main.main(Main.java:8)
    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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: com.google.common.cache.RemovalListener
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 13 more
Picked up _JAVA_OPTIONS: -Xmx512M

Process finished with exit code 1
“C:\Program Files\Java\jdk1.8.0\u 101\bin\Java”-Didea.launcher.port=7532”-Didea.launcher.bin.path=D:\Rostislav\IDEs\IntelliJ IDEA Community Edition 2016.2.2\bin”-Dfile.encoding=UTF-8-类路径“C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\charsets.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\deploy.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\access-bridge.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\cldrdata.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\dnsns.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\jaccess.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\jfxrt.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\localedata.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\nashorn.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\sunec.jar;C:\ProgramFiles\Java\jdk1.8.0\u 101\jre\lib\ext\sunjce\u provider.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\sunmsapi.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\sunpkcs11.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\ext\zipfs.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\javaws.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\jce.jar;C:\ProgramFiles\Java\jdk1.8.0\u 101\jre\lib\jfr.jar;C:\ProgramFiles\Java\jdk1.8.0\u 101\jre\lib\jfxswt.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\jsse.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\management-agent.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\plugin.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\resources.jar;C:\ProgramFiles\Java\jdk1.8.0\U 101\jre\lib\rt.jar;D:\Rostislav\Projects\OSLoader\OSLoaderServer\target\classes;C:\Documents and Settings\Аааааааиааааааааааааа1072;C:\Documents and Settings\Ааиаиаааиаааиаааааааааа1072;C:\Documents and Settings\Ааиааиааааиааааааааааа107;C:\Documents and Settings\Ааааиаааиаааааааааааа107;C:\Documents and Settings\Ааааиааааааааааааааа107;C:\Documents and Settings\Ааааиаааааааааааааааа;C:\Documents and Settings\Ааааиааааиаааааааааа1072;C:\Documents and Settings\Аааиаиааааиааааааааааа107;C:\Documents and Settings\Аааиаиаааааиаааааааа;C:\Documents and Settings\Ааааиаиаааиаааааааааааааааааа;C:\Documents and Settings\Аааиаиаааиаааиаааааааааm2\repository\org\jboss;C:\Documents and Settings\Аааааиаааиааиааааааааааа107;C:\Documents and Settings\Аааиааааиаааааааааааа1072;C:\Documents and Settings\Ааааиаааааааааааааааа107;C:\Documents and Settings\Ааиааааааиааааааааааа1072;C:\Documents and Settings\Ааааиаиаааиаааиаааааааа1072;C:\Documents and Settings\Ааааааааааа\.m2\repository\org\json\json\json\20160212\json-20160212.jar;C:\Documents and Settings\Аааиаиааиааааааааааа107;C:\Documents and Settings\Аааиаиаааааиаааааааа;C:\Documents and Settings\Аааааааааа\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Documents and Settings\Ааиаиаааиааааааааааааа;C:\Documents and Settings\Ааааиаааааааааааааааа;C:\Documents and Settings\Аааиаааааиаааааааааааа;D:\Rostislav\IDEs\IntelliJ IDEA社区版2016.2.2\lib\IDEA\u rt.jar“com.IntelliJ.rt.execution.application.AppMain com.dugin.Rostislav.image.Main
线程“main”java.lang.NoClassDefFoundError中出现异常:com/google/common/cache/RemovalListener
位于com.google.inject.internal.InheritingState.(InheritingState.java:67)
位于com.google.inject.internal.InjectorShell$Builder.getState(InjectorShell.java:209)
位于com.google.inject.internal.InjectorShell$Builder.lock(InjectorShell.java:115)
在com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)上
位于com.google.inject.Guice.createInjector(Guice.java:96)
位于com.google.inject.Guice.createInjector(Guice.java:73)
位于com.google.inject.Guice.createInjector(Guice.java:62)
位于com.dugin.rostislav.image.Main.Main(Main.java:8)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
在sun.reflect.Delegati
public class Test implements ITest {
}
import com.google.inject.AbstractModule;

public class TestModule extends AbstractModule {
    @Override
    protected void configure() {
        bind(ITest.class).to(Test.class);
    }
}
    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>4.0</version>
    </dependency>
"C:\Program Files\Java\jdk1.8.0_101\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=D:\Rostislav\IDEs\IntelliJ IDEA Community Edition 2016.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_101\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\access-bridge.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\rt.jar;D:\Rostislav\Projects\OSLoader\OSLoaderServer\target\classes;C:\Documents and Settings\Администратор\.m2\repository\org\xerial\sqlite-jdbc\3.8.11.2\sqlite-jdbc-3.8.11.2.jar;C:\Documents and Settings\Администратор\.m2\repository\com\netflix\rxjava\rxjava-core\0.20.7\rxjava-core-0.20.7.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-core\1.1.4.Final\weld-core-1.1.4.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\enterprise\cdi-api\1.0-SP4\cdi-api-1.0-SP4.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-api\1.1.Final\weld-api-1.1.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-spi\1.1.Final\weld-spi-1.1.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\annotation\jsr250-api\1.0\jsr250-api-1.0.jar;C:\Documents and Settings\Администратор\.m2\repository\org\javassist\javassist\3.14.0-GA\javassist-3.14.0-GA.jar;C:\Documents and Settings\Администратор\.m2\repository\com\google\guava\guava\r06\guava-r06.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\spec\javax\interceptor\jboss-interceptors-api_1.1_spec\1.0.0.Beta1\jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\interceptor\jboss-interceptor-spi\2.0.0.CR1\jboss-interceptor-spi-2.0.0.CR1.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\interceptor\jboss-interceptor-core\2.0.0.CR1\jboss-interceptor-core-2.0.0.CR1.jar;C:\Documents and Settings\Администратор\.m2\repository\org\slf4j\slf4j-ext\1.5.10\slf4j-ext-1.5.10.jar;C:\Documents and Settings\Администратор\.m2\repository\ch\qos\cal10n\cal10n-api\0.7.2\cal10n-api-0.7.2.jar;C:\Documents and Settings\Администратор\.m2\repository\org\slf4j\slf4j-api\1.5.10\slf4j-api-1.5.10.jar;C:\Documents and Settings\Администратор\.m2\repository\org\jboss\weld\weld-build-config\1.1.4.Final\weld-build-config-1.1.4.Final.jar;C:\Documents and Settings\Администратор\.m2\repository\org\json\json\20160212\json-20160212.jar;C:\Documents and Settings\Администратор\.m2\repository\com\google\inject\guice\4.0\guice-4.0.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Documents and Settings\Администратор\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Documents and Settings\Администратор\.m2\repository\com\j256\ormlite\ormlite-core\4.47\ormlite-core-4.47.jar;C:\Documents and Settings\Администратор\.m2\repository\com\j256\ormlite\ormlite-jdbc\4.47\ormlite-jdbc-4.47.jar;C:\Documents and Settings\Администратор\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;D:\Rostislav\IDEs\IntelliJ IDEA Community Edition 2016.2.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.dugin.rostislav.image.Main
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/cache/RemovalListener
    at com.google.inject.internal.InheritingState.<init>(InheritingState.java:67)
    at com.google.inject.internal.InjectorShell$Builder.getState(InjectorShell.java:209)
    at com.google.inject.internal.InjectorShell$Builder.lock(InjectorShell.java:115)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:96)
    at com.google.inject.Guice.createInjector(Guice.java:73)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at com.dugin.rostislav.image.Main.main(Main.java:8)
    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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: com.google.common.cache.RemovalListener
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 13 more
Picked up _JAVA_OPTIONS: -Xmx512M

Process finished with exit code 1
<dependencies>
    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>4.0</version>
    </dependency>
</dependencies>