You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Armbrust, Daniel C." <Ar...@mayo.edu> on 2003/12/05 20:51:25 UTC
Very odd issue with jar task
I have a very frustrating problem that I hope someone may be able to shed a bit of light on.... Sorry for the lengthy post, but I wanted to get all the details out here.
I am building a jar file which contains my compiled source files, and the contents of several other jar files, with a task like this:
<jar jarfile="${implAndDepend.jar}" basedir="${impl.target.dir}" includes="**/*.class">
<zipgroupfileset refid="packageJars"/>
<zipgroupfileset refid="axisJars"/>
<zipgroupfileset dir="">
<include name="${wsdlJava.jar}"/>
</zipgroupfileset>
</jar>
Those refid's are defined like this:
<path id="allJars">
<fileset dir="${externalLib.dir}" id="packageJars">
<include name="log4j-1.2.6.jar"/>
<include name="gnu-regexp-1.1.4.jar"/>
<include name="castor-0.9.4.jar"/>
<include name="castor-0.9.4-xml.jar"/>
<include name="jdbc-se2.0.jar"/>
<include name="jta1.0.1.jar"/>
<include name="allToolsModified.jar"/>
<include name="pgjdbc2.jar"/>
</fileset>
<fileset dir="${externalLib.dir}/axis/" id="axisJars">
<include name="**/*.jar"/>
</fileset>
</path>
This works fine, I end up with one big jar file. I have done this for several months without an issue. The resulting jar file works fine when used as a runtime library.
Now, I have another project that depends on this library.
My compile task in that project looks like this:
<javac srcdir="${src}" destdir="${classes}">
<classpath path="${extLib}/implAndDepend.jar"/>
</javac>
This has worked fine up until yesterday. Now, when I run compile, I get this exception:
Buildfile: D:\Eclipse Projects\general-workspace\ctsbackend\build.xml
init:
[mkdir] Created dir: D:\Eclipse Projects\general-workspace\ctsbackend\antBuild
compile:
[mkdir] Created dir: D:\Eclipse Projects\general-workspace\ctsbackend\antBuild\classes
[javac] Compiling 8 source files to D:\Eclipse Projects\general-workspace\ctsbackend\antBuild\classes
[javac] An exception has occurred in the compiler (1.4.2_02). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
[javac] java.lang.IndexOutOfBoundsException
[javac] at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:122)
[javac] at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1085)
[javac] at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1046)
[javac] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:332)
[javac] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:651)
[javac] at com.sun.tools.javac.v8.code.ClassReader.loadClass(ClassReader.java:1113)
[javac] at com.sun.tools.javac.v8.comp.Resolve.loadClass(Resolve.java:485)
[javac] at com.sun.tools.javac.v8.comp.Resolve.findIdentInPackage(Resolve.java:660)
[javac] at com.sun.tools.javac.v8.comp.Attr.selectSym(Attr.java:1140)
[javac] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1089)
[javac] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:1091)
[javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:256)
[javac] at com.sun.tools.javac.v8.comp.Attr.attribType(Attr.java:286)
[javac] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitImport(Enter.java:754)
[javac] at com.sun.tools.javac.v8.tree.Tree$Import.accept(Tree.java:407)
[javac] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:707)
[javac] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:719)
[javac] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitTopLevel(Enter.java:738)
[javac] at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:390)
[javac] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:707)
[javac] at com.sun.tools.javac.v8.comp.Enter$CompleteEnter.complete(Enter.java:833)
[javac] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:332)
[javac] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:651)
[javac] at com.sun.tools.javac.v8.comp.Enter.complete(Enter.java:593)
[javac] at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:574)
[javac] at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:334)
[javac] at com.sun.tools.javac.v8.Main.compile(Main.java:520)
[javac] at com.sun.tools.javac.Main.compile(Main.java:36)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:324)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:100)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
[javac] at org.apache.tools.ant.Task.perform(Task.java:341)
[javac] at org.apache.tools.ant.Target.execute(Target.java:309)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[javac] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
[javac] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:166)
BUILD FAILED: file:D:/Eclipse Projects/general-workspace/ctsbackend/build.xml:38: Compile failed; see the compiler error output for details.
Total time: 891 milliseconds
I can't figure out what I changed between yesterday and today to make this occur. Here are some additional oddities:
If I use the <unjar> task to unjar implAndDepend.jar into a temp folder, and then point the <javac> task to that folder for the classpath, everything works fine.
If I manually (using winzip) unzip the file implAndDepend.jar, and then rezip it with winzip, everything works fine.
If I execute jar -tf implAndDepend.jar it lists all the classes in the jar file without any issues.
What could possibly be wrong with this jar file that is causing this exception?
Thanks
Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Very odd issue with jar task
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Sat, 6 Dec 2003 06:51 am, Armbrust, Daniel C. wrote:
> I have a very frustrating problem that I hope someone may be able to shed a
> bit of light on.... Sorry for the lengthy post, but I wanted to get all
> the details out here.
>
>
> This has worked fine up until yesterday. Now, when I run compile, I get
> this exception: Buildfile: D:\Eclipse
> Projects\general-workspace\ctsbackend\build.xml init:
> [mkdir] Created dir: D:\Eclipse
> Projects\general-workspace\ctsbackend\antBuild compile:
> [mkdir] Created dir: D:\Eclipse
> Projects\general-workspace\ctsbackend\antBuild\classes [javac] Compiling 8
> source files to D:\Eclipse
> Projects\general-workspace\ctsbackend\antBuild\classes [javac] An exception
> has occurred in the compiler (1.4.2_02). Please file a bug at the Java
> Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after
> checking the Bug Parade for duplicates. Include your program and the
> following diagnostic in your report. Thank you. [javac]
> java.lang.IndexOutOfBoundsException
There used to be a problem when modifying jars which had been previously
loaded by the VM. I am not 100% sure if this is the same. It went something
like this - you refer to the existing jar prior to building it (in a
classpath, for example), build or update the jar and then use it in a
compile.
Here are some bug reports about the issue
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=383
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6715
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1035
Now those iussues are menat to be resolved in the 1.3.1 VM so maybe not the
same issue. Some things to check:
1. Are you using the jar in a classpath in the same build?
2. Does deleting the jar before running the build change things?
3. Does forking the compile change things?
Conor
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org