我不知道为什么会在下面出现此错误,据我所知,我已经包含了所有适当的 jar(我在下面包含了 eclipses .classpath 文件。)所有类路径条目都可以很好地解决。我错过了什么?
javax.servlet.ServletContextListener 类型无法解析。它是从“extends GuiceServletContextListener”行上所需的 .class 文件中间接引用的
-
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;
public class ServletConfig extends GuiceServletContextListener {
@Override
protected Injector getInjector() {
return Guice.createInjector(new ServletModule(){
@Override
protected void configureServlets() {
// TODO: add necessary code to bind
}
});
}
}
.类路径
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_21">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="oracle.eclipse.tools.glassfish.lib.system">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="guice-3.0/aopalliance.jar"/>
<classpathentry kind="lib" path="guice-3.0/guice-3.0.jar"/>
<classpathentry kind="lib" path="guice-3.0/guice-servlet-3.0.jar"/>
<classpathentry kind="lib" path="guice-3.0/javax.inject.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>