java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet

前端 未结 5 1727
说谎
说谎 2020-11-27 19:26

I want to use Mojarra 2.1 with Tomcat 7, so I added following dependencies in my pom file:


       com.sun.faces

        
相关标签:
5条回答
  • 2020-11-27 20:16

    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>
    
    0 讨论(0)
  • 2020-11-27 20:17

    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>
    
    0 讨论(0)
  • 2020-11-27 20:22

    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>
    
    0 讨论(0)
  • 2020-11-27 20:25

    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.

    0 讨论(0)
  • 2020-11-27 20:33

    This workaround fixed it for me: http://www.ninthavenue.com.au/java-lang-classformaterror-exception-with-eclipselink-static-weaving-solved

    0 讨论(0)
提交回复
热议问题