Issue1639

classification
Title: JBoss 5, vfszip protocol in use for jarFileName in PySystemState
Type: crash Severity: normal
Components: Core Versions: 2.5.1, 2.5.2b1
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: otmarhumbel Nosy List: elentz, fwierzbicki, otmarhumbel
Priority: high Keywords: patch

Created on 2010-08-09.14:14:39 by elentz, last changed 2012-06-29.14:38:11 by fwierzbicki.

Files
File name Uploaded Description Edit Remove
PySystemState.py.patch elentz, 2010-08-09.14:14:37 2.5.2b1 patch for PySystemState.java only
1639patch.txt otmarhumbel, 2010-10-09.07:50:42 a proposed patch
Messages
msg5946 (view) Author: Eric Lentz (elentz) Date: 2010-08-09.14:14:37
Symptom:
Deploying a web app in JBoss 5.x (and later, I think), the classpath is ['__classpath__', '__pyclasspath__/'] but it should also contain $JBOSS_HOME/{DEPLOYMENT}/WEB-INF/lib/Lib and $JBOSS_HOME/{DEPLOYMENT}/WEB-INF/lib/jython.jar/Lib. Therefore, one is unable to import any libraries and one receives the error: "ImportError: No module named ..."

Reason for the error:
JBoss 5.x introduces the vfszip protocol for jar files. org.python.core.PySystemState uses the jar:file protocol name in an attempt to parse a string that contains the jar filename out of a string that looks like "jar:file:/some/path/jython.jar!/org/python/core/PySystemState.class" in other containers. JBoss returns "vfszip:/some/path/jython.jar/org/python/core/PySystemState.class". Note the missing "!" and the protocol name is different.

The fix:
The fix is to also test for the vfszip: string and parse the resulting string in a way that extracts the jar filename. A patch for 2.5.2b1 is attached.

Additional Note:
It looks like JBoss is staying with vfszip, so this issue is not likely confined to version 5. The issue was originally spotted in Jython version 2.5.1, so that is a confirmed affected version as well.
msg5947 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-08-09.14:52:42
Thanks for the patch - i'll take care of it!
msg6088 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-09-22.23:33:18
promised to fix rigth after JavaOne
msg6155 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-10-07.20:24:04
Eric,

on Windows, the URL contains a leading slash right after vfszip:, e.g.:
vfszip:/C:/Bison/lchload2/JBoss5/bin/jboss/server/bison/deploy/bison.ear/extlib/jython.jar/org/python/core/PySystemState.class

This needs to be removed in order to get a working path.

Can you confirm that everything after vfszip: belongs to a valid path on *nix (like your patch suggests) ?
msg6157 (view) Author: Eric Lentz (elentz) Date: 2010-10-08.12:12:11
Yep, its all valid path. On the Solaris 10 system I'm using and the Fedora Linux 12 system, they have numerous log file references that speak to vfszip:/a/valid/path. So, we would want everything after the ":", minus the /org/python/core/PySystemState.class, just as the patch does.

So, a question for you. Are you concerned about the leading "/" before the "C:"? I didn't make an exhaustive search of PySystemState.py, but I see the result of the method call being used at least in findRoot which uses it in a File class. At least on 1.5.0_22, a leading slash is okay.

Test:
File testFile = new File("/D:/tmp/Foo.txt");
if(testFile.isFile() && testFile.canRead())
  System.out.println("It is a readable file");
BufferedReader input = new BufferedReader(new FileReader(testFile));
System.out.println(input.readLine());

Outputs:
It is a readable file
This is the contents of Foo.txt  (which is what is in Foo.txt, so it works fine)

Thanks for your care and attention to this issue.
msg6158 (view) Author: Eric Lentz (elentz) Date: 2010-10-08.12:13:56
Oh, I re-read your message and see you are concerned about it. Based on my test, do you still think it is an issue?
msg6159 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-10-09.07:47:00
Eric,

many thanks for all your tests!

In short: yes i am still concerned about the leading slash on windows.
Our Jython embedding in JBoss 5 did not work this way, i had to remove the slash. Sadly i don't exactly remember why, and i have no possibility to verify it until in 2 weeks.

My suggestion is to distinguish between windows and other platforms for the moment
msg6160 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-10-09.07:50:42
The attached 1639patch.txt fixes the problem - to the best of my knowledge
msg6161 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-10-09.07:55:52
fixed in revision 7141
msg6165 (view) Author: Eric Lentz (elentz) Date: 2010-10-11.12:00:34
Thanks Oti. Looks great!
History
Date User Action Args
2012-06-29 14:38:11fwierzbickisetnosy: + fwierzbicki
2010-10-11 12:00:35elentzsetmessages: + msg6165
2010-10-09 07:55:52otmarhumbelsetstatus: open -> closed
resolution: fixed
messages: + msg6161
2010-10-09 07:50:46otmarhumbelsetfiles: + 1639patch.txt
messages: + msg6160
2010-10-09 07:47:01otmarhumbelsetmessages: + msg6159
2010-10-08 12:13:56elentzsetmessages: + msg6158
2010-10-08 12:12:12elentzsetmessages: + msg6157
2010-10-07 20:24:05otmarhumbelsetmessages: + msg6155
2010-09-22 23:33:18otmarhumbelsetmessages: + msg6088
2010-08-22 22:42:28zyasoftsetpriority: high
2010-08-09 14:52:42otmarhumbelsetassignee: otmarhumbel
messages: + msg5947
nosy: + otmarhumbel
2010-08-09 14:14:40elentzcreate