Problemas com fileUpload do Primefaces

Boa tarde pessoal,

estou passando por aquele problema: ontem no meu notebook o codigo funcionava, hj eu transportei o codigo para uma maquina da empresa e advinhem ? Isso mesmo, meu código não funfou.

bom… vamos ao que interessa…

estou tentando fazer um fileupload do primefaces, mas o problema é que ele não executa o método, ou seja, ele passa todo o ciclo… da view e tudo mais… mas ele não entra no model, e por isso, ele não executa meu método do upload. Se alguem puder me ajudar, eu dei uma olhada hj e não consegui enxergar a solução.

Aqui está um trecho do meu xhtml:


<p:fileUpload imagem="/img/upload32.png" widgetVar="uploader" multiple="false" 
fileUploadListener="#{cotacaoBean.upload}" allowTypes="*.csv;" description="Images" customUI="true" />

<h:outputLink title="upload" onclick="uploader.upload();">

Upload
</h:outputLink >

Aqui meu método …


public void upload(FileUploadEvent evento){


byte[] arquivoUpload = evento.getFile().getContents();

................ 

Aqui está a configuração do meu web.xml


<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>
<filter-class> Faces Servlet</filter-class>

</filter-mapping>

Meu ManagedBean é do tipo @RequestScope e eu tenho as classes >> commons-fileupload-1.2.2 e commons-io-2.1

… alguém saberia me ajudar ?

Cara… se tava funcionando na tua máquina e não funcionou na máquina da empresa não seria esquema de segurança?

Não não, porque a máquina da empresa que tem aqui, ela não está em rede e não tem qualquer método de segurança de acesso ou algo do tipo …

EuclidesFilizola blz?

Cara to passando pelo mesmo problema…

Você conseguiu achar a solução?

No seu notebook você disse que ta funcionando… você poderia postar o código e me dizer que versão
do primefaces você ta utilizando?

Vlw brother ;D

Por favor, post o seu web.xml completo e o faces-config.xml tbm. Ah! E coloque a versão do Primefaces que utiliza e a versão do JSF.

benignoms,

Meu web.xml

[code]<?xml version=“1.0” encoding=“UTF-8”?>
<web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns=“http://java.sun.com/xml/ns/j2ee” xmlns:web=“http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
xsi:schemaLocation=“http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
id=“WebApp_ID” version=“2.4”>
<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>
<filter>
<filter-name>FilterBloqueaPaginas</filter-name>
<filter-class>br.com.acessavale.controller.security.FilterPaginasBloqueadas</filter-class>
</filter>
<filter-mapping>
<filter-name>FilterBloqueaPaginas</filter-name>
<url-pattern>/menu/</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Faces Config</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Config</servlet-name>
<url-pattern>
.faces</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>home.faces</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>br.com.acessavale.servlet.ImageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>/ImageServlet</url-pattern>
</servlet-mapping>

</web-app>[/code]

Meu faces-config.xml

[code]<?xml version="1.0" encoding="UTF-8"?>

<faces-config 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-facesconfig_2_0.xsd
version=“2.0”>

&lt;lifecycle&gt;
	&lt;phase-listener&gt;br.com.acessavale.controller.ListenerFases&lt;/phase-listener&gt;
&lt;/lifecycle&gt;

&lt;managed-bean&gt;
	&lt;managed-bean-name&gt;loginBBean&lt;/managed-bean-name&gt;
	&lt;managed-bean-class&gt;br.com.acessavale.controller.LoginBBean&lt;/managed-bean-class&gt;
	&lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
&lt;/managed-bean&gt;


&lt;managed-bean&gt;
	&lt;managed-bean-name&gt;cadastroBBean&lt;/managed-bean-name&gt;
	&lt;managed-bean-class&gt;br.com.acessavale.controller.CadastroBBean&lt;/managed-bean-class&gt;
	&lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
&lt;/managed-bean&gt;

&lt;managed-bean&gt;
	&lt;managed-bean-name&gt;PromocaoBBean&lt;/managed-bean-name&gt;
	&lt;managed-bean-class&gt;br.com.acessavale.controller.PromocaoBBean&lt;/managed-bean-class&gt;
	&lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
&lt;/managed-bean&gt;


&lt;managed-bean&gt;
	&lt;managed-bean-name&gt;novidadesBean&lt;/managed-bean-name&gt;
	&lt;managed-bean-class&gt;br.com.acessavale.controller.NovidadesBean&lt;/managed-bean-class&gt;
	&lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
&lt;/managed-bean&gt;

&lt;managed-bean&gt;
	&lt;managed-bean-name&gt;fotoBBean&lt;/managed-bean-name&gt;
	&lt;managed-bean-class&gt;br.com.acessavale.controller.FotoBBean&lt;/managed-bean-class&gt;
	&lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
&lt;/managed-bean&gt;

</faces-config>[/code]

A versão jsf que to usando é a 2.1.3

E a versão do primefaces é a 3.0.M4

Depois de muita dor de cabeça finalmente consegui fazer o upload
de arquivos funcionar com o Primefaces M4

As mudanças mais significativas foram no web.xml que acredito que estava
mal configurado no projeto

vou postar aqui caso possa ajudar alguem

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	id="WebApp_ID" version="2.4"&gt;
	&lt;context-param&gt;
	&lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
	&lt;param-value&gt;server&lt;/param-value&gt;
	&lt;/context-param&gt;
	&lt;filter&gt;
		&lt;filter-name&gt;FilterBloqueaPaginas&lt;/filter-name&gt;
		&lt;filter-class&gt;br.com.acessavale.controller.security.FilterPaginasBloqueadas&lt;/filter-class&gt;
	&lt;/filter&gt;
	&lt;filter-mapping&gt;
		&lt;filter-name&gt;FilterBloqueaPaginas&lt;/filter-name&gt;
		&lt;url-pattern&gt;/menu/*&lt;/url-pattern&gt;
	&lt;/filter-mapping&gt;
	&lt;servlet&gt;
		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
	&lt;/servlet&gt;
	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;*.faces&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;
	&lt;welcome-file-list&gt;
		&lt;welcome-file&gt;home.faces&lt;/welcome-file&gt;
	&lt;/welcome-file-list&gt;
	&lt;servlet&gt;
		&lt;servlet-name&gt;ImageServlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;br.com.acessavale.servlet.ImageServlet&lt;/servlet-class&gt;
	&lt;/servlet&gt;
	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;ImageServlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/ImageServlet&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;
	&lt;filter&gt;
		&lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
		&lt;filter-class&gt;org.primefaces.webapp.filter.FileUploadFilter&lt;/filter-class&gt;
	&lt;/filter&gt;
	&lt;filter-mapping&gt;
		&lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
	&lt;/filter-mapping&gt;
	&lt;session-config&gt;
		&lt;session-timeout&gt;30&lt;/session-timeout&gt;
	&lt;/session-config&gt;
&lt;/web-app&gt;