Sunday, November 03, 2013

JUnit fails - with java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence

It is been de facto standard that writing a JUnit test and confirming ORM (Object Relational Mapping) layer perfect before validating service, web layers, whatever may be the methodology are AgileTDD etc.,

We tend to include API spec jar's and forget to add implementation in maven (pom) dependency file. this would result in java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class. 

This could be resolved by referencing any valid implementation of the specification. For an example you could reference one of the (glassfish, jboss etc) application container implementation jar's should solve this error.

References:

http://www.mkyong.com/hibernate/java-lang-classformaterror-absent-code-attribute-in-method-that-is-not-native-or-abstract-in-class-file/

https://norrisshelton.wordpress.com/2012/04/09/java-lang-classformaterror-absent-code-attribute-in-method-that-is-not-native-or-abstract-in-class-file-javaxpersistencepersistence/

No comments:

Running Jobs as application user in Cloudera hadoop distribution

When an Hadoop cluster is not enabled with Kerberos authentication, Internally triggered jobs would be running as an 'yarn' user ra...