简体   繁体   English

在类文件javax / faces / webapp / FacesServlet中的非本机或抽象方法中的Absent Code属性

[英]Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet

I am building a PoC for using JSF and am using Tomcat 7.0.59 as my server. 我正在构建一个使用JSF的PoC,并使用Tomcat 7.0.59作为我的服务器。 My pom.xml looks like : 我的pom.xml看起来像:

<repositories>
        <repository>
            <id>Java.Net</id>
            <url>http://download.java.net/maven/2/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.7</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
        </dependency>
    </dependencies>

I looked up for the error and found out that it is caused due to the javaee-api but looks like even after adding that particular dependency the issue isn't resolving. 我查找错误并发现它是由javaee-api引起的,但看起来甚至在添加了特定的依赖项之后问题仍无法解决。 There is a different thread but it is on different servers like glassfish, jboss and doesn't seem to be working on my case. 有一个不同的线程,但它在不同的服务器,如glassfish,jboss,似乎并没有在我的情况下工作。

EDIT : After suggestions from Samuel and Tiny, I have reached to this pom.xml : 编辑:在Samuel和Tiny的建议之后,我已经达到了这个pom.xml:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

And maven dependency tree looks like : maven依赖树看起来像:

 com.Sourabh:SourabhTest:war:0.1
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- javax.faces:jsf-api:jar:2.1:compile
[INFO] \- com.sun.faces:jsf-impl:jar:2.1.7:compile

Servlet-api must be flagged with <scope>provided</scope> , as the jar in provided by tomcat. Servlet-api必须用<scope>provided</scope>标记,作为tomcat提供的jar。 If you don't you might encounter class loader issues. 如果不这样,您可能会遇到类加载器问题。

To ensure that you don't have several time the same dependency (through transitive dep.) you can run mvn dependency:tree or go in the dependency hierarchy plugin in eclipse 为了确保你没有多次相同的依赖(通过传递dep。)你可以运行mvn dependency:tree或者进入eclipse中的依赖层次结构插件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.ClassFormatError:类文件javax / faces / FacesException中不是本机或抽象的方法中的缺少Code属性 - java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/FacesException Java EE 6中类文件javax / mail / MessagingException中不是本机或抽象的方法中的缺少Code属性 - Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException in Java EE 6 ClassFormatError:在类文件 javax/mail/MessagingException 中非本机或抽象的方法中缺少代码属性 - ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException 方法中的Absent Code属性在类文件javax / servlet / ServletException中不是本机的或抽象的 - Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException class 文件 javax/validation/ConstraintViolationException 中非本机或抽象方法中的缺失代码属性 - Absent Code attribute in method that is not native or abstract in class file javax/validation/ConstraintViolationException java.lang.ClassFormatError:在类文件 javax/mail/MessagingException 中非本机或抽象的方法中缺少代码属性 - java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException 类文件javax / transaction / SystemException中不是本机或抽象的方法中的缺少Code属性 - Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException java.lang.ClassFormatError:类文件javax / mail / internet / ParseException中不是本机或抽象的方法中的缺少Code属性 - java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/internet/ParseException 类文件javax / servlet / ServletException中不是本机或抽象的方法中的Embedded Jetty Absent Code属性 - Embedded Jetty Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException JPA ClassFormat 错误“类文件 javax/persistence/Persistence 中非本机或抽象的方法中缺少代码属性” - JPA ClassFormat Error "Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM