oktay
oktay

Reputation: 33

PrimeFaces FileUpload Filter ClassNotFound Exception

I am getting an error while running a JSF project. Here is the error log;

org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter PrimeFaces FileUpload Filter
java.lang.ClassNotFoundException: org.primefaces.webapp.filter.FileUploadFilter
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Project] startup failed due to previous errors

I've already created a user library added commons-fileupload-1.3.jar and commons-io-2.4.jar files but I'm still gettin the error. Any ideas?

Upvotes: 3

Views: 5875

Answers (1)

BalusC
BalusC

Reputation: 1108632

I gather that you mean the Eclipse-specific user library management when you said "user library" there. I also gather that you've PrimeFaces already installed, otherwise this is food for Mr. Obvious. Its FileUploadFilter will indeed fail to initialize like that if Commons FileUpload and/or Commons IO are absent. You should see a NoClassDefFoundError further in the stack trace.

Just creating a new "user library" and adding to Build Path of project's properties is not exactly the right way. They also need to end up in /WEB-INF/lib of the built WAR. Usually, you'd need to add the user library in Deployment Assembly section of project's properties as well. However, this whole process is unnecessarily clumsy. Just drop those two JAR files in /WEB-INF/lib folder of dynamic web project. Eclipse will then automatically do all the necessary magic. You don't need to fiddle in project's properties. To avoid conflicts, undo all those changes which you ever made in Build Path.

Upvotes: 2

Related Questions