Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > catalina.policy OK, but in servlet "Permission denied"?
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 21st November 01:24
zorci
External User
 
Posts: 1
Default catalina.policy OK, but in servlet "Permission denied"?



Hi, after trying hours to write a file to disc from a servlet, I tried
to get the "WriteFileServlet" servlet example running as described in
http://www.oreilly.com/catalog/tomcat/chapter/ch06.pdf but it does NOT
work:

java.io.FileNotFoundException: /var/lib/tomcat4/webapps/ROOT/test.txt
(Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:10 2)
at java.io.FileOutputStream.(FileOutputStream.java:62 )
at java.io.FileOutputStream.(FileOutputStream.java:13 2)
at WriteFileServlet.service(WriteFileServlet.java:19)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.ac cess$0(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:243)
....

After restarting tomcat, catalina.policy contains the appropriate

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

Even if "${catalina.home}" is substituted by "/var/lib/tomcat4" or
give AllPermission for this file or the whole ROOT-directory it does
not work.

Btw, file reading from servlet and file reading/writing from a
seperate test.class started manually with "java test" works well.

Could it be that the owner of tomcat4/webapps/ROOT is root and not
tomcat4 and tomcat4 has thus no write permission? If so, where do I
have to add that permission or where can I change TOMCAT_USER to root
(/etc/tomcat4/tomcat4.conf does not exist!?)?

Any ideas?
  Reply With Quote


 


Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666