Issue2703

classification
Title: JycompileAntTask cannot find org.python.apache.tools.ant.taskdefs.MatchingTask
Type: crash Severity: normal
Components: Core Versions:
Milestone: Jython 2.7.2
process
Status: pending Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: jeff.allen
Priority: normal Keywords:

Created on 2018-09-08.12:40:33 by jeff.allen, last changed 2019-07-21.19:22:09 by jeff.allen.

Messages
msg12094 (view) Author: Jeff Allen (jeff.allen) Date: 2018-09-08.12:40:32
As raised on GitHub: https://github.com/jythontools/jython/issues/109, it looks like we have transformed references to some libraries we depend on, but have not supplied transformed libraries to match, in the distributable JARs. In this case it's ant.jar, but as the fault is probably that we rename org.apache.** wholesale, it may not stop there.

Either we should be more refined in our selection of packages to rename in the jar-complete target, or include ant in our JAR. (Probably the former.)
msg12426 (view) Author: Jeff Allen (jeff.allen) Date: 2019-04-09.07:15:26
Adding to 2.7.2 as it seems easy, just a matter of changing the rule after :
<rule pattern="org.apache.commons.compress.**" result="org.python.apache.commons.compress.@1"/>

But how does one test this?
msg12604 (view) Author: Jeff Allen (jeff.allen) Date: 2019-07-21.17:11:49
It's easy to reproduce (sort of). In an installed Jython, all you have to do is:

PS 272a1> jython -c "from org.python.util import JycompileAntTask"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
java.lang.NoClassDefFoundError: org/python/apache/tools/ant/taskdefs/MatchingTask

It is apparently as easy to reproduce in the dev environment:

PS jython-trunk> dist\bin\jython -c "from org.python.util import JycompileAntTask"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
java.lang.NoClassDefFoundError: org/apache/tools/ant/taskdefs/MatchingTask

but this is a false positive (look carefully at the binary name of the missing class). This is simply a consequence of not having an ant.jar on the path, and on my machine I can quiet it by setting a CLASSPATH:
PS jython-trunk> $env:CLASSPATH="dist\jython-dev.jar;dist\javalib\*;C:\Program Files\ant\lib\ant.jar;."
PS jython-trunk> dist\bin\jython -c "from org.python.util import JycompileAntTask"

but this trick doesn't work in the installed environment.

So it's easy to reproduce (though tedious as making and running the installer).

I've noticed a few times the scope there is to introduce errors after the last test and before Jython reaches users. The regression tests in the dev environment cover a lot conveniently, but don't run on the delivered Jython cleanly (for reasons I believe I understand).
msg12606 (view) Author: Jeff Allen (jeff.allen) Date: 2019-07-21.19:22:09
With a small fix to the renaming in build.xml, the effect in the installed environment is that it now complains about the right (unmodified) class name:

PS 272a1> jython -c "from org.python.util import JycompileAntTask"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
java.lang.NoClassDefFoundError: org/apache/tools/ant/taskdefs/MatchingTask

and this may (now) be quieted by giving it ant.jar:

PS 272a1> $env:CLASSPATH="dist\jython-dev.jar;dist\javalib\*;C:\Program Files\ant\lib\ant.jar;."
PS 272a1> jython -c "from org.python.util import JycompileAntTask"

I now claim this is fixed at: https://hg.python.org/jython/rev/a19b28c28fe6
History
Date User Action Args
2019-07-21 19:22:09jeff.allensetstatus: open -> pending
assignee: jeff.allen
messages: + msg12606
resolution: accepted -> fixed
type: crash
2019-07-21 17:11:50jeff.allensetmessages: + msg12604
2019-04-09 07:15:27jeff.allensetresolution: accepted
messages: + msg12426
milestone: Jython 2.7.2
2018-09-08 12:40:33jeff.allencreate