I want to use Mojarra 2.1 with Tomcat 7, so I added following dependencies in my pom file:
com.sun.faces
Change:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.2</version>
</dependency>
To:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.6</version>
</dependency>
I traded to glassfish-embedded-all and resolved this.
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2.2</version>
<scope>provided</scope>
</dependency>
I have the same problem as you and found out that change from servlet-api
to javax.servlet.api
will fix the problem. Hope this help. Please note that, I am using Juno Eclipse, Tomcat 7, Dynamic Web Module 3.0, and JDK 1.7.
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
I have the same problem, and it seams somehow to
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
or
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
after setting them to scope provides (or delete them at all when you start an server in maven test) it starts working for me.
@See this Blog: java.lang.ClassFormatError : Absent Code attribute in method that is not native or abstract in class file … - It discuss the problem for javax.persistence.GenerationType
but I think you and I hit the same problem.
This workaround fixed it for me: http://www.ninthavenue.com.au/java-lang-classformaterror-exception-with-eclipselink-static-weaving-solved