I have a server Weblogic 12.1.3, with JAX-RS 2.x installed as a shared library (see e.g. https://docs.oracle.com/middleware/1213/wls/RESTF/use-jersey20-ri.htm#RESTF297). This shared library includes e.g. javax.ws.rs-api-2.0.jar and jersey-media-multipart-2.5.1.jar.
Please notice I am not sure that my webapp is really using this shared library, or it is using the standard JAX-RS 1.x library.
Now I want to upload files in multipart/form-data format, so I guess I need to add this dependency on my project:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.5.1</version>
<scope>provided</scope>
</dependency>
However, the deploy fails, with error:
java.lang.ClassNotFoundException: org.glassfish.jersey.media.multipart.FormDataContentDisposition
So, I thought I could put my own library within my webapp:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.5.1</version>
</dependency>
In this second case, the deploy fails with the following error:
java.lang.ClassNotFoundException: org.glassfish.jersey.ExtendedConfig
Any idea? Thank you.
At last, I got it work. I was missing both configuration in weblogic.xml and web.xml (I didn't know it was necessary web.xml).
Weblogic.xml:
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" 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 http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
<!-- Questo è per referenzialre la shared library jax-rs 2.x -->
<wls:library-ref>
<wls:library-name>jax-rs</wls:library-name>
<wls:specification-version>2</wls:specification-version>
<wls:implementation-version>2.5.1</wls:implementation-version>
<wls:exact-match>false</wls:exact-match>
</wls:library-ref>
<wls:container-descriptor>
<wls:prefer-application-packages>
<!-- apis -->
<wls:package-name>javax.ws.rs.*</wls:package-name>
<!-- guava -->
<wls:package-name>com.google.common.*</wls:package-name>
<!-- jersey1 providers -->
<wls:package-name>com.sun.jersey.*</wls:package-name>
<!-- media providers -->
<wls:package-name>org.eclipse.persistence.jaxb.rs.*</wls:package-name>
<wls:package-name>org.codehaus.jackson.jaxrs.*</wls:package-name>
<!-- wls -->
<wls:package-name>weblogic.jaxrs.api.client.*</wls:package-name>
<wls:package-name>weblogic.jaxrs.internal.api.client.*</wls:package-name>
<wls:package-name>weblogic.jaxrs.dispatch.*</wls:package-name>
<wls:package-name>weblogic.jaxrs.monitoring.util.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
<wls:context-root>uploader</wls:context-root>
</wls:weblogic-web-app>
Web.xml:
<servlet>
<servlet-name>JAX-RS</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>mypackage.jaxrs.JAXRSApplication
</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.filter.LoggingFilter;org.glassfish.jersey.media.multipart.MultiPartFeature
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS</servlet-name>
<url-pattern>/v1/*</url-pattern>
</servlet-mapping>
Notice in particular the reference to MultiPartFeature.
Edit
As I thought, the web.xml is not necessary. You can put all the properties inside the Application class. The configuration above is more or less equivalent to the following
#ApplicationPath("/v1")
public class JAXRSApplication extends Application {
#Override
public Map<String, Object> getProperties() {
Map<String, Object> properties = new HashMap<>();
properties.put("jersey.config.server.provider.packages", "mypackage");
properties.put("jersey.config.server.provider.classnames",
"org.glassfish.jersey.filter.LoggingFilter;org.glassfish.jersey.media.multipart.MultiPartFeature");
return properties;
}
}
Related
I have a Jersey 1 ContainerResponseFilter in a shared library, which I register in Jersey 1 web services by specifying the package this filter exists in inside the web.xml eg.
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>
com.xxx.utils.jersey
</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
<param-value>com.xxx.utils.jersey.CrossDomainFilter</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.xxx.utils.jersey</param-value>
</init-param>
...
</servlet>
I am now trying to use this shared library in a Jersey 2 web service which instead of using the web.xml to configure Jersey uses a class annotated with #ApplicationPath and extending the Jersey ResourceConfig. Inside this class I am not specifying the package of this Jersey 1 filter anywhere.
The problem I am getting is because this Jersey 2 web service doesn't include any Jersey 1 dependencies in the war I am getting a ClassNotFoundException during deployment of the webservice for com.sun.jersey.spi.container.ContainerResponseFilter
Here is an example of how I am creating my config
#ApplicationPath("/")
public class AppConfig extends ResourceConfig
{
private static final String RESOURCE_PACKAGE = "com.xxx.services.rest";
public AppConfig()
{
packages(RESOURCE_PACKAGE);
register(ApiListingResource.class);
register(SwaggerSerializers.class);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.0");
beanConfig.setResourcePackage(RESOURCE_PACKAGE);
beanConfig.setSchemes(new String[]{"http"});
beanConfig.setHost("localhost:7001");
beanConfig.setBasePath("/usr/");
beanConfig.setScan(true);
}
}
Is there a way I can make sure this Jersey 1 class is not loaded from the shared library, can I explicitly exclude the package?
EDIT:
A bit more investigation seems to imply it's something to do with CDI, the ContainerResponseFilter is annotated as a #Producer. If I remove the annotation from the class then I no longer receive the exception.
The container I am using is weblogic 12.2.1 which I believe uses Weld as its CDI provider. So I created a beans.xml with the following as indicated by this bit of Weld documentation
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:weld="http://jboss.org/schema/weld/beans">
<weld:scan>
<weld:exclude name="com.xxx.utils.jersey.**"/>
</weld:scan>
</beans>
But it doesn't seem to solve the issue. Any ideas?
I am having an interesting problem with the PrimeFaces 4.0 final FileUpload element.
I am trying to run:
PrimeFaces 4.0 final
Apache MyFaces 2.2.0-beta
Tomcat 7.0.27
I have a very simple setup right now,
XHTML page:
<?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.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<p:fileUpload
fileUploadListener="#{fileUploadController.handleFileUpload}"
mode="advanced" update="messages" sizeLimit="100000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
<p:growl id="messages" showDetail="true" />
</h:form>
</h:body>
</html>
With this backing bean:
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import org.primefaces.event.FileUploadEvent;
#ManagedBean
#RequestScoped
public class FileUploadController
{
public void handleFileUpload(FileUploadEvent event)
{
FacesMessage msg = new FacesMessage("Succesful", event.getFile()
.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
When selecting a file and uploading it, nothing happens.
The upload submit succeeds with the following response:
<?xml version="1.0" encoding="UTF-8"?><partial-response><changes><update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[2C7ZmtwSmrlbgI/wJLI2CLBaMOQP9R/pYkIXpHlXkhSKIhtfFM0sx0HmL8o9MQY2MdHXg4t1vUjJbUYkAdFBmOQUaFy7hFhPr34Za4hOuLW4CPNx]]></update></changes></partial-response>
but no message is displayed, and if I set a breakpoint, it does not get hit.
If, however, I pull out MyFaces 2.2.0-beta and put in Mojarra 2.2.0, everything works as expected.
I would prefer to continue to use MyFaces as it is what I've used in the past, so if anyone has any ideas as to a patch to get this to work, it would be much appreciated.
Thank you
web.xml
<?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/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>UploadTest</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<description>
This parameter tells MyFaces if javascript code should be allowed in
the rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default is 'true'</description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
If true, rendered HTML code will be formatted, so that it is 'human-readable'
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default is 'true'</description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default is 'false'
</description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
<!-- <listener-class>com.sun.faces.config.ConfigureListener</listener-class> -->
</listener>
Update
It seems that Myfaces 2.2.0-beta has problems using the Part API present in servlet 3.x.
udaykiran pulipati has part of a solution with using web the web.xml filters that PrimeFaces 3.x required and the commons file upload & commons io jars, however, we also need to add the following context-param to the web.xml or the filters get ignored :
<context-param>
<param-name>primefaces.UPLOADER</param-name>
<param-value>commons</param-value>
</context-param>
This will force PrimeFaces to use the commons library which fixes the problem
That being said, I would still like to know why MyFaces can't seem to use the servlet Part API if anyone has any ideas. I suspect it may have to do with my Tomcat version as I am only on 7.0.27, but I doubt that.
Mention below filters in web.xml file for uploading a file using PrimeFaces
<!-- PrimeFaces FileUpload Filter -->
<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>
and add jars to lib folder. PrimeFaces needs below jars for fileuploading.
commons-fileupload-1.3.jar,
commons-io-2.4.jar
Recently it was found a similar issue with a better description in MYFACES-3835. It was a problem related to webkit browsers that only appears when the ajax response is large enough. It has been already fixed.
udaykiran pulipati's answer motivated me to replace commons-fileupload-1.2.2.jar with commons-fileupload-1.3.jar in my project, but that didn't solve the issue for me, as I'm using MyFaces 2.2, PrimeFaces Elite 4.0.8, and TomEE 1.6.1-snapshot.
Also, per udaykiran pulipati's answer, I already added PrimeFaces FileUpload filter config to my web.xml, many months ago.
So, I looked at PrimeFaces 4.0 user guide, and recognized something 'new' that could be specified in web.xml. So, I added the following to my web.xml,
<context-param>
<param-name>primefaces.UPLOADER</param-name>
<param-value>commons</param-value>
</context-param>
and finally, PrimeFaces (Elite) 4.0.x FileUpload works with MyFaces 2.2.
I am using Arquillian with a tomee-embedded container in order to test my JAX-RS web service. In my test case, I am running a jersey test client accessing the provided resource. However, the test always results in a 404 NOT FOUND status when accessing the resource.
When deploying the same project on my tomee-jaxrs instance, the resource is provided properly.
These are the maven dependencies that I've included in my test project:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>arquillian-tomee-embedded</artifactId>
<version>${tomee.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<scope>test</scope>
<type>pom</type>
</dependency>
My test case looks as follows:
#RunWith(Arquillian.class)
public class DemoTest {
#Deployment
public static WebArchive createDeployment() throws Exception {
return ShrinkWrap.create(WebArchive.class).addPackage(Controller.class.getPackage()).setWebXML("ch/codenation/test/regression/resources/container/WEB-INF/web.xml");
}
#ArquillianResource
private URL url;
#Test
public void testGetData() throws Exception {
final IApplicationLayer applicationLayer = new JaxRsApplicationLayer(url.toURI());
final Callable<String> dataProvider = new DataProvider(applicationLayer);
Assert.assertEquals("asdf", dateProvider.call());
}
}
As well as my web.xml:
<?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/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>codenation-service</display-name>
<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
The JAX-RS resource is indeed unavailable, for when I put a breakpoint in the test method and try to access the resource in the browser, I receive a 404 message. Doing the same thing when deplyoing the archive to a tomee-jaxrs server works fine, however. Are there any additional maven dependencies or arquillian configuration settings I need to add here in order to make this work?
Thanks for any feedback and best regards
Pascal
Just include this in your pom.xml
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-jaxrs</artifactId>
<version>${tomee.version}</version>
<scope>test</scope>
</dependency>
and you can work with the embedded TomEE.
There seems to be no way to switch the tomee-embedded adapter to a plus configuration. I therefore switched over to the tomee-remote adapter.
I'm currently experimenting with some RESTful JAX and I want to validate a custom input. Normally regex would be fine but I need to do a more extensive check (~10 different regex patterns). I found this page when searching for jaxrs validation. I noted it says "Draft" but I thought I'd give it a try.
I wrote my parameter annotation like this:
#Target(ElementType.PARAMETER)
#Retention(RetentionPolicy.RUNTIME)
#Constraint(validatedBy = FooBarValidator.class)
public #interface FooBarParam
{
}
The validator looks like this:
#Provider
public class FooBarValidator
implements ConstraintValidator<FooBar, Long>
{
#Override
public void initialize(FooBar constraintAnnotation)
{
}
#Override
public boolean isValid(Long value, ConstraintValidatorContext context)
{
// validation goes here, this is a test validation
return (value > 50);
}
}
The web service looks like this:
#javax.ejb.Stateless
#Path("test")
public class testRS
{
#GET
#Path("foobar/{fooBar: [0-9]+}")
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.TEXT_PLAIN)
public String testService(#FooBar #PathParam("fooBar") Long fooBar)
{
return "tested with: " + fooBar;
}
}
But if I call my web service with my browser using "http://localhost:8080/jaxtest/rest/test/foobar/11" the web service gets called and I'm presented with "tested with: 11". The web service works fine, except the validator doesn't get called.
I've tried setting breakpoints in the validator class and the annotation interface but none are hit.
I've got a sneaking suspicion that I'm doing something that isn't possible because of the "Draft" header in the referenced documentation. So if I'm doing something wrong or if there are alternatives, I'm glad to hear it.
Thanks to the hint #PiotrKochański gave me I've successfully implemented exactly what I wanted. The biggest problem was that I'm bound to using Glassfish. By default Glassfish uses Jersey to handle JAX stuff.
It took me well over 10 hours of struggling to complete this so let this be a time saver for anyone who stumbles upon this.
First of all, use Maven, this makes your life so much easier.
Second step, add the JBoss repo to your pom.xml
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
Third step, add dependencies to pom.xml
<!-- Needed for validator interceptors -->
<dependency>
<groupId>org.jboss.seam.rest</groupId>
<artifactId>seam-rest</artifactId>
<version>3.1.0.Final</version>
</dependency>
<!-- JBoss' RS implementation -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.4.Final</version>
</dependency>
<!-- Because I use JSON I need RESTeasy be able to handle this -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jettison-provider</artifactId>
<version>2.3.4.Final</version>
</dependency>
<!-- This is THE part that integrates validation in RESTeasy -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-hibernatevalidator-provider</artifactId>
<version>2.3.4.Final</version>
</dependency>
The last dependency took me quite a while. The docs #PiotrKochański pointed to didn't mention this. However in another version of the docs I found this:
The integration between the API implementation and RESTEasy is done through the resteasy-hibernatevalidator-provider component. In order to integrate, we need to add resteasy-hibernatevalidator-provider and hibernate-validator to the classpath. With maven it's just a matter of including the following dependency:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-hibernatevalidator-provider</artifactId>
<version>2.3-RC1</version>
</dependency>
The fourth step was to add this to web.xml
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>REST Service</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
The fifth step was to modify the web service class like this:
#javax.ejb.Stateless
#Path("test")
public class testRS
{
#GET
#Path("foobar/{fooBar}")
#Produces(MediaType.APPLICATION_JSON)
#org.jboss.resteasy.spi.validation.ValidateRequest
public String testService(#FooBar #PathParam("fooBar") Long fooBar)
{
return "tested with: " + fooBar;
}
}
The sixth step was to modify the #interface to this:
#Target(ElementType.PARAMETER)
#Retention(RetentionPolicy.RUNTIME)
#Constraint(validatedBy = FooBarValidator.class)
public #interface FooBarParam
{
String message() default "{constraint.FooBar}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
Also as a bonus; I came across a presentation about Bean Validation by Emmanuel Bernard I thought I might share as this explains a lot of interesting stuff.
The page you found is one of the proposal on what should go into JAX-RS 2.0 (which is not final and there is no implementation of that). The plan is for JAX-RS 2.0 to integrate with Bean Validation - but as I said, that's not implemented yet.
Currently, if you want to validate input, you can declare the parameter as String (instead of Long) and do the validation as part of the resource method. Then convert to Long if the validation passes.
I am using PF 3.0.RC1 / NetBeans 7.0.1 and when I try to set fileUploadListener for fileUpload component , NetBeans gives this warning "Unknown Property 'handleFileUpload' " at leftmost of line.
In debug mode when I use fileUpload , it don't call handleFileUpload method and nothing becomes.
What can I do for this problem ?
The code in the xhtml page :
<p:fileUpload fileUploadListener="#{BDS_System.handleFileUpload}" mode="advanced"
sizeLimit="500000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
The code in the managed bean :
public void handleFileUpload(FileUploadEvent event) {
String fileName = event.getFile().getFileName();
byte[] fileBytes = event.getFile().getContents();
...
}
Solved and solution :
Adding
<h:form enctype="multipart/form-data">
and two libraries ,commons-fileupload and commons-io .For maven projects ;
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId> commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId> commons-io</artifactId>
<version>2.1</version>
</dependency>
my guess that it is that just like in BalusC answer in this thread: "Unknown Property" the error message of netbeans is nonsense , I think you forgot something in the fileupload config , like the
Getting started with FileUpload
First thing to do is to configure the fileupload filter which parses the multipart request. FileUpload filter should map to Faces Servlet.
<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>
and make sure to add enctype to your form like this:
<h:form enctype="multipart/form-data">
if all of the above wont help , take a look at BalusC answer in here: How to use PrimeFaces p:fileUpload