Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > is there a policy type file needed for JSP file privileges?

Reply
Thread Tools

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

 
 
anikkar@gmail.com
Guest
Posts: n/a
 
      11-07-2005
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!?

 
Reply With Quote
 
 
 
 
josh.s17@gmail.com
Guest
Posts: n/a
 
      11-08-2005
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.

 
Reply With Quote
 
 
 
 
anikkar@gmail.com
Guest
Posts: n/a
 
      11-08-2005
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.

 
Reply With Quote
 
josh.s17@gmail.com
Guest
Posts: n/a
 
      11-10-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Policy map using policy map Geoffrey Sinclair Cisco 1 07-27-2009 09:31 AM
data, jsp and jsp tag problem, best practice needed quickcur@yahoo.com Java 5 10-05-2006 04:19 AM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
Default Domain Policy vs Default Domain Controller Policy Tyler Cobb MCSE 6 10-19-2005 09:36 PM
Default Domain Policy vs. Default Domain Controller Policy Tyler Cobb MCSA 1 10-09-2005 03:42 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57