You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robin Green <gr...@hotmail.com> on 2000/12/04 19:49:34 UTC

Re: Solution!! Re: [C2] [TC 4.0m4+] ClassCastException

Must be a ClassLoader problem - that would explain the bad cast. This should 
not happen though. I'm X-posting to tomcat-user@jakarta.apache.org. Sorry if 
this is a FAQ.

Stuart Roebuck <st...@adolos.co.uk> wrote:
>For all those who have been frustratedly putting up with my posts about not 
>getting Cocoon 2 working under the latest Tomcat release, I am hughly 
>relieved to say that it now works.  But I now lay the challenge of trying 
>to work out why the following patch solves the problem!
>
>Index: ./src/org/apache/cocoon/matching/WildcardURIMatcherFactory.java
>===================================================================
>RCS file: 
>/home/cvspublic/xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java,v
>retrieving revision 1.1.2.21
>diff -u -r1.1.2.21 WildcardURIMatcherFactory.java
>--- 
>./src/org/apache/cocoon/matching/WildcardURIMatcherFactory.java	2000/11/30 
>21:41:49	1.1.2.21
>+++ 
>./src/org/apache/cocoon/matching/WildcardURIMatcherFactory.java	2000/12/04 
>12:00:20
>@@ -52,7 +52,7 @@
>      public String generateMethodSource (NodeIterator conf)
>      throws ConfigurationException {
>          return "ArrayList list = new ArrayList();" +
>-               "String uri = ((HttpServletRequest) 
>objectModel.get(Cocoon.REQUEST_OBJECT)).getRequestURI();" +
>+               "String uri = 
>((org.apache.cocoon.environment.http.HttpRequest) 
>objectModel.get(Cocoon.REQUEST_OBJECT)).getRequestURI();" +
>                 "if (uri.startsWith(\"/\")) uri = uri.substring(1);" +
>                 "if 
>(org.apache.cocoon.matching.helpers.WildcardURIMatcher.match (list, uri, 
>pattern)) {" +
>                 "return list;" +
>
>As you can see, I have simply replaced the casting of 
>objectModel.get(Cocoon.REQUEST_OBJECT) to a HttpServletRequest with a cast 
>to a org.apache.cocoon.environment.http.HttpRequest.  My debugging seemed 
>to prove that the original object was an 
>org.apache.cocoon.environment.http.HttpRequest, but such an HttpRequest 
>should inherit from HttpServletRequest, as at least one person on the group 
>has already said, so the original cast should be completely valid.
>
>However, this has done the trick.  Everything now works!
>
>Why? ... answers on a postcard.




_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com