Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans 8.2 - Weblogic - Ant build

When I try to build my Enterprise Project in Netbeans with ant, i got this exception:

warning: Supported source version 'RELEASE_6' from annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' less than -source '1.8' Note: Creating static metadata factory ...

An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceException

I only have some entityclasses in my ejb module.

like image 575
solarenqu Avatar asked Jul 22 '17 13:07

solarenqu


1 Answers

This error is reported as a bug in NetBeans (with a resolved status as it turns out to be considered as a "user error"). Below is the main comment that explains the problem and gives the solution:

"ClassFormatError: Absent Code attribute in method..." is always indication that javaee-api-6.0.jar is used for runtime execution. The jar contains only method signatures (method bodies are stripped) and is suitable only for compilation. In future versions of javac there might be better error message.

The problem here is that javaee-api-6.0.jar is on classpath before EclipseLink jars and when EclipseLink annotation processor is started classes from javaee-api-6.0.jar are used instead of classes from EclipseLink. First thing is that javaee-api-6.0.jar should be removed from classpath of EJB project - it should not be needed as EJB project has an Application server selected and the project takes EE 6 APIs from that server.

As I understand the comment, you should try removing any reference to javaee-api-6.0.jar (which contains only "dummy" classes) from the classpath of the project, because the EclipseLink library should provide the correct classes used by the annotation processor.

Also, this question seems to tackle the same issue.

like image 110
M A Avatar answered Nov 16 '22 21:11

M A