You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Sergey V. Udaltsov" <se...@clients.ie> on 2001/10/22 02:55:16 UTC

policy for classes in WEB-INF/lib/my.jar

Hi all

There is my class (bean) in some jar file. I put this file into
WEB-INF/lib directory - so my jsps are able to find it. But when I am
trying to write to the file /tmp/my.log, I get the security
AccessControlException. 
I added
grant codeBase
"file:${catalina.home}/webapps/myapp/WEB-INF/lib/my.jar!/-" {
      permission java.io.FilePermission "/tmp/-", "read, write";
};
But this does not help. When I had a look at the class loader for this
class, I found there are NO repositories associated(?!), so policy rule
is not effective here.

Are there any ideas how to fix/workaround this? I would not like to give
 permission java.io.FilePermission "/tmp/-", "read, write";
to all servlets...

I run tomcat 4.0 with -security option (since I need RMI).

Regards,

Sergey

The classloader:

WebappClassLoader
  available:
  delegate: false
  repositories:
  required:
----------> Parent Classloader:
StandardClassLoader
  available:
  delegate: false
  repositories:
    file:/usr/local/tomcat4/lib/jasper-runtime.jar
    file:/usr/local/tomcat4/lib/naming-factory.jar
  required:
----------> Parent Classloader:
StandardClassLoader
  available:
    Extension[javax.mail, implementationVendor=Sun Microsystems, Inc.,
implementationVendorId=com.sun,
 implementationVersion=1.2, specificationVendor=Sun Microsystems, Inc.,
specificationVersion=1.2]
  delegate: false
  repositories:
    file:/usr/local/tomcat4/common/classes/
    file:/usr/local/tomcat4/common/lib/activation.jar
    file:/usr/local/tomcat4/common/lib/crimson.jar
    file:/usr/local/tomcat4/common/lib/jaxp.jar
    file:/usr/local/tomcat4/common/lib/jdbc2_0-stdext.jar
    file:/usr/local/tomcat4/common/lib/jta-spec1_0_1.jar
    file:/usr/local/tomcat4/common/lib/ldap.jar
    file:/usr/local/tomcat4/common/lib/mail.jar
    file:/usr/local/tomcat4/common/lib/naming-common.jar
    file:/usr/local/tomcat4/common/lib/naming-resources.jar
    file:/usr/local/tomcat4/common/lib/servlet.jar
    file:/usr/local/tomcat4/common/lib/tyrex-0.9.7.0.jar
    file:/usr/local/tomcat4/common/lib/providerutil.jar
  required:
----------> Parent Classloader:
sun.misc.Launcher$AppClassLoader@621e42
to