I have a maven dependency for javaee Bibliothek.
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
I get the error in Eclipse in some classes.
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException
I added javax.mail dependency.
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
</dependency>
It did not not work. Any Idea??
It did not work because classes from
javax/javaee-api/provideddependency are specially constructed. They are not usable runtime because implementation of methods is missing.Simply adding classes from
javax.mail/mail/1.4.5dependency to the classpath does not help, because classes fromjavax/javaee-api/providedare already there. Havingjavax.mail/mail/1.4.5dependecy alone solves your problem, but most likely you also need other classes fromjavax/javaee-api/provided.What you can do is to get rid of
javax/javaee-api/provideddependency and get these classes for example from the dependencies provided by target application server. You can use for example following:Because scope is provided, it does not affect the artifact to be built. That’s why you can use this one also with other application servers than JBoss. It is same API as in your original dependency, but it contains normal classes.