Build path issues learning Guice

Posted by Preston on Stack Overflow See other posts from Stack Overflow or by Preston
Published on 2013-11-04T02:36:42Z Indexed on 2013/11/04 3:54 UTC
Read the original article Hit count: 336

Filed under:
|
|

I can't figure out why I'm getting this error below I have included all the appropriate jars as far as I can tell(I have included eclipses .classpath file below.) All of the classpath entries resolve just fine. What am I missing?

The type javax.servlet.ServletContextListener cannot be resolved. It is indirectly referenced from required .class files on the "extends GuiceServletContextListener" line

-

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 
           }

       });
    }

}

.Classpath

    <?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>

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse