-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 3/22/2010 2:05 PM, Christopher Schultz wrote:
> Since the code is mine, I can easily instrument it and see what thread's
> context class loader is at the time.

I added this code to my InitListener class:

    {
        System.err.println("InitListener.<init> ClassLoader="
                           +
Thread.currentThread().getContextClassLoader());
    }

    // The following line used to be the first line inside the {} for
    // the class
    private Logger logger = Logger.getLogger(this.getClass());


...and it produced this output:

InitListener.<init> ClassLoader=WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
- ----------> Parent Classloader:
org.apache.catalina.loader.standardclassloa...@10a2d64

So, it looks like the ContextClassLoader is correct: the webapp's
ClassLoader is being used, not the container's or anything like that. Hmm.

I set -Djava.security.debug=access and here's what I can see:

(During loading of JAR files, etc.)
access: access allowed (java.io.FilePermission
/.../WEB-INF/lib/commons-logging-1.1.1.jar read)
access: access denied (java.util.PropertyPermission
org.apache.commons.logging.diagnostics.dest read)
access: access denied (java.util.PropertyPermission
org.apache.commons.logging.LogFactory.HashtableImpl read)

...

access: access allowed (java.io.FilePermission
/.../WEB-INF/classes/commons-logging.properties read)
access: access denied (java.util.PropertyPermission
org.apache.commons.logging.LogFactory read)

So, it looks like commons-logging.properties is allowed to be read, but
another property read is denied.

...
access: access denied (java.util.PropertyPermission
org.apache.commons.logging.Log.allowFlawedContext read)
access: access denied (java.util.PropertyPermission
org.apache.commons.logging.Log.allowFlawedDiscovery read)
access: access denied (java.util.PropertyPermission
org.apache.commons.logging.Log.allowFlawedHierarchy read)

...

/8215/webapps/cschultz-chadis/WEB-INF/lib/log4j-1.2.15.jar read)
access: access denied (java.util.PropertyPermission
log4j.defaultInitOverride read)

So, it looks like log4j is trying to read some property, so presumably
log4j is being correctly loaded, so it should be available for logging.

...

access: access denied (java.util.PropertyPermission log4j.debug read)
access: access denied (java.util.PropertyPermission log4j.configDebug read)
access: access denied (java.util.PropertyPermission log4j.configuration
read)
access: access denied (java.util.PropertyPermission
log4j.configuratorClass read)

...

access: access denied (java.util.PropertyPermission log4j.ignoreTCL read)

...

access: access denied (java.lang.RuntimePermission
defineClassInPackage.java.lang)

I'll have to look for the details of above.

...

access: access denied (java.io.FilePermission /.../logs/log4j.log write)

Uhh... well, that certainly looks like something I might have control
over :)

I'll fix that permission and try again.

(Tomcat attempts to de-register JDBC Driver)
access: access denied (java.lang.RuntimePermission getClassLoader)
access: access allowed (java.util.PropertyPermission line.separator read)
Mar 22, 2010 2:14:16 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesJdbc
WARNING: JDBC driver de-registration failed
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission getClassLoader)
        at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
        at
java.security.AccessController.checkPermission(AccessController.java:546)
        at
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at java.lang.Class.getClassLoader(Class.java:594)
        at
org.apache.catalina.loader.JdbcLeakPrevention.clearJdbcDriverRegistrations(JdbcLeakPrevention.java:49)

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkunudUACgkQ9CaO5/Lv0PDTmwCfddj+YYJLfIhMmNpVODC0Hyl2
yiUAnRnMRqF0QydA/t+PeqC46BRDx4d4
=1uhA
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to