vipx / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

com.google.inject.servlet.GuiceFilter cannot be cast to javax.servlet.Filter #583

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi all,

I'm trying to run a very simple web project in Eclipse (Helios) using Tomcat 
5.5.28..
but I get this really strange error: 

SEVERE: Exception starting filter guiceFilter
java.lang.ClassCastException: com.google.inject.servlet.GuiceFilter cannot be 
cast to javax.servlet.Filter
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:208)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3666)
    ...

My web.xml is really simple (almost the same from the quick guide):

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <display-name>auth-server</display-name>

    <!-- Default page to serve -->
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <filter>
        <filter-name>guiceFilter</filter-name>
        <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>guiceFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>it.concept.mykwave.authserver.client.GuiceClientServletConfig</listener-class>
    </listener>

</web-app>

Do you have any idea?

Thanks in advance,

 CA

Original issue reported on code.google.com by lordk...@gmail.com on 4 Jan 2011 at 9:10

GoogleCodeExporter commented 9 years ago
SOLVED: sorry, it was my fault..

I'm using maven and in my pom.xml I missed to add "<scope>provided</scope>" to 
"servlet-api" dependency:

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>

Now it works... (so you can close this issue!)

Original comment by lordk...@gmail.com on 4 Jan 2011 at 1:16

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 4 Jan 2011 at 2:08