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.

-Brandon

On Thu, Mar 11, 2010 at 5:20 AM, bysse <[email protected]> wrote:

> I'm getting a ClassCaseException when i try to use GuiceFilter on
> JBoss 4.2.2.
> It's probably because of different versions of servlet-api (2.4 in
> JBoss) but i can't find a way around it. Have anyone had this problem
> and solved it? J
>
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to