You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Morten Andersen <mo...@mip.sdu.dk> on 2003/09/16 16:14:08 UTC
Using ParameterMap throws ClassCastException
I am using the ParameterMap in request in an authentication mechanism.
Therefore I need to do the following:
add a mapping of parameters to the request.getParameter(). I do the following:
import org.apache.catalina.util.ParameterMap;
...
System.out.println("ParameterMap is a: "+
request.getParameterMap().getClass().getName());
try{
ParameterMap map = (ParameterMap)request.getParameterMap();
map.setLocked(false);
map.putAll(values.getParameterMap());
map.setLocked(true);
}catch(Exception e){
e.printStackTrace();
}
This gives the following output:
ParameterMap is a org.apache.catalina.util.ParameterMap
And a ClassCastException in this line:
ParameterMap map = (ParameterMap)request.getParameterMap();
So it seems that they reference to two different class-definitions, but I
am using the same catalina.jar everywhere. (included it in the WEB-INF/lib dir)
If I put catalina.jar in the WEB-INF/lib dir, then the above error is
reported, else a ClassNotFoundException is thrown.
I'm using tomcat-4.1 and found the class in the catalina.jar file. Where
else is it?
Thanks
Morten Andersen
Master of applied mathematics and computer science
Research assistant (in e-learning)
The Maersk Institute of Production technology at Southern Danish University
www.mip.sdu.dk
Campusvej 55
DK-5230 Odense M
Denmark
+45 6550-3654
+45 6171-1103
Jabber id: hat@jabber.dk