fileupload issue on glassfish3 and netbeans6.9

UI Components for JSF
Post Reply
grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

18 Nov 2010, 18:53

Hey everyone, for some reason the filter mapping cant find primefaces servlet. When I add the filter mapping the app breaks, and get a glassfish error.

heres the web.xml thanks for the pointers.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.skin</param-name>
        <param-value>none</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>MediaStreamer</servlet-name>
        <servlet-class>Servlets.MediaStreamer</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>MediaStreamer</servlet-name>
        <url-pattern>/MediaStreamer</url-pattern>
    </servlet-mapping>
    <filter>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>faces/Logon.xhtml</welcome-file>
    </welcome-file-list>
</web-app>

Last edited by grburgos on 21 Dec 2010, 16:01, edited 1 time in total.
Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

18 Nov 2010, 21:20

Decided to try to test it in a clean simple example but it still fails me...
Not a single error code yet the file never gets to the server. Infact I tested it with firebug and it seems it doesnt even leave firefox like if the post never happens.

Any light on this?

Code: Select all

@ManagedBean(name = "UploadControler")
@RequestScoped
public class UploadControler {

    public void handleFileUpload(FileUploadEvent event) {
        System.out.print(event.getFile().getFileName());
    }
}

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!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:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <f:view contentType="text/html">
        <h:head>
            <title>Facelet Title</title>
        </h:head>
        <h:body>
            <p:panel>
                <h:form>
                    <p:fileUpload fileUploadListener="#{UploadControler.handleFileUpload}" auto="true" allowTypes="*.*" description="Files"/>
                </h:form>
            </p:panel>
        </h:body>
    </f:view>
</html>
Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

18 Nov 2010, 22:12

Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

20 Dec 2010, 19:09

Can someone help me with the upload thing. Please I uploaded a netbeans project that does the same as the show case. The difference is that showcase works mine doesnt.


Im using glassfish 3, netbeans 6.9.1

http://rapidshare.com/files/438401262/PrimeUpload.zip

Thank you.
Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

21 Dec 2010, 16:02

Glassfish seems to give me this error code when filter mappings are placed. Still trying to drill down on this...

type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: PWC1243: Filter execution threw an exception
root cause
com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class org.primefaces.webapp.filter.FileUploadFilter
root cause
com.google.common.collect.ComputationException: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
root cause
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
root cause
java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.0.1 logs.
Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

MikeK
Posts: 104
Joined: 13 Oct 2010, 15:07

21 Dec 2010, 16:47

Did you download tha Apache commons-fileupload library? The error suggest it is missing.

http://primefaces.prime.com.tr/forum/vi ... 091#p27091
Prime Faces 6.2
Mojarra 2.2.14
Apache Tomcat 9.0
Internet Explorer 10,11

grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

21 Dec 2010, 17:19

Ok thanks MikeK that solved the compilation. I thought Primefaces 2.2 didnt need extras libs to work with the upload. I thought that it was only optional. Anyways thank you!!
Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

21 Dec 2010, 18:33

Now the fileupload event is not firing.
i checked in the forum and I noticed there where registered issues on this in http://primefaces.prime.com.tr/forum/vi ... t&start=40 I currently upgrade to mojarra 2.0.3 yet the event doesnt work.

Code: Select all

 <h:form enctype="multipart/form-data" prependId="false">
                                <p:growl id="messages" showDetail="true"/>
                                <p:fileUpload fileUploadListener="#{RegNewsWizard.handleFileUpload}"  auto="true" allowTypes="*.jpg;*.png;*.gif;*.pdf;*.avi;" description="Images" update="messages"/>
</h:form>

Code: Select all

 public void handleFileUpload(FileUploadEvent event) {
        UploadedFile file = event.getFile();
        FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
        FacesContext.getCurrentInstance().addMessage(null, msg);
    }
Anyone?
Thanks!!
Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

bitec
Posts: 44
Joined: 20 Jan 2011, 21:34
Location: Russia

27 Jan 2011, 23:35

hello, grburgos, have you managed to solve the problem?

I've upgraded to Mojarra 2.04, but the FileUploadFilter isn't called, though it is in web.xml. May be the upgrade should be done in some specific way, not simply putting libraries to the project? It's very strange, that the filter isn't called, may be anyone could help me with this issue?

Thx.
JSF: Mojarra 2.1 | PrimeFaces 2.2.1 | Glassfish 3.1

grburgos
Posts: 180
Joined: 30 Sep 2010, 00:45

28 Jan 2011, 01:00

yes i did but not the way i wished.

I never got it to work. I ended up using tomahawk uploadfile. It integrates decently with primefaces. I guess we will have to wait and see PF3 to see it work properly.
Netbeans 14, Apache Tomcat 9, JDK 11, PrimeFaces 11

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests