I'm trying to package (jar) an application which uses dbexts to load a
postgresql driver from a ini file.
Example ini file:
Everything is going along fine in the packaged (jar'ed) application until
dbexts tries to use the database. Then I get this error:
Lib/dbexts.py", line 0, in __init__
ImportError: No module named handler
This is the command line I use to run the demo --
java -classpath postgresql-8.0-312.jdbc3.jar:jython.jar:demo.jar tests
java -classpath postgresql-8.0-312.jdbc3.jar;jython.jar;demo.jar tests
where tests is a python module tests.py running some tests. As I said,
that basic part works (under either).
The jython.jar file is one I made as a developer build from CVS, but I do
not especially think that is the problem. In fact, I only include it
there, despite doing a build all, because somehow if I don't I get a:
ImportError: cannot import name zxJDBC
so something in the --all isn't getting into my demo.jar file perhaps?
(Obviously I need jython.jar without the --all build).
I think what is going wrong here is that somehow that this one dynamically
loaded class is not found in its jar file because something about the
packaging was done wrong (by me, or the packager?)
When I make a --bean, everything works OK when I have a copy of the jython
Lib directory tree in the application directory. Presumably the dbexts
class is dynamically loading things better then. I guess I can live with
that, but I'd rather have all the python support files in the jar file.
It is when I try to use --all to package things that I get this problem,
almost like it is not looking into the postgresql jar file.
When packaging, I get com.ziclix.python.sql as a required Java package,
but not the longer com.ziclix.python.sql.handler.
I even tried adding a "-A
to the command line, as in (becuase I am using a custom built jython from
CVS), for example:
java -jar jython_distribution/jython.jar
jython_distribution/Tools/jythonc/jythonc.py --all -A
--jar demo.jar *.py
But it still doesn't work. And in any case, it seems having to specify
the class when packaging would defeat the purpose of using an INI file to
specify the database driver. (But I may not understand that option).
I can probably hardcode the database into the file and packagae for only
that one driver, but I'm trying to keep the system flexible (the whole
point of dbexts). Or I can go with --bean and including the Lib directory.
Anyway, I'd still like to make the complete jar file work.
Any ideas on what I am missing here?