jsf - Deploying PrimeFaces app to GlassFish4 causes java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItem -
i'd use <p:calendar>
in jsf app developed in netbeans, added primefaces library. however, when deploy app, errors follows:
context name [/managedbeanswithcomponents] has not yet been started c:\users\dell-pc\documents\netbeansprojects\managedbeanswithcomponents\nbproject\build- impl.xml:1040: module has not been deployed. see server log details. build failed (total time: 1 second)
and server log says:
source document: jar:file:/c:/users/dell-pc/documents/netbeansprojects/managedbeanswithcomponents/build/web/web-inf/lib/primefaces-3.5.jar!/meta-inf/faces-config.xml cause: class 'org.primefaces.component.fileupload.fileuploadrenderer' missing runtime dependency: java.lang.noclassdeffounderror: org/apache/commons/fileupload/fileitem
how caused , how can solve it?
java.lang.noclassdeffounderror: org/apache/commons/fileupload/fileitem
there cause. it's crystal clear. mentioned class missing in runtime classpath. solution rather straightforward: put mentioned class (or, jar file containing it) in runtime classpath. package name hints, it's available on http://commons.apache.org/fileupload (which in turn has way http://commons.apache.org/io dependency). download , drop jars in same place primefaces jar , should well.
unrelated concrete problem, note particular problem in turn unintented primefaces. problem should occur when register fileuploadfilter
<p:fileupload>
component in web.xml
. however, since glassfish 4.0, overzealously preloading every single jsf component , renderer class found in classpath if it's never used application. class loading in turn causes runtime dependencies checked. if it's missing, noclassdeffounderror
. problem specific glassfish 4.0 , not occur when using glassfish 3.x or other servletcontainer such tomcat or jboss.
Comments
Post a Comment