java.lang.ClassCastException: com.google.inject.servlet.GuiceFilter
cannot be cast to javax.servlet.Filter
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:
255)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:
397)
...
Boss 5 is unfortunately not an option here. My configuration works
flawless in my tests with Jetty...
thanks
Erik
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
I have had this problem before.
Are you using maven by any chance?
If so, make sure that you've made servlet-api a provided dependency.
For some reason, guice-servlet's pom declares that it has a compile time dependency on servlet-api. This causes the servlet-api classes to be loaded into your war. Since there are two defined copies of the servlet api classes (in two different class loaders) a CCE occurs.
On Fri, Mar 12, 2010 at 4:44 AM, Brandon Atkinson
Guice servlet's 'servlet-api' dependency should be declared in 'provided' scope. The sematics of this are described here:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
In short, a provided dependency is fetched and put in the compile and test classpaths, but is not packaged, because it is expected to be provided at runtime by the container/jvm/etc..
...
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>runtime</scope>