On Sep 16, 2013, at 9:36 AM, Sabari Gandhi <sgan...@kivasystems.com> wrote:
> > Hi, > > I am sending this error again with more details: > > I am currently using Java 6 and tomcat 5.5 Don't use Tomcat 5.5. It has not been supported for almost a year now. Upgrade ASAP. > and my environment is linux. I see an mysterious exception when I try to > access a simple jsp page after tomcat is started. When I added a new maven > project (which in turn will create a new jar) I see the exception when i am > trying to access an simple index.jsp. When I name the project and jar as > mhs-beacon-agent I see the following error and when the project is renamed as > mhs-sample-agent I don't see this error. We also set up remote debugging in > linux and see the exception is happening when it is trying to look up for > "javax/servlet" , since sun.misc.URLClassPath is suns own proprietary code i > am not able to debug the code. When I extracted two jar file and did an > folder / folder comparison I don't see any differences in index.list file or > manifest.mf apart from the name differences. I am seeing this exception only > in linux environment and not on mac (which is my developer environment)Any > help is greatly appreciated. Thanks !! > > Exception: > > sun.misc.InvalidJarIndexException: Invalid index Sounds like your JAR might be corrupted. If this is a custom JAR, rebuild it. If it's a dependency you've downloaded with Maven, you might try clearing out the folders for the problem JAR(s) under "~/.m2/repository" and rebuilding. If a JAR downloaded by Maven is corrupted, the corrupted file it will sit on your local HD forever and cause problems. Manually deleting the Maven folders for the JAR usually clears up the problem. Other thought. Upgrade your JVM. If it's as old as your Tomcat version, you could be simply hitting a bug. Dan > sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:931) > sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:840) > sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:810) > sun.misc.URLClassPath.findResource(URLClassPath.java:176) > java.net.URLClassLoader$2.run(URLClassLoader.java:551) > java.net.URLClassLoader$2.run(URLClassLoader.java:549) > java.security.AccessController.doPrivileged(Native Method) > java.net.URLClassLoader.findResource(URLClassLoader.java:548) > java.lang.ClassLoader.getResource(ClassLoader.java:1139) > java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:227) > org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1177) > org.apache.jasper.servlet.JasperLoader.getResourceAsStream(JasperLoader.java:144) > org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:194) > org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:179) > org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:119) > org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178) > org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:407) > org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.checkAndSetImports(CompilationUnitScope.java:167) > org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:190) > org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:301) > org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:315) > org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:425) > org.apache.jasper.compiler.Compiler.compile(Compiler.java:298) > org.apache.jasper.compiler.Compiler.compile(Compiler.java:277) > org.apache.jasper.compiler.Compiler.compile(Compiler.java:265) > org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299) > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) > javax.servlet.http.HttpServlet.service(HttpServlet.java:806) > org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415) > org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234) > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) > javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) > org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122) > > > Code: > For complete code see the following URL. > http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/misc/URLClassPath.java#URLClassPath.JarLoader.validIndex%28java.lang.String%29 > > /* Note that the addition of the url to the list of visited > 850 * jars incorporates a check for presence in the > hashmap > 851 */ > 852 boolean visitedURL = !visited.add(url); > 853 if (!visitedURL) { > 854 try { > 855 newLoader.ensureOpen(); > 856 } catch (IOException e) { > 857 throw (InternalError) new > InternalError().initCause(e); > 858 } > 859 final JarEntry entry = > newLoader.jar.getJarEntry(name); > 860 if (entry != null) { > 861 return newLoader.checkResource(name, > check, entry); > 862 } > 863 > 864 /* Verify that at least one other resource > with the > 865 * same package name as the lookedup > resource is > 866 * present in the new jar > 867 */ > 868 if (!newLoader.validIndex(name)) { > 869 /* the mapping is wrong */ > 870 throw new > InvalidJarIndexException("Invalid index"); > 871 } > 872 } > > > > Thanks and Regards, > SG > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org