Howdy,

>i i write in one servlet this:
>String whereIs = ((ServletContext)request).getRealPath("/");
>in tomcat appears this error, can any body help me? Thanks

What are you trying to do? ;)

A request is not a context.  So what you're doing is an invalid cast and
the JVM correctly throws an exception at runtime.

Assuming the above code is in a servlet, you can just do:
String whereIs = getServletContext().getRealPath("/");
To get the "real" (file) path to the docBase of your webapp.  As the
code suggests, this path is request-independent.

Note that this wouldn't work if you're running from a packed .war
archive.

Yoav Shapira
Millennium ChemInformatics

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to