primefaces: FileUpload: NoClassDefFoundError: org/apache/commons/io/FilenameUtils

1) Environment

  • PrimeFaces version: 6.2.10
  • Application server + version: wildfly 10
  • Affected browsers: Chrome, Internet Explorer

2) Expected behavior

If a file is uploaded there should be no error.

3) Actual behavior

Getting error “java.lang.NoClassDefFoundError: org/apache/commons/io/FilenameUtils” after file upload. After adding the maven depency

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

to my POM no more error is shown.

4) Steps to reproduce

Run the same xhtml (above) choose a file a choose “upload” after that you will get the error “java.lang.NoClassDefFoundError: org/apache/commons/io/FilenameUtils”

5) Sample XHTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head></h:head>
    <h:body>
        <h:form id="chantierForm" enctype="multipart/form-data">
            <p:fileUpload />
        </h:form>
    </h:body>
</html>

6) Sample bean

No bean needed

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

(Probably 😉) my last comment for this one. Now that I’ve learnt about shade plugin and studied FileUploadUtils class I find this issue very educational. Also my understanding of the problem is slightly different than on Friday.

@Rapster I do not have problem described here, nor the stack trace.

@fabermundi again… You’d be a better help if you give the full stacktrace to Mert