Solved

Need help with file input/output from servlet

Posted on 2006-11-05
2
245 Views
Last Modified: 2013-11-24
I have a servlet that I'm trying to read from a file and write it back out with new objects added to it, but the the servlet can not find the file.  It's running on Tomcat so i'm almost sure it has to do with the catalina.policy file.

I believe that i need to do something similar to the following but i'm not sure if it is correct and if it is where do i need to place it in the catalina.policy file.  Also, would i need to remove anything from the catalina.policy file?

grant codeBase "file:${catalina.home}/webapps/ROOT/conf" {
      permission java.io.FilePermission "${catalina.home}/webapps/ROOT/conf  myfile.txt", "read,write,delete";
};

Or do you guys have any other ideas as to why it may not be able to find the file?
0
Comment
Question by:tbboyett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 17879271
whats the error?
more likely that it can't find the file than a security exception. Why are u using a security manager?

If its not finding the file try using the ServlketContext getRealPath() method toi get the file path
0
 
LVL 5

Author Comment

by:tbboyett
ID: 17884648
as usual you are correct objects, thanks once again :D
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question