I'm not exactly familiar with your problem so I'll have to setup an
example to understand it better. One of the targets of the next
release will be improved Java importing so this scenario can be added
to the list.
On Jan 1, 2005, at 05:23 AM, timur mehrvarz wrote:
> Happy new year!
> My problem is similar to what is described here:
> I am trying to run my Jython 2.1 scripts inside an OSGI container
> (Oscar: http://oscar.objectweb.org/). Problem is, that my Jython
> scripts cannot make use of Java packages, provided by the OSGI
> (parent-)classloader. (These Java classes are stored in their original
> Jar files, but are wrapped with a surrounding Jar file, called
> Bundles.) In my OSGI-BundleActivator class, I instantiate a
> PythonInterpreter() and my Jython scripts are getting executed fine.
> However, while they are able to see the buildin modules (sys, time,
> etc.), they do not see any Java classes/packages which are provided by
> the OSGI framework (such as 'org.apache.log4j.Logger' and many
> Looks like the Jython PackageManager is not aware of such packages,
> and therefor sys.classLoader (ModuleClassLoader) doesn't even try to
> load such packages dynamically through it's parent classloader (the
> OSGI classlaoder in this case).
> In my Jython script I have:
> import org.apache.log4j.Logger
> When I execute it in the context of the OSGI framework, I get:
> import: trying org.apache.log4j as java class in classLoader
> Traceback (innermost last):
> File "<iostream>", line 36, in ?
> AttributeError: java package 'org.apache' has no attribute 'log4j'
> What can I do, to get this working in Jython 2.1?
> (And will Jython 2.2 be more dynamic in regard to parent classloaders?)
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> Jython-dev mailing list