try
{
propFile=new File("names.txt");
synchronized(this)
{
if(propFile.exists())
myNames.load(new FileInputStream(propFile));
}
}
try
{
synchronized(this)
{
myNames.store(new FileOutputStream(propFile),"Previously Registered
Visitors");
}
}
The load method does not seem to be causing any problems, but when the store
method is called the html page locks up for a little while, and I then
recieve an error on the server saying the following:
java.io.FileNotFoundException: names.txt (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at Register.doGet(Register.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at
sun.servlet.http.HttpServerHandler.sendResponse(HttpServerHandler.java:165)
at
sun.servlet.http.HttpServerHandler.handleConnection(HttpServerHandler.java:1
21)
at sun.servlet.http.HttpServerHandler.run(HttpServerHandler.java:90)
at java.lang.Thread.run(Thread.java:536)
java.io.IOException: tried to write more than content length
at
sun.servlet.http.HttpOutputStream.check(HttpOutputStream.java:282)
at
sun.servlet.http.HttpOutputStream.write(HttpOutputStream.java:318)
at
sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:334)
at
sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:403)
at
sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:407)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:150)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
at java.io.PrintWriter.flush(PrintWriter.java:120)
at sun.servlet.http.HttpResponse.finish(HttpResponse.java:337)
at
sun.servlet.http.HttpServerHandler.handleConnection(HttpServerHandler.java:1
33)
at sun.servlet.http.HttpServerHandler.run(HttpServerHandler.java:90)
at java.lang.Thread.run(Thread.java:536)
If anyone could tell me what I am doing wrong with the store method, I would
appreciate it. Thank You.
--
Nathan Sokalski
njsok...@hotmail.com
http://studentwebs.kutztown.edu/soka0908/HomePage.html
"Nathan Sokalski" <njsok...@hotmail.com> wrote in message
news:b8ccqo$8g3rb$1...@ID-191000.news.dfncis.de...
"Andy Flowers" <andrew....@npspam.ntlworld.com> wrote in message
news:qIqqa.1482$ZS4....@newsfep4-glfd.server.ntli.net...
Replace the .store command with propFile
System.out.println( propFile.getAbsolutePath());
System.out.println( propFile.getCanonicalPath());
to confirm that where you think the servlet engine is putting the file is
where it is being put.
Once you have this information it 'may' be a little better to debug.
Which servlet engine are you using and on which OS and which JDK ?
"Nathan Sokalski" <njsok...@hotmail.com> wrote in message
news:b8evm7$96gju$1...@ID-191000.news.dfncis.de...