Resolving java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract.. error

I was trying out the code available here – ‘Getting started with Spring MVC’ ( – today and was facing an irritating error (see below) everytime when I deployed the code. Finally, found the reason and fixed the issue.

Error Stack Trace

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(
at java.lang.ClassLoader.defineClass(
at org.jboss.classloader.spi.base.BaseClassLoader.access$200(
at org.jboss.classloader.spi.base.BaseClassLoader$
at org.jboss.classloader.spi.base.BaseClassLoader$
at Method)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(
at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(
at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(
at org.jboss.classloader.spi.base.ClassLoadingTask$
at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(
at org.jboss.classloader.spi.base.ClassLoaderManager.process(
at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(
at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(
at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(


I included this dependency in my project, unaware of the fact that it’s just the api and the implementation should be provided by the application server/web container. We need to remove this jar from classpath to solve this error. But this might be required during compilation. Hence, I modified the maven scope to provided, and that way, the JAR was not copied to the generated app WAR , thereby solving my problem.




  1. […] When it worked, it reminded me of another issue that I’ve solved already and is already here in this blog:… […]

  2. It worked, i had the same configuration. thank you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 45 other followers

%d bloggers like this: