sun.misc.InvalidJarIndexException: Invalid index

Hi there,

I am trying to run static portion of the verifier and am getting the error below back.

I am using following JDK

java version "1.4.2_10"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)

Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode)

I've noticed similar BUG with JDK 1.3 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4358512

Any help will be greatly appreciated,

Irena

--

ERRORS THAT OCCURED WHILE RUNNING STATIC VERIFICATION

--

Error Name : com.sun.enterprise.tools.verifier.tests.web.WebArchiveClassesLoadable

Error Description : sun.misc.InvalidJarIndexException: Invalid index

at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:766)

at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:679)

at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:660)

at sun.misc.URLClassPath.findResource(URLClassPath.java:141)

at java.net.URLClassLoader$2.run(URLClassLoader.java:352)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findResource(URLClassLoader.java:349)

at java.lang.ClassLoader.getResource(ClassLoader.java:813)

at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:995)

at com.sun.enterprise.tools.verifier.apiscan.classfile.BCELClassFileLoader.load(BCELClassFileLoader.java:69)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:170)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:176)

at com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl.buildClosure(ClosureCompilerImpl.java:133)

at com.sun.enterprise.tools.verifier.tests.web.WebArchiveClassesLoadable.check(WebArchiveClassesLoadable.java:53)

at com.sun.enterprise.tools.verifier.tests.web.WebTest.check(WebTest.java:46)

at com.sun.enterprise.tools.verifier.CheckMgr.check(CheckMgr.java:76)

at com.sun.enterprise.tools.verifier.web.WebCheckMgrImpl.check(WebCheckMgrImpl.java:32)

at com.sun.enterprise.tools.verifier.BaseVerifier.verify(BaseVerifier.java:86)

at com.sun.enterprise.tools.verifier.web.WebVerifier.verify(WebVerifier.java:43)

at com.sun.enterprise.tools.verifier.VerificationHandler.runVerifier(VerificationHandler.java:136)

at com.sun.enterprise.tools.verifier.VerificationHandler.verifyArchive(VerificationHandler.java:82)

at com.sun.enterprise.tools.verifier.Verifier.verify(Verifier.java:75)

at com.sun.enterprise.tools.verifier.Verifier.main(Verifier.java:53)

[4735 byte] By [irenasha] at [2007-10-2 22:24:58]
# 1
Which AVK version are you using? If it is AVK 5 then you should be using JDK version 1.5.0_06 or above.
VikasAwasthia at 2007-7-14 1:42:22 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 2
I am using AVK 1.4.2. This should be legitimate combination.
irenasha at 2007-7-14 1:42:22 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 3
Is any of the jar file in WEB-INF/lib or the war file itself using Jar index?Sahoo
sahooa at 2007-7-14 1:42:22 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 4
There are 532 archives in WEB-INF/lib directory. 2 of them are actually zipped image files.Irena
irenasha at 2007-7-14 1:42:22 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 5

We need to get some debug output to find out what class was being loaded when that error message appeared. Do the following:

Open $JAVA_HOME/jre/lib/logging.properties and make the following two changes:

1. set

java.util.logging.ConsoleHandler.level = FINER

2. add the following line:

apiscan.classfile.level = FINER

Now, run static archive test. You shall see a lot of output. Just before the exception, you shall see a message that reads something like this:

"BCELClassFileLoader load" followed by a class name.

Basically, that's the class which was being loaded when the error occurred.

Now to find out the offending jar file, do the following:

jar xf <your war file> WEB-INF/lib

Add all the jars in WEB-INF/lib to classpath and run

javap <classname that you obtained in the first step>

Let us know, if this results in InvalidJarIndexException.

Now run java -classpath <arrange all the jar files in>

sahooa at 2007-7-14 1:42:22 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 6

Thanks a lot for this information.

I did get the BCELClassFileLoader FINER information. the problem is that the information goes to standard output while the error is reported in C:\Sun\javke1.4.2\reporttool\static\wfc.ear.txt. There is no way to correlate between the error and actual class name

Thanks again,

Irena

irenasha at 2007-7-14 1:42:22 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 7

Thanks a lot to everybody who answered the issue. I figured it out: the problem is in the number of jar files in WEB-INF/lib directory. DUring static verification alll those are extracted and an atempt to add them to CLASSPATH on Windows platform causes the path to be corrupted dur to length limitation of ~256. To work around this issue I've created aggregated jar of all classes I have out of WEb-INF/lib

<target name="prepare-jumbo-jar">

<jar filesetmanifest="mergewithoutmain" destfile="${source.dir}-jumbo.jar">

<zipgroupfileset dir="${source.dir}" includes="**/*.jar"/>

</jar>

</target>

Irena

irenasha at 2007-7-14 1:42:22 > top of Java-index,Enterprise & Remote Computing,AVK Portability...