Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

is there a policy type file needed for JSP file privileges?

Thread view: 
anikkar@gmail.com - 07 Nov 2005 22:17 GMT
hi,

I am just getting started with JSPs, and i am writing a few small
utility files, and i am having trouble writing to a text file.

my java file is as such:

import java.io.*;

public class Utils {

    public static final int EOF = -1;

    public static String writeFile(String file) {
        try {
            BufferedWriter out = new BufferedWriter(new FileWriter(file));
            out.write("This is a test");
            out.close();
            return "succes";

        }
        catch(Exception e) {
            return e.getMessage();
        }

    }
}

and my jsp:

<%@ page import="java.util.Enumeration"%>
<%@ page import="com.lambandtunafish.Utils"%>
<html>
<body>
<B>Test</B><BR>
<%
        out.println(Utils.writeFile("/home/content/b/u/d/budweiser/html/test/test.txt"));

        %>
</body>
</html>

But when I run it, I get the following:

access denied (java.io.FilePermission
/home/content/b/u/d/budweiser/html/test/test.txt write)

I have tried it both when the test.txt file exists, and does not exists
(i.e. java creates the file). I do have read permission, as I have been
able to read from the file.

what I am having trouble with is setting the write permission

I have tried contacting my hosting company, and as usual i got the
simple response of: "make sure your permissions are set
correctly"...which i'm not so sure on how to do that with java...any
ideas..thanks!?
josh.s17@gmail.com - 08 Nov 2005 09:27 GMT
It may be related to the way your application server is configured. I
know with websphere the default settings do not allow an application to
write to the file system.
anikkar@gmail.com - 08 Nov 2005 19:41 GMT
yea, that may be the case, if so, does that mean I am pretty much
screwed if I want to do any File output?

my provider is godaddy, and theier tomcat version is 5.0.27.
josh.s17@gmail.com - 10 Nov 2005 09:02 GMT
I'm not familiar with changing that setting for Tomcat but I'm sure it
is possible. Whether your provider will allow you to change it is
another matter


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.