|
From: <bc...@wo...> - 2001-02-03 19:35:29
|
[Robert W. Bill]
>Hello all,
>
>This is a generic classpath question but I ran into it while looking at
>the recently discussed servlet dispatcher on Win98 (Tomcat 3.2.1, windows98 and
>jdk1.2.2).
>
>When Tomcat loads jar's from it's lib directory it loads them in ALL CAPS (i.e.
>%TOMCAT_HOME%\lib\SERVLET.JAR). When this happens, Jython cannot load
>classes contained in that jar. After looking closer I realized I could
>not load any classes from a jar file that is in the classpath with an
>all-caps ".JAR" extension.
>
>[dos windows]
>C:\>set CLASSPATH=c:\myapp\TEST.JAR
>C:\>jython
>Jython 2.0 on java1.2.2 (JIT: symcjit)
>Type "copyright", "credits" or "license" for more information.
>>>>from test import unitTest
>Traceback (innermost last):
> File "<console>", line 1, in ?
>ImportError: cannot import name unitTest
>
>However, java apps still successfully use 'import test.unitTest.*;'
>
>If I use "set CLASSPATH=c:\myapp\TEST.jar", all is fine.
>
>I'm not a Windows expert, but I had the impression that everything was
>supposed to support such name mangling.
Remember that we are parsing the CLASSPATH value with code like:
for (int i = 0; i < paths.__len__(); i++) {
String entry = paths.get(i).toString();
if (entry.endsWith(".jar") || entry.endsWith(".zip")) {
addJarToPackages(new File(entry),true);
>The questions:
>
> Is this really the current behavior or am I confused?
Yes, and apparently yes <wink>.
> is this expected behavior?
No.
>Depending on the answers, I'll look at the classloader or pass along
>another jython servlet dispatcher with some name-munging and os.sep.
Just for info, I have added a version of PyServlet in org.python.util
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/jython/org/python/util/PyServlet.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jython
There is still some issues to solve, like how we should add a sensible
default sys.path that atleast include the directory of the loaded .py
file and how we should manage the namespace of the loaded .py files.
regards,
finn
|