https://issues.apache.org/bugzilla/show_bug.cgi?id=54473

            Bug ID: 54473
           Summary: taskdef can't find existing resource in jar file on
                    the first try, but on the second -
                    JarUrlConnection.connect() fails
           Product: Ant
           Version: 1.8.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified

In rare cases, but reproducable on certain testsystems, I get the following
stacktrace:

com.izforge.izpack.installer.InstallerException: The following error occurred
while executing this line:
/tmp/buildfile_resource7846034884221422628xml:7: The following error occurred
while executing this line:
/usr/local/app/bin/database_contents.xml:5: The following error occurred while
executing this line:
Unable to find
jar:file:/usr/local/app/lib/ant/ant-contrib/1.0b3/ant-contrib.jar!/net/sf/antcontrib/antlib.xml
        at
com.izforge.izpack.event.AntActionInstallerListener.performAllActions(Unknown
Source)
        at
com.izforge.izpack.event.AntActionInstallerListener.afterPacks(Unknown Source)
        at com.izforge.izpack.installer.UnpackerBase.informListeners(Unknown
Source)
        at com.izforge.izpack.installer.Unpacker.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:736)
Caused by: The following error occurred while executing this line:
/tmp/buildfile_resource7846034884221422628xml:7: The following error occurred
while executing this line:
/usr/local/app/bin/database_contents.xml:5: The following error occurred while
executing this line:
Unable to find
jar:file:/usr/local/app/lib/ant/ant-contrib/1.0b3/ant-contrib.jar!/net/sf/antcontrib/antlib.xml
        at
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:395)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at com.izforge.izpack.event.AntAction.performAction(Unknown Source)
        at com.izforge.izpack.event.AntAction.performInstallAction(Unknown
Source)
        ... 5 more
Caused by: /tmp/buildfile_resource7846034884221422628xml:7: The following error
occurred while executing this line:
/usr/local/app/bin/database_contents.xml:5: The following error occurred while
executing this line:
Unable to find
jar:file:/usr/local/app/lib/ant/ant-contrib/1.0b3/ant-contrib.jar!/net/sf/antcontrib/antlib.xml
        at
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
        at
org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:238)
        at
org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:163)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:393)
        ... 17 more
Caused by: /usr/local/app/bin/database_contents.xml:5: The following error
occurred while executing this 
line:
Unable to find
jar:file:/usr/local/app/lib/ant/ant-contrib/1.0b3/ant-contrib.jar!/net/sf/antcontrib/antlib.xml
        at
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
        at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:445)
        at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:292)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:169)
        at
org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:229)
        ... 29 more
Caused by: Unable to find
jar:file:/usr/local/app/lib/ant/ant-contrib/1.0b3/ant-contrib.jar!/net/sf/antcontrib/antlib.xml
        at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:68)
        at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:440)
        ... 40 more
Caused by: java.io.FileNotFoundException: JAR entry
net/sf/antcontrib/antlib.xml not found in
/usr/local/app/lib/ant/ant-contrib/1.0b3/ant-contrib.jar
        at
sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:125)
        at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:66)
        ... 41 more


in the definition:
  <taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
      <pathelement
location="${install.prefix}/lib/ant/ant-contrib/1.0b3/ant-contrib.jar"/>
    </classpath>
  </taskdef>

The File and the resource in it definitely exist.
Ant 1.8.4 is used built-in here from an Izpack installer, but this doesn't play
any role here, IMHO.

The important point is, that it fails just on the first try, but on the second
on it suceeds, although there hasn't been changed anything on the appropriate
location in between time.

Note:
At the links
- https://jira.springsource.org/browse/SPR-4639
-
http://stackoverflow.com/questions/1374438/disappearing-jar-entry-when-loading-using-spi
I found some discussion about switching off caching in such cases for
UrlConnection. Maybe this could be useful also for Ant.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to