Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   java.lang.ClassFormatError: Truncated class file (http://www.velocityreviews.com/forums/t731753-java-lang-classformaterror-truncated-class-file.html)

laredotornado 08-25-2010 01:33 PM

java.lang.ClassFormatError: Truncated class file
 
Hi, I'm using Java 1.6 with Tomcat 6.0.26. When we are visiting
certain JSPs, we are getting the error below. All the literature I
have found so far pertains to applets, so I wanted to float this out
to the group to see what advice you have about troubleshooting this
further. Thanks, - Dave

java.lang.ClassFormatError: Truncated class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
at
java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader .java:
260)
at java.net.URLClassLoader.access$000(URLClassLoader. java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at
org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:
134)
at
org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:66)
at
org.apache.jasper.JspCompilationContext.load(JspCo mpilationContext.java:
598)
at
org.apache.jasper.servlet.JspServletWrapper.getSer vlet(JspServletWrapper.java:
144)
at
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:
329)
at
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:
320)
at
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:
803)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:
654) at
org.apache.catalina.core.ApplicationDispatcher.pro cessRequest(ApplicationDispatcher.java:
445)
at
org.apache.catalina.core.ApplicationDispatcher.doF orward(ApplicationDispatcher.java:
379)
at
org.apache.catalina.core.ApplicationDispatcher.for ward(ApplicationDispatcher.java:
292)
at
com.lvcva.servlet.generic.GenericHttpServlet.callV iew(GenericHttpServlet.java:
610) at
com.lvcva.servlet.dine.DiningServlet.details(Dinin gServlet.java:272)
at sun.reflect.GeneratedMethodAccessor457.invoke(Unkn own
Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.lvcva.servlet.generic.GenericHttpServlet.doGet (GenericHttpServlet.java:
587)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:
690)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:
803)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
com.lvcva.filter.RecordPageFilter.doFilter(RecordP ageFilter.java:30)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
230)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
175)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
128)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
104)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
261)
at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:190)
at
org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:283)
at
org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:767)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
697)
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:686)
at java.lang.Thread.run(Thread.java:619)

Karl Lopes 12-16-2010 06:12 AM

Re: java.lang.ClassFormatError: Truncated class file
 
The problem is occuring in the load class method in JasperLoader. I
suspect your jsp is not getting compiled: (method is below).
Two things can be done here:
1. Put a breakpoint in JasperLoader in the above class and see what
happens.
2. Try to precompile your JSPs and see which one fails. That should give
you a start. (Ref: http://scriptlandia.blogspot.com/2006/04/how-to-pre-
compile-jsp-pages-for.html)
Karl.


/*
public Class loadClass(final String name, boolean resolve)
95 throws ClassNotFoundException {
96
97 Class clazz = null;
98
99 // (0) Check our previously loaded class cache
100 clazz = findLoadedClass(name);
101 if (clazz != null) {
102 if (resolve)
103 resolveClass(clazz);
104 return (clazz);
105 }
106
107 // (.5) Permission to access this class when using a
SecurityManager
108 if (securityManager != null) {
109 int dot = name.lastIndexOf('.');
110 if (dot >= 0) {
111 try {
112 // Do not call the security manager since by
default, we grant that package.
113 if
(!"org.apache.jasper.runtime".equalsIgnoreCase(nam e.substring(0,dot))){
114 securityManager.checkPackageAccess
(name.substring(0,dot));
115 }
116 } catch (SecurityException se) {
117 String error = "Security Violation, attempt
to use " +
118 "Restricted Class: " + name;
119 se.printStackTrace();
120 throw new ClassNotFoundException(error);
121 }
122 }
123 }
124
125 if( !name.startsWith(Constants.JSP_PACKAGE_NAME + '.') )
{
126 // Class is not in org.apache.jsp, therefore, have
our
127 // parent load it
128 clazz = parent.loadClass(name);
129 if( resolve )
130 resolveClass(clazz);
131 return clazz;
132 }
133
134 return findClass(name);
135 }

*/


laredotornado <laredotornado@zipmail.com> wrote in
news:6e10c54e-be59-4b4e-b228-4633082726b0@v6g2000prd.googlegroups.com:

> Hi, I'm using Java 1.6 with Tomcat 6.0.26. When we are visiting
> certain JSPs, we are getting the error below. All the literature I
> have found so far pertains to applets, so I wanted to float this out
> to the group to see what advice you have about troubleshooting this
> further. Thanks, - Dave
>
> java.lang.ClassFormatError: Truncated class file
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
> at
> java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:
> 124)
> at java.net.URLClassLoader.defineClass(URLClassLoader .java:
> 260)
> at java.net.URLClassLoader.access$000(URLClassLoader. java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
> at
> org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:
> 134)
> at
> org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:66)
> at
> org.apache.jasper.JspCompilationContext.load

(JspCompilationContext.java
> : 598)
> at
> org.apache.jasper.servlet.JspServletWrapper.getSer vlet

(JspServletWrappe
> r.java: 144)
> at
> org.apache.jasper.servlet.JspServletWrapper.servic e

(JspServletWrapper.j
> ava: 329)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:
> 320)
> at
> org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:266)
> at javax.servlet.http.HttpServlet.service(HttpServlet .java:
> 803)
> at
> org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter

(Applic
> ationFilterChain.java: 290)
> at
> org.apache.catalina.core.ApplicationFilterChain.do Filter

(ApplicationFil
> terChain.java: 206)
> at
> org.apache.catalina.core.ApplicationDispatcher.inv oke

(ApplicationDispat
> cher.java: 654) at
> org.apache.catalina.core.ApplicationDispatcher.pro cessRequest

(Applicati
> onDispatcher.java: 445)
> at
> org.apache.catalina.core.ApplicationDispatcher.doF orward

(ApplicationDis
> patcher.java: 379)
> at
> org.apache.catalina.core.ApplicationDispatcher.for ward

(ApplicationDispa
> tcher.java: 292)
> at
> com.lvcva.servlet.generic.GenericHttpServlet.callV iew

(GenericHttpServle
> t.java: 610) at
> com.lvcva.servlet.dine.DiningServlet.details(Dinin gServlet.java:272)
> at sun.reflect.GeneratedMethodAccessor457.invoke(Unkn own
> Source) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke

(DelegatingMethodAccesso
> rImpl.java: 25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> com.lvcva.servlet.generic.GenericHttpServlet.doGet

(GenericHttpServlet.j
> ava: 587)
> at javax.servlet.http.HttpServlet.service(HttpServlet .java:
> 690)
> at javax.servlet.http.HttpServlet.service(HttpServlet .java:
> 803)
> at
> org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter

(Applic
> ationFilterChain.java: 290)
> at
> org.apache.catalina.core.ApplicationFilterChain.do Filter

(ApplicationFil
> terChain.java: 206)
> at
> com.lvcva.filter.RecordPageFilter.doFilter(RecordP ageFilter.java:30)
> at
> org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter

(Applic
> ationFilterChain.java: 235)
> at
> org.apache.catalina.core.ApplicationFilterChain.do Filter

(ApplicationFil
> terChain.java: 206)
> at
> org.apache.catalina.core.StandardWrapperValve.invo ke

(StandardWrapperVal
> ve.java: 230)
> at
> org.apache.catalina.core.StandardContextValve.invo ke

(StandardContextVal
> ve.java: 175)
> at
> org.apache.catalina.core.StandardHostValve.invoke

(StandardHostValve.jav
> a: 128)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke

(ErrorReportValve.jav
> a: 104)
> at
> org.apache.catalina.core.StandardEngineValve.invok e

(StandardEngineValve
> .java: 109)
> at
> org.apache.catalina.connector.CoyoteAdapter.servic e

(CoyoteAdapter.java:
> 261)
> at
> org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:190)
> at
> org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:283)
> at
> org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:767)
> at
> org.apache.jk.common.ChannelSocket.processConnecti on

(ChannelSocket.java
> : 697)
> at org.apache.jk.common.ChannelSocket
> $SocketConnection.runIt(ChannelSocket.java:889)
> at org.apache.tomcat.util.threads.ThreadPool
> $ControlRunnable.run(ThreadPool.java:686)
> at java.lang.Thread.run(Thread.java:619)
>



Mittal 09-28-2012 07:30 AM

Re: java.lang.ClassFormatError: Truncated class file
 
Thanks. I had some problem in my tag file so it was giving this error. It got solved now.

On Thursday, December 16, 2010 11:42:44 AM UTC+5:30, Karl Lopes wrote:
> The problem is occuring in the load class method in JasperLoader. I
> suspect your jsp is not getting compiled: (method is below).
> Two things can be done here:
> 1. Put a breakpoint in JasperLoader in the above class and see what
> happens.
> 2. Try to precompile your JSPs and see which one fails. That should give
> you a start. (Ref: http://scriptlandia.blogspot.com/2006/04/how-to-pre-
> compile-jsp-pages-for.html)
> Karl.
>
>
> /*
> public Class loadClass(final String name, boolean resolve)
> 95 throws ClassNotFoundException {
> 96
> 97 Class clazz = null;
> 98
> 99 // (0) Check our previously loaded class cache
> 100 clazz = findLoadedClass(name);
> 101 if (clazz != null) {
> 102 if (resolve)
> 103 resolveClass(clazz);
> 104 return (clazz);
> 105 }
> 106
> 107 // (.5) Permission to access this class when using a
> SecurityManager
> 108 if (securityManager != null) {
> 109 int dot = name.lastIndexOf('.');
> 110 if (dot >= 0) {
> 111 try {
> 112 // Do not call the security manager since by
> default, we grant that package.
> 113 if
> (!"org.apache.jasper.runtime".equalsIgnoreCase(nam e.substring(0,dot))){
> 114 securityManager.checkPackageAccess
> (name.substring(0,dot));
> 115 }
> 116 } catch (SecurityException se) {
> 117 String error = "Security Violation, attempt
> to use " +
> 118 "Restricted Class: " + name;
> 119 se.printStackTrace();
> 120 throw new ClassNotFoundException(error);
> 121 }
> 122 }
> 123 }
> 124
> 125 if( !name.startsWith(Constants.JSP_PACKAGE_NAME + '.') )
> {
> 126 // Class is not in org.apache.jsp, therefore, have
> our
> 127 // parent load it
> 128 clazz = parent.loadClass(name);
> 129 if( resolve )
> 130 resolveClass(clazz);
> 131 return clazz;
> 132 }
> 133
> 134 return findClass(name);
> 135 }
>
> */
>
>
> laredotornado <laredotornado@zipmail.com> wrote in
> news:6e10c54e-be59-4b4e-b228-4633082726b0@v6g2000prd.googlegroups.com:
>
> > Hi, I'm using Java 1.6 with Tomcat 6.0.26. When we are visiting
> > certain JSPs, we are getting the error below. All the literature I
> > have found so far pertains to applets, so I wanted to float this out
> > to the group to see what advice you have about troubleshooting this
> > further. Thanks, - Dave
> >
> > java.lang.ClassFormatError: Truncated class file
> > at java.lang.ClassLoader.defineClass1(Native Method)
> > at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
> > at
> > java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:
> > 124)
> > at java.net.URLClassLoader.defineClass(URLClassLoader .java:
> > 260)
> > at java.net.URLClassLoader.access$000(URLClassLoader. java:56)
> > at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
> > at
> > org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:
> > 134)
> > at
> > org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:66)
> > at
> > org.apache.jasper.JspCompilationContext.load

> (JspCompilationContext.java
> > : 598)
> > at
> > org.apache.jasper.servlet.JspServletWrapper.getSer vlet

> (JspServletWrappe
> > r.java: 144)
> > at
> > org.apache.jasper.servlet.JspServletWrapper.servic e

> (JspServletWrapper.j
> > ava: 329)
> > at
> > org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:
> > 320)
> > at
> > org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:266)
> > at javax.servlet.http.HttpServlet.service(HttpServlet .java:
> > 803)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter

> (Applic
> > ationFilterChain.java: 290)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.do Filter

> (ApplicationFil
> > terChain.java: 206)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.inv oke

> (ApplicationDispat
> > cher.java: 654) at
> > org.apache.catalina.core.ApplicationDispatcher.pro cessRequest

> (Applicati
> > onDispatcher.java: 445)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.doF orward

> (ApplicationDis
> > patcher.java: 379)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.for ward

> (ApplicationDispa
> > tcher.java: 292)
> > at
> > com.lvcva.servlet.generic.GenericHttpServlet.callV iew

> (GenericHttpServle
> > t.java: 610) at
> > com.lvcva.servlet.dine.DiningServlet.details(Dinin gServlet.java:272)
> > at sun.reflect.GeneratedMethodAccessor457.invoke(Unkn own
> > Source) at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke

> (DelegatingMethodAccesso
> > rImpl.java: 25)
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> > com.lvcva.servlet.generic.GenericHttpServlet.doGet

> (GenericHttpServlet.j
> > ava: 587)
> > at javax.servlet.http.HttpServlet.service(HttpServlet .java:
> > 690)
> > at javax.servlet.http.HttpServlet.service(HttpServlet .java:
> > 803)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter

> (Applic
> > ationFilterChain.java: 290)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.do Filter

> (ApplicationFil
> > terChain.java: 206)
> > at
> > com.lvcva.filter.RecordPageFilter.doFilter(RecordP ageFilter.java:30)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter

> (Applic
> > ationFilterChain.java: 235)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.do Filter

> (ApplicationFil
> > terChain.java: 206)
> > at
> > org.apache.catalina.core.StandardWrapperValve.invo ke

> (StandardWrapperVal
> > ve.java: 230)
> > at
> > org.apache.catalina.core.StandardContextValve.invo ke

> (StandardContextVal
> > ve.java: 175)
> > at
> > org.apache.catalina.core.StandardHostValve.invoke

> (StandardHostValve.jav
> > a: 128)
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke

> (ErrorReportValve.jav
> > a: 104)
> > at
> > org.apache.catalina.core.StandardEngineValve.invok e

> (StandardEngineValve
> > .java: 109)
> > at
> > org.apache.catalina.connector.CoyoteAdapter.servic e

> (CoyoteAdapter.java:
> > 261)
> > at
> > org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:190)
> > at
> > org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:283)
> > at
> > org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:767)
> > at
> > org.apache.jk.common.ChannelSocket.processConnecti on

> (ChannelSocket.java
> > : 697)
> > at org.apache.jk.common.ChannelSocket
> > $SocketConnection.runIt(ChannelSocket.java:889)
> > at org.apache.tomcat.util.threads.ThreadPool
> > $ControlRunnable.run(ThreadPool.java:686)
> > at java.lang.Thread.run(Thread.java:619)
> >




All times are GMT. The time now is 10:43 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.