Hello all,
I'm attempting to have a separate class loaded by my session servlet
initially create an error log file to output any errors that occur in the
servlet or other supporting classes. I've debugged it and isolated the
problem to be the actual 'createNewFile()' method to be the culprit. I can
run the code with no problems using servletrunner from my local machine - I
can make my remote data connections as well as create the log file. But when
the servlet is placed on the server, the servlet hangs at the file creation
point. Since this is my error log, I don't have much as far as error msgs to
pass along, but a thought I did have was that there might be some sort of
security issue here in trying to create a new file through my servlet. Any
thoughts?
The server is currently running Apache with Jserv 1.0. I've attached the
code below. Thanks in advance ...
//There is nothing special in my servlet code other than the call to the
ErrorLog class constructor
public class Session extends HttpServlet
{
ErrorLog log = new ErrorLog();
Data accessData = new Data(log);
.....
}
// this is the errorLog class with most lines commented out for debugging
import java.io.*;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.Date;
public class ErrorLog {
String error = "no errors";
int errs = 0;
public String err = "no err";
// get an instance of the calendar object to report current date
//Calendar cal= Calendar.getInstance(TimeZone.getDefault());
// constructor for ErrorLog class
public ErrorLog()
{
// create error log file object
/* errorFile = new File("t" +
Integer.toString(cal.get(Calendar.MONTH)) +
Integer.toString(cal.get(Calendar.DAY_OF_MONTH)) +
Integer.toString(cal.get(Calendar.YEAR)) + ".log"); */
File errorFile = new File("testfile.txt");
// actually create the new physical file
try{
errorFile.createNewFile();
}
catch(IOException ioErr)
{
err = ioErr.getMessage();
} }
___________________________________________________________________________
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