javax.servlet.ServletException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • java.util.zip.ZipException: invalid block type
    via by Unknown author,
  • Sometimes while redeploing Appfuse application in tomcat 5.x (with reloadable="true" in context.xml) I'm getting the following error in catalina.out : ERROR [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ContextLoader.initWebApplicationContext(182) | Context initialization failed java.lang.InternalError: jzentry == 0, jzfile = 141476144, total = 41, name = /home/serega/tomcat/webapps/pcc/WEB-INF/lib/pcc-dao.jar, i = 9, message = invalid LOC header (bad signature) at java.util.zip.ZipFile$3.nextElement(ZipFile.java:430) at java.util.zip.ZipFile$3.nextElement(ZipFile.java:416) at java.util.jar.JarFile$1.nextElement(JarFile.java:214) at java.util.jar.JarFile$1.nextElement(JarFile.java:213) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingJarResources(PathMatchingResourcePatternResolver.java:322) It can be cured only by restarting tomcat and happens 2 or 3 times a day on regular basis. Futher investigations showed that errors happen then spring context files are loaded (it can be seen from stack trace :)). Workaround ----------------------- Workaround for this problem is to load context xml files from WEB-INF directory instead of jars. It can be accomplished with following changes in web.xml and build.xml : - comment out second config location line in the web-settings.xml to force Spring use only /WEB-INF files : <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext-*.xml <!-- classpath*:META-INF/applicationContext-*.xml--> </param-value> </context-param> - add the following lines into the package-web ant task before war task: <copy tofile="${webapp.dist}/applicationContext-service.xml" overwrite="true"> <fileset dir="src/service" includes="**/*-service.xml"/> </copy> <copy tofile="${webapp.dist}/applicationContext-hibernate.xml" overwrite="true"> <fileset dir="src/dao" includes="**/*-hibernate.xml"/> <filterset refid="variables.to.replace"/> </copy> - and add 2 lines inside the package-web's war task : <webinf dir="${webapp.dist}" includes="applicationContext-service.xml"/> <webinf dir="${webapp.dist}" includes="applicationContext-hibernate.xml"/> Below is my modified package-web task : <target name="package-web" depends="compile-web,jsp-2" description="Package WAR"> <propertyfile comment="Build Information" file="${build.dir}/web/classes/build.properties"> <entry key="build.date" type="date" pattern="EEEE MMM dd, yyyy" value="now"/> <entry key="build.time" type="date" pattern="hh:mm:ss a zz" value="now"/> <entry key="build.username" value="${user.name}"/> <entry key="build.computer" value="${env.COMPUTERNAME}"/> <entry key="build.dao.type" value="${dao.type}"/> <entry key="webapp.version" value="${webapp.version}"/> </propertyfile> <!-- If Tomcat 5, uncomment the <dispatcher> elements in filter-mappings --> <if> <or> <isset property="tomcat5"/> <isset property="tomcat5.5"/> </or> <then> <replaceregexp flags="g" file="${webapp.target}/WEB-INF/web.xml" match='&lt;!--dispatcher&gt;' replace='&lt;dispatcher&gt;'/> <replaceregexp flags="g" file="${webapp.target}/WEB-INF/web.xml" match='&lt;/dispatcher--&gt;' replace='&lt;/dispatcher&gt;'/> </then> </if> <echo>Preparing tomcat-context.xml for inclusion in war</echo> <!-- Copy tomcat-context.xml file to context.xml --> <if> <and> <isset property="tomcat5"/> <not><isset property="tomcat5.5"/></not> </and> <then> <copy tofile="${webapp.dist}/context.xml" file="metadata/conf/tomcat-context.xml" overwrite="true"> <filterset refid="db.variables"/> </copy> </then> <elseif> <isset property="tomcat5.5"/> <then> <copy tofile="${webapp.dist}/context.xml" file="metadata/conf/tomcat-context-5.5.xml" overwrite="true"> <filterset refid="db.variables"/> </copy> </then> </elseif> </if> <!-- added --> <copy tofile="${webapp.dist}/applicationContext-service.xml" overwrite="true"> <fileset dir="src/service" includes="**/*-service.xml"/> </copy> <copy tofile="${webapp.dist}/applicationContext-hibernate.xml" overwrite="true"> <fileset dir="src/dao" includes="**/*-hibernate.xml"/> <filterset refid="variables.to.replace"/> </copy> <!-- Copy .properties files in src tree to build/web/classes --> <copy todir="${build.dir}/web/classes"> <fileset dir="src/web"> <include name="**/*.properties"/> <include name="**/*.xml"/> </fileset> </copy> <echo>before war task</echo> <war destfile="${webapp.dist}/${webapp.war}" webxml="${webapp.target}/WEB-INF/web.xml" compress="true"> <fileset dir="${webapp.target}" excludes="**/web.xml,**/*-resources.xml"/> <metainf dir="${webapp.dist}" includes="context.xml"/> <classes dir="${build.dir}/web/classes"> <exclude name="**/database.properties"/> </classes> <lib file="${dist.dir}/${webapp.name}-dao.jar"/> <lib file="${dist.dir}/${webapp.name}-service.jar"/> <webinf dir="web/WEB-INF" includes="*-resources.xml"/> <!-- added --> <webinf dir="${webapp.dist}" includes="applicationContext-service.xml"/> <webinf dir="${webapp.dist}" includes="applicationContext-hibernate.xml"/> <webinf dir="${struts.dir}" includes="*.xml"/> <lib file="${clickstream.jar}"/> <lib dir="${struts.dir}" includes="*.jar"/> <lib dir="${jstl.dir}/lib"> <include name="jstl.jar"/> <include name="standard.jar"/> </lib> <lib dir="${javamail.dir}" includes="*.jar"/> <lib file="${log4j.jar}"/> <lib file="${strutsmenu.jar}"/> <lib dir="${displaytag.dir}" includes="*.jar"/> <lib file="${hibernate.jar}"/> <lib dir="${hibernate.dir}/lib" includes="*.jar" excludes="jta.jar"/> <lib dir="${spring.dir}" includes="*.jar" excludes="*mock.jar"/> <lib file="${sitemesh.jar}"/> <lib dir="${velocity.dir}" includes="*.jar"/> <lib file="${urlrewrite.jar}"/> </war> </target>
    via by Sergey Pariev,
  • java.util.zip.ZipException: invalid block type
    via by Ben Anderson,
    • javax.servlet.ServletException: java.lang.InternalError: jzentry == 0, jzfile = 1075555720, total = 13265, name = /usr/local/jdk1.5.0/jre/lib/rt.jar, i = 11444, message = invalid LOC header (bad signature) at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:588) at com.caucho.server.dispatch.ServletManager.init(ServletManager.java:139) at com.caucho.server.webapp.Application.start(Application.java:1537) at com.caucho.server.deploy.Entry.startImpl(Entry.java:457) at com.caucho.server.webapp.WebAppEntry.startImpl(WebAppEntry.java:85) at com.caucho.server.deploy.Entry.redeployIfModifiedImpl(Entry.java:416) at com.caucho.server.webapp.WebAppEntry.redeployIfModifiedImpl(WebAppEntry.java:85) at com.caucho.server.deploy.Entry.startAutomatic(Entry.java:366) at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:153) at com.caucho.server.webapp.ApplicationContainer.start(ApplicationContainer.java:564) at com.caucho.server.host.Host.start(Host.java:489) at com.caucho.server.deploy.Entry.startImpl(Entry.java:457) at com.caucho.server.host.HostEntry.startImpl(HostEntry.java:82) at com.caucho.server.deploy.Entry.redeployIfModifiedImpl(Entry.java:416) at com.caucho.server.host.HostEntry.redeployIfModifiedImpl(HostEntry.java:82) at com.caucho.server.deploy.Entry.startAutomatic(Entry.java:366) at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:153) at com.caucho.server.host.HostContainer.start(HostContainer.java:464) at com.caucho.server.resin.ServletServer.start(ServletServer.java:826) at com.caucho.server.resin.ResinServer.start(ResinServer.java:416) at com.caucho.server.resin.Resin.init(Resin.java:282) at com.caucho.server.resin.Resin.main(Resin.java:477) Caused by: java.lang.InternalError: jzentry == 0, jzfile = 1075555720, total = 13265, name = /usr/local/jdk1.5.0/jre/lib/rt.jar, i = 11444, message = invalid LOC header (bad signature) at java.util.zip.ZipFile$3.nextElement(ZipFile.java:427) at java.util.zip.ZipFile$3.nextElement(ZipFile.java:413) at java.util.jar.JarFile$1.nextElement(JarFile.java:214) at java.util.jar.JarFile$1.nextElement(JarFile.java:213) at com.caucho.jsp.TldManager.loadJarTlds(TldManager.java:381) at com.caucho.jsp.TldManager.init(TldManager.java:258) at com.caucho.jsp.TldManager.create(TldManager.java:125)
    No Bugmate found.