-1

Context:

I am trying out the HelloWorld program through primefaces as mentioned in this tutorial here with the source code:

http://www.mkyong.com/wp-content/uploads/2012/08/primefaces-hello-world-example.zip

Problem:

Despite removing all references to primefaces 3.3 jar from pom and also deleting from local maven repo the application fails at runtime (deployment) with the error log as below. I am using maven for my build and JBOSS Studio + Wildfly for my development and deployment.

**> deployment: : com.sun.faces.config.ConfigurationException:    Source
Caused by: com.sun.faces.config.ConfigurationException: 
  Source Document: vfs:/E:/Wildfly/wildfly-10.1.0.Final/wildfly-10.1.0.Final/standalone/deployments/primefaces.war/WEB-INF/lib/primefaces-3.3.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

Below is my pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mkyong.core</groupId>
    <artifactId>primefaces</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>primefaces Maven Webapp</name>
    <url>http://maven.apache.org</url>

    <repositories>
        <repository>
            <id>prime-repo</id>
            <name>Prime Repo</name>
            <url>http://repository.primefaces.org</url>
<!--                <url>http://maven.apache.org</url> -->
        </repository>
    </repositories>

    <dependencies>

        <!-- PrimeFaces -->

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>6.1</version>
    </dependency>

        <!-- JSF -->
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.11</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>

        <!-- EL -->
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>el-impl</artifactId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.2</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Any clue would be great!

raikumardipak
  • 1,461
  • 2
  • 29
  • 49
  • 1
    Add apache commons-fileupload as a dependency to your project – Jens Jul 20 '17 at 05:32
  • @Jens I guess I have already done that but may have not shown in the pom.xml here as it is not the latest one I brought to copy here from my workstation. Let me still have a relook. I'll keep you posted. – raikumardipak Jul 20 '17 at 05:34

1 Answers1

0

you need to add bellow dependency :

<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3.2</version>
</dependency> 
Anshul Sharma
  • 3,432
  • 1
  • 12
  • 17
  • I already have the commons-fileupload dependency added but the 1.2.2 version – raikumardipak Jul 20 '17 at 05:48
  • 1
    then try to upgrade it with `1.3.2` and update the project and rebuild it – Anshul Sharma Jul 20 '17 at 05:49
  • @BalusC why is there such a haste to mark duplicate? I have seen your post and all over the place for the answer ( not because your answer is wrong but my own shortcomings on this). U could have waited until i had marked an answer correct. – raikumardipak Jul 20 '17 at 05:51
  • @Dirai: that is not the usual way. If it is a duplicate in the eyes of experts, marking it as such is common/normal practice. – Kukeltje Jul 20 '17 at 06:07
  • @Kukeltje The context for my problem is different than that BalusC has mentioned in his post. I have the required common io/ file-upload jars in my maven directory. It builds clean in maven but fails to deploy as a war. – raikumardipak Jul 20 '17 at 06:56
  • @Kukeltje Can you re-open the question please now? – raikumardipak Jul 20 '17 at 17:51
  • Thanks to this post https://stackoverflow.com/questions/7908090/downloading-all-maven-dependencies-to-a-directory-not-in-repository I ran the command mvn dependency:copy-dependencies and cleaned the Wildfly Server to re start the HelloWorldprimefaces and the web app finally did get deployed. @BalusC Please re-open this question. – raikumardipak Jul 20 '17 at 17:56
  • ok.................... – Anshul Sharma Jul 21 '17 at 04:03