jsf-2 – 获取错误缺少运行时依赖项:java.lang.NoClassDefFoundError:org / apache / commons / fileupload / FileItem

前端之家收集整理的这篇文章主要介绍了jsf-2 – 获取错误缺少运行时依赖项:java.lang.NoClassDefFoundError:org / apache / commons / fileupload / FileItem前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试设置Maven,JSF和Primefaces项目.但是,当我运行该项目时,我得到以下错误
com.sun.faces.config.ConfigurationException: 
Source Document: jar:file:/D:/Personal%20Work/eclipse%2032%20Bit/workspace/Java%20EE
/Spring/.Metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
/ch18_SpringWebFlowAndJSF/WEB-INF/lib/primefaces-3.5.jar!/Meta-INF/faces-config.xml
Cause: Class 'org.primefaces.component.fileupload.FileUploadRenderer' is missing
 a runtime dependency: java.lang.NoClassDefFoundError: org/apache/commons/fileupload
/FileItem

这是我的POM片段

<properties>
    <java-version>1.6</java-version>
    <org.springframework-version>3.2.3.RELEASE</org.springframework-version>
    <org.aspectj-version>1.6.10</org.aspectj-version>
    <org.slf4j-version>1.7.5</org.slf4j-version>
    <jsf-version>2.2.0</jsf-version>
</properties>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-faces</artifactId>
        <version>2.3.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>${jsf-version}</version>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>${jsf-version}</version>
    </dependency>

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.5</version>
    </dependency>
</dependencies>

<repositories>
    <repository>  
        <id>prime-repo</id>  
        <name>PrimeFaces Maven Repository</name>  
        <url>http://repository.primefaces.org</url>  
        <layout>default</layout>  
    </repository>     
</repositories>

为什么我收到此错误

谢谢

java doc

NoClassDefFoundError Thrown if the Java Virtual Machine or a
ClassLoader instance tries to load in the definition of a class (as
part of a normal method call or as part of creating a new instance
using the new expression) and no definition of the class could be
found.

The searched-for class definition existed when the currently executing
class was compiled,but the definition can no longer be found.

org.apache.commons.fileupload.FileItem是Apache Commons的FileUpload组件中的一个类,它在类路径中缺失.在pom.xml中为FileUpload组件添加以下maven依赖项.

<dependency>   
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>     
    <version>x.x</version>
 </dependency>

你也可以查看BalusC的@L_502_2@,

原文链接:https://www.f2er.com/javaschema/282008.html

猜你在找的设计模式相关文章