Hello,
I wonder whether anybody could help me, I've got a problem with a servlet
I've written. I'm trying to access a file which is located in the same
directory as the servlet I'm using. This file is to be loaded into the
servlet but I'm having a few problems doing this. The path to the file is
correct as I've tried accessing the file using getRealPath which returns
the full path to the file. However when I try to load the file in the
following way :
filePath = this.getServletContext().getRealPath("DigiPublic.key");
ObjectInputStream in = new ObjectInputStream(new FileInputStream(filePath));
publicKey = (java.security.PublicKey)in.readObject();
an exception is thrown saying I can't access the file.
Verifying... 34857teigudhdrtg87
[EmbeddedTomcat] java.io.FileNotFoundException: (The system cannot find
the file specified)
[EmbeddedTomcat] at java.io.FileInputStream.open(Native Method)
Could anybody tell me why exactly this is. I'm assuming it's something
related to security which disallows me to access the file. Do I need to
declare the file as a resource in the web.xml file which is part of the
deployed war file? If so how exactly should this be done? If this is a
security problem is it simply a case of setting permissions or granting
permissions using a policy file? On the other hand if there is something
I've completely overlooked then could somebody please point me in the right
direction with this problem, any help would be greatly appreciated.
Thanks.
Jonathan Holloway.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html