以下でこのエラーが発生する理由がわかりません。私が知る限り、適切な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>