In a recent blog post, Adam Bien, has shown how the upcoming Java EE 7 api fixes issues that were present when testing applications against Java EE 6.
In Java EE 6, applications could be compiled against the Java EE 6 api using the
javaee-web-api Maven artifact. As the classes in the maven artifact however were just stub classes they only allowed compilation and would not allow a set of tests to run against the api’s outside of the application server. This would cause ClassFormatErors such as
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class
The fix for this issue was to compile and run tests against a 3rd party EE 6 api rather than the standard such as described on this tip.
Adam has shown that this is no longer the case in EE 7, and using the official javaee-api Maven artifact will enable testing to be performed against the EE 7 api as expected.
Thanks Adam for the tip !