[Web-SIG] Modjy and external packages.
Alan Kennedy
py-web-sig at xhaus.com
Wed Oct 6 16:22:59 CEST 2004
Dear All,
I've just had an email from a modjy user who was delighted to get lucene
(the excellent java text indexing engine[1]) up and running under
WSGI/modjy. Cool B-)
But there is one little trick that one needs to know to make such things
work. This is a trick that most jythonistas know, but if one doesn't
know it, finding why the relevant imports don't work can be infuriating.
When referencing external jars in modjy applications, it is not
sufficient to place the jar on the classpath, or to place it in the
WEB-INF/lib directory.
You *also* have to inform jython about the existence of the package.
This is very simple to do, by adding a simple declaration to your
modules, like so
#######
import sys
sys.add_package('org.apache.lucene')
#######
And that's it.
I will be releasing a micro revision to modjy at the weekend which
supports doing this through a configuration parameter, rather than the
mildly ugly approach outlined above.
Happy modjy'ing!
Regards,
Alan.
[1] " Jakarta Lucene is a high-performance, full-featured text search
engine library written entirely in Java."
http://jakarta.apache.org/lucene
More information about the Web-SIG
mailing list