Title: PrePy.getJarFileNameFromURL fails hard when Jython jar is embedded in another jar
Type: crash Severity: major
Components: Core Versions: Jython 2.7.2
Milestone: Jython 2.7.3
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: electricsam, jeff.allen, maku
Priority: normal Keywords:

Created on 2020-03-12.14:49:03 by maku, last changed 2020-07-11.19:15:45 by jeff.allen.

msg13014 (view) Author: Maku (maku) Date: 2020-03-12.14:51:30
For example, if the path to PrePy.class is jar:file:spring-boot-application.jar!/BOOT-INF/lib/jython-2.7.2.jar!/org/python/core/PrePy.class, the method will fail in new File() call in the end of method with java.lang.IllegalArgumentException: URI is not hierarchical in<init>( (on OpenJDK 11).
msg13016 (view) Author: Maku (maku) Date: 2020-03-12.14:52:29
This effectively makes it impossible to use Jython in such case, as the getJarFileNameFromURL gets called by any Jython initializer method.
msg13018 (view) Author: Jeff Allen (jeff.allen) Date: 2020-03-13.20:48:13
JARs in JARs is not a case I had considered. I tidied up the code around here from a previous implementation, fixing #2410. The move from to is not an issue, I think, it would be the code I changed when it was in, if I've broken anything.

Did this work in earlier versions (v2.7.1), with JARs in JARs?
msg13020 (view) Author: Maku (maku) Date: 2020-03-20.15:33:12
Yes, this did work with 2.7.1 and earlier 2.7.2 beta release.
msg13022 (view) Author: Jeff Allen (jeff.allen) Date: 2020-03-20.17:56:10
" ... and earlier 2.7.2 beta release".

Does this mean it worked in b2 but not b3? b3 but not rc1? (b1 never became public.)

This is hopeful, but puzzling. The change of logic and the move to PrePy precede 2.7.2b2 release. After that there is only affects vfs: or vfszip: URLs AFAICT.
msg13102 (view) Author: Chris Slater (electricsam) Date: 2020-06-06.00:52:21
I too am experiencing this with 2.7.2, b2, b3, and rc1.  I am using Spring Boot 2.2.6 and Oracle Java 1.8.0_202.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [gov.noaa.ncei.cmg.pycamel.PythonObjectFactory]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: URI is not hierarchical
        at org.springframework.beans.BeanUtils.instantiateClass(
        ... 24 more
Caused by: java.lang.IllegalArgumentException: URI is not hierarchical
        at org.python.core.PrePy.getJarFileNameFromURL(
        at org.python.core.PrePy._getJarFileName(
        at org.python.core.PrePy.getJarFileName(
        at org.python.core.PySystemState.doInitialize(
        at org.python.core.PySystemState.initialize(
        at org.python.core.PySystemState.initialize(
        at org.python.core.PySystemState.initialize(
        at org.python.core.PySystemState.initialize(
        at org.python.core.PySystemState.initialize(
        at org.python.core.PySystemState.<init>(
        at gov.noaa.ncei.cmg.pycamel.PythonObjectFactory.<init>(
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
        at java.lang.reflect.Constructor.newInstance(
        at org.springframework.beans.BeanUtils.instantiateClass(
        ... 26 more
msg13104 (view) Author: Jeff Allen (jeff.allen) Date: 2020-07-11.19:15:45
Date User Action Args
2020-07-11 19:15:45jeff.allensetmessages: + msg13104
2020-06-06 00:52:22electricsamsetmessages: + msg13102
2020-06-05 22:32:48electricsamsetnosy: + electricsam
2020-03-20 17:56:10jeff.allensetmessages: + msg13022
milestone: Jython 2.7.3
2020-03-20 15:33:13makusetmessages: + msg13020
2020-03-13 20:48:14jeff.allensetpriority: normal
resolution: accepted
messages: + msg13018
nosy: + jeff.allen
milestone: Jython 2.7.2 -> (no value)
2020-03-12 14:52:30makusetmessages: + msg13016
2020-03-12 14:51:30makusetmessages: + msg13014
2020-03-12 14:49:03makucreate