Craig:

Well I'm 100% positive it's a security issue. I've tried all sorts of path
combinations (relative and absolute) with no success and I do have rwx
access to the directory. I wasn't aware that servlets needed a policy file.
I am currently trying to put a policy file in place - is it just the
java.security  file that needs to be modified with the "policy.url.n =
/dir/sudir/subdir/policy file"?

Thanks in advance

sc

                -----Original Message-----
                From:   Craig R. McClanahan
[mailto:[EMAIL PROTECTED]]
                Sent:   Tuesday, August 31, 1999 1:03 PM
                To:     [EMAIL PROTECTED]
                Subject:        Re: Log File Creation Problem

                "Campbell, Sean" wrote:

                > 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 most likely cause is that you don't have write access to
the current
                working directory in which the servlet engine is running
(this is usually "/"
                on Unix-based Apache installs where JServ is started
automatically, but it can
                be changed).  This is important because you are using a
simple filename instead
                of an absolute path.  Change "testfile.txt" to
"/tmp/testfile.txt" or some
                other path which you have write access to, and try again.

                Another possible cause for problems, if you are running JDK
1.2, is that you
                might be getting a permissions exception.  In this case, you
will need to set
                up a Java security policy that allows you to write files in
the directory you
                specify -- even if the OS lets you write there.

                In either case, the text of the error message produced by
the exception will
                tell you more about what's really going on -- you should
write it to someplace
                visible (such as System.out.println()).  For instructions on
how to determine
                where this output goes with Apache JServ, see the server
configuration
                documentation, or the FAQ-O-MATIC at http://java.apache.org
for more
                information.

                Craig McClanahan


___________________________________________________________________________
                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

___________________________________________________________________________
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

Reply via email to