commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: Deigester.parse(File f) method
Date Sat, 13 Nov 2004 16:58:49 GMT
Without seeing the exception message and the stack trace, it is almost
impossible for anyone to offer you much assistance.

If you're using the parse(File) method, one thing to ensure is that
you are calculating the path of the file you are trying to parse
correctly.  If it is a resource inside your webapp, you will need to
calculate that path based on the document root of your webapp:

  ServletContext context = ...;
  String path = context.getRealPath() + "/WEB-INF/web.xml";
  File file = new File(path);

However, this only works when getRealPath() actually returns something
-- it is not required to do so if the container is not running the app
straight out of a directory.  A better way to reference resource files
inside the webapp is like this:

  ServletContext context = ...;
  InputStream stream = context.getResourceAsStream("/WEB-INF/web.xml");


On Sat, 13 Nov 2004 21:17:18 +0600, Md. Rezaul Hoque
<> wrote:
> Hello,
> I m facing problem with Digester.parse() method. Within console
>'s working fine...but i am using it within tomcat it's
> throwing SAXException...........
> Can anybody can give any suggestion.....
> I am waiting for reply....
> Thanks in advance...
> Babu
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message