title: Tomcat suddenly throwing a ClassFormatError on startup
body: <p>I'm having an issue with my project and after some testing I don't think it's source related. Even when going back to a previously working revision I still get an error when I try to deploy to Tomcat. </p>
  
  <p>The error is a <code>org.springframework.beans.factory.BeanDefinitionStoreException</code> caused by a <code>java.lang.ClassFormatError</code> with the message <strong>Truncated class file</strong>.</p>
  
  <p>I've started narrowing down the issue by remove Eclipse from equation but even when using a maven command line build and deploying directly to my tomcat instance I still get the same issue. Googling for the error came up with people suggesting clearing the tomcat work and temp directory, which I did with no luck.</p>
  
  <p>I know this isn't a lot of information, but assuming the issue isn't with my code, which changes to my system could cause this issue to suddenly manifest?</p>
  
  <hr>
  
  <p>Stack trace</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [beans.xml]; nested exception is java.lang.ClassFormatError: Truncated class file
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:239)
      ... 54 more
  Caused by: java.lang.ClassFormatError: Truncated class file
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
      at org.apache.xbean.spring.context.v2c.XBeanQNameHelper.loadClass(XBeanQNameHelper.java:102)
      at org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:72)
      at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.getPropertyDescriptor(XBeanNamespaceHandler.java:581)
      at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.addAttributeProperties(XBeanNamespaceHandler.java:333)
      at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:225)
      at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:276)
      at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:156)
      at org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)
      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1419)
      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
      ... 59 more
  </code></pre>