Message3984

Author doublep
Recipients doublep
Date 2008-12-29.15:01:33
SpamBayes Score 7.757395e-05
Marked as misclassified No
Message-id <1230562895.56.0.496372949736.issue1216@psf.upfronthosting.co.za>
In-reply-to
Content
Jython doesn't use Thread.currentThread().getContextClassLoader() when
importing Java classes from Python code.  So, if Jython itself lives in
a 'small' classpath that cannot see the main code classes, the classes
will not be importable from Python code, at least not without extra
black magick.

Using the thread-context class path is a common idiom used by many
libraries that can dynamically load user classes.

Problems with class loaders are typical to web application, especially
large.  They often have convoluted hierarchy of class loaders.  E.g. I
have something like this:

    .... < Class loader X < ... < Main class loader

Jython is visible to X, while main classes become visible only to
higher-level class loader 'Main'.  So, currently Jython simply doesn't
see the application classes and fails to import them.

The attached patch does solve my problem.
History
Date User Action Args
2008-12-29 15:01:39doublepsetrecipients: + doublep
2008-12-29 15:01:35doublepsetmessageid: <1230562895.56.0.496372949736.issue1216@psf.upfronthosting.co.za>
2008-12-29 15:01:34doubleplinkissue1216 messages
2008-12-29 15:01:34doublepcreate