Primefaces 10 dataTable p:dataExporter generate ArrayIndexOutOfBoundsException on render after migration - jsf

Environment:
Jboss 7.2
Primefaces 10
Java 11
I have migrated from primefaces 8 to primefaces 10 dataTable p:dataExporter generate ArrayIndexOutOfBoundsException on render the xhtml.
When I comment out dataexporter the xhtml render well.
Following the migration guide the only important change seems to be taht PDF library has been switched from iText to Libre OpenPDF.
I've tried two differents contexts and one works and one not, differences:
The context that it works, does not have authentication
The context that it does not work, have keycloack authentication and two themes dependencies.
I don't think is related with primefaces themes but it could be because of keycloak as it shows handeling request in log error.
Any reason why is giving this error?
Server error
[161.883s][info][class,load] jdk.internal.reflect.GeneratedConstructorAccessor159 source: __JVM_DefineClass__
[161.885s][info][class,load] jdk.internal.reflect.GeneratedConstructorAccessor160 source: __JVM_DefineClass__
[161.886s][info][class,load] javax.faces.event.ExceptionQueuedEventContext source: jar:file:/C:/desarrollo/servers/jboss-eap-7.2/modules/system/layers/base/javax/faces/api/main/jboss-jsf-api_2.3_spec-2.3.5.SP1-redhat-1.jar!/
[161.887s][info][class,load] org.primefaces.application.exceptionhandler.ExceptionInfo source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/primefaces-10.0.0.jar
[161.887s][info][class,load] java.lang.Throwable$WrappedPrintWriter source: jrt:/java.base
15:25:43,304 SEVERE [org.primefaces.application.exceptionhandler.PrimeExceptionHandler] (default task-1) Index 15 out of bounds for length 15: java.lang.ArrayIndexOutOfBoundsException: Index 15 out of bounds for length 15
at javax.faces.api#2.3.5.SP1-redhat-1//javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1439)
at javax.faces.api#2.3.5.SP1-redhat-1//javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1460)
at javax.faces.api#2.3.5.SP1-redhat-1//javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:955)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.application.view.JspStateManagementStrategy.restoreView(JspStateManagementStrategy.java:273)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:139)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:295)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:157)
at javax.faces.api#2.3.5.SP1-redhat-1//javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:125)
at javax.faces.api#2.3.5.SP1-redhat-1//javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:125)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:204)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:133)
at com.sun.jsf-impl#2.3.5.SP2-redhat-00001//com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
at javax.faces.api#2.3.5.SP1-redhat-1//javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at deployment.accfor2.ear.accfor-back.war//es.caib.accfor.presentation.back.security.UserPrincipalManager.doFilter(UserPrincipalManager.java:83)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at deployment.accfor2.ear//es.caib.accfor.commons.administracio.boundary.ThemeFilter.doFilter(ThemeFilter.java:59)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at deployment.accfor2.ear.accfor-ejb.jar//es.caib.accfor.business.logging.boundary.TimeLog.doFilter(TimeLog.java:54)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at deployment.accfor2.ear.accfor-ejb.jar//es.caib.accfor.business.encoding.boundary.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:20)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.opentracing.contrib.opentracing-jaxrs2#0.1.7.redhat-00001//io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:55)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.keycloak.keycloak-undertow-adapter#11.0.2//org.keycloak.adapters.undertow.UndertowAuthenticatedActionsHandler.handleRequest(UndertowAuthenticatedActionsHandler.java:66)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at org.keycloak.keycloak-undertow-adapter#11.0.2//org.keycloak.adapters.undertow.ServletPreAuthActionsHandler.handleRequest(ServletPreAuthActionsHandler.java:69)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#7.2.0.GA-redhat-00005//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet#2.0.15.Final-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
at io.undertow.core#2.0.15.Final-redhat-00001//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
at org.jboss.threads#2.3.2.Final-redhat-1//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.3.2.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads#2.3.2.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads#2.3.2.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.base/java.lang.Thread.run(Thread.java:834)
[161.908s][info][class,load] javax.faces.component.html.HtmlMessages$PropertyKeys source: jar:file:/C:/desarrollo/servers/jboss-eap-7.2/modules/system/layers/base/javax/faces/api/main/jboss-jsf-api_2.3_spec-2.3.5.SP1-redhat-1.jar!/
[161.914s][info][class,load] org.primefaces.model.DefaultStreamedContent source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/primefaces-10.0.0.jar
[161.915s][info][class,load] org.primefaces.model.DefaultStreamedContent$Builder source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/primefaces-10.0.0.jar
[161.916s][info][class,load] es.caib.accfor.presentation.back.ResourceBean$$Lambda$1133/0x0000000801c24840 source: es.caib.accfor.presentation.back.ResourceBean
[161.920s][info][class,load] org.apache.commons.io.IOUtils source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/commons-io-2.6.jar
[161.920s][info][class,load] org.apache.commons.io.output.StringBuilderWriter source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/commons-io-2.6.jar
[161.921s][info][class,load] org.apache.commons.io.output.ByteArrayOutputStream source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/commons-io-2.6.jar
[161.922s][info][class,load] org.apache.commons.io.Charsets source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/commons-io-2.6.jar
[161.934s][info][class,load] org.primefaces.component.graphicimage.GraphicImageRenderer$$Lambda$1134/0x0000000801c24c40 source: org.primefaces.component.graphicimage.GraphicImageRenderer
[161.935s][info][class,load] org.primefaces.util.DynamicContentSrcBuilder source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/primefaces-10.0.0.jar
[161.937s][info][class,load] org.primefaces.util.LimitedSizeHashMap source: vfs:/C:/desarrollo/workspace/accfor2/accfor/accfor-ear/target/accfor2/accfor-back.war/WEB-INF/lib/primefaces-10.0.0.jar
Persones.xhtml
<p:dataTable id="lstPersones" var="item" value="#{personesBean.items}" widgetVar="lstPersones"
selection="#{personesBean.selected}" selectionMode="single"
rowKey="#{item.id}"
reflow="true" paginatorPosition="bottom" paginator="true" rows="10"
rowsPerPageTemplate="10,25,50,100" emptyMessage="#{messages['noResultats']}"
pageLinks="5" lazy="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PageLinks} {LastPageLink} {RowsPerPageDropdown} {Exporters} {Buttons}"
currentPageReportTemplate="#{messages['resultats']} #{messages['paginesDataList']}.">
<p:ajax event="rowSelect" listener="#{personesBean.onRowSelect}"/>
<f:facet name="{Exporters}">
<h:commandLink>
<p:graphicImage library="images/icons" name="xls.png"
title="#{messages['exportarXLS']}" style="border:0;"/>
<p:dataExporter type="xls" target="lstPersones" fileName="export_persones"/>
</h:commandLink>
</f:facet>
...
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
...
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{themeSwitcherBean.theme}</param-value>
</context-param>
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>primefaces.CSP</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
...
</web-app>

I finally found the problem why I could not export files with p:dataExporter.
The web.xml file contained the context param javax.faces.PARTIAL_STATE_SAVING defined to false, so I commented out and I worked well!
The problem in web.xml
...
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
...

Related

Unable to use beans with jsf 2.3 in servlet container [duplicate]

This question already has answers here:
How to install and use CDI on Tomcat?
(2 answers)
Closed 4 years ago.
I started to test JSF 2.3 a short time ago. But I can't get one of the most important features to work. The use of ManagedBeans. I tried a lot, using different servlet containers (Tomcat 8&9, Jetty 9.2).But nothing helped. Hope somebody can see my failure in the resources. It's frustrating. I debugged but the bean is never reached. The primefaces component works fine(the primefaces lib is not the reason). But I never get bean data. PS. I'm using myfaces but with mojarra I've got the same problem.
my bean:
import javax.enterprise.context.RequestScoped;
import javax.faces.annotation.FacesConfig;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import java.io.Serializable;
#Named(value = "sampleBean")
#RequestScoped
#FacesConfig(version = FacesConfig.Version.JSF_2_3)
public class SampleBean implements Serializable {
private String specTitle;
private String specVersion;
private String implTitle;
private String implVersion;
public SampleBean() {
Package facesPackage = FacesContext.class.getPackage();
specVersion = facesPackage.getSpecificationVersion();
specTitle = facesPackage.getSpecificationTitle();
implTitle = facesPackage.getImplementationTitle();
implVersion = facesPackage.getImplementationVersion();
}
public String info() {
return "hello from sampleBean!";
}
public String getSpecTitle() {
return specTitle;
}
public String getSpecVersion() {
return specVersion;
}
public String getImplTitle() {
return implTitle;
}
public String getImplVersion() {
return implVersion;
}
}
my configuration bean:
import javax.faces.annotation.FacesConfig;
#FacesConfig(version = FacesConfig.Version.JSF_2_3)
public class ConfigurationBean {
}
my facelet:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Hello JSF 2.3</title>
<style>
.col-1 { text-align: right; }
.col-2 { font-weight: bold; }
</style>
</h:head>
<h:body>
<div style="border-style: dashed" class="ui-g">
<p:calendar mode="inline"/>
</div>
<div style="border-style: double">
<h3>Hello from JSF 2.3!</h3>
<h:panelGrid columns="2" columnClasses="col-1, col-2">
<h:outputText value="Specification:"/>
<h:outputText value="#{sampleBean.specTitle}"/>
<h:outputText value="Specification version:"/>
<h:outputText value="#{sampleBean.specVersion}"/>
<h:outputText value="Implementation:"/>
<h:outputText value="#{sampleBean.implTitle}"/>
<h:outputText value="Implementation version:"/>
<h:outputText value="#{sampleBean.implVersion}"/>
</h:panelGrid>
<p>CDI injection support: <b>#{sampleBean.facesContextValue}</b></p>
<p>Running on: <b>#{application.serverInfo}</b></p>
</div>
my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"><!-- Use web-app_4_0.xsd, version=4.0 after update to Java EE 8 -->
<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.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.ENABLE_CDI_RESOLVER_CHAIN</param-name>
<param-value>truet</param-value>
</context-param>
<context-param>
<param-name>javax.faces.ENABLE_WEBSOCKET_ENDPOINT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.validator.ENABLE_VALIDATE_WHOLE_BEAN</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>0</param-value> <!-- No Cache -->
</context-param>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
my build.gradle:
plugins {
id 'war'
id 'org.gretty' version '2.2.0'
}
group 'de.danri'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
}
gretty{
//servletContainer="tomcat8"
//servletContainer="tomcat9"
}
dependencies {
// https://mvnrepository.com/artifact/org.apache.myfaces.core/myfaces-impl
compile group: 'org.apache.myfaces.core', name: 'myfaces-impl', version: '2.3.1'
// https://mvnrepository.com/artifact/org.apache.myfaces.core/myfaces-api
compile group: 'org.apache.myfaces.core', name: 'myfaces-api', version: '2.3.1'
// https://mvnrepository.com/artifact/org.primefaces/primefaces
compile group: 'org.primefaces', name: 'primefaces', version: '6.2'
// https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api
compile group: 'javax.servlet.jsp', name: 'jsp-api', version: '2.2.1-b03'
// https://mvnrepository.com/artifact/javax.enterprise/cdi-api
compile group: 'javax.enterprise', name: 'cdi-api', version: '2.0.SP1'
// https://mvnrepository.com/artifact/javax.websocket/javax.websocket-api
compile group: 'javax.websocket', name: 'javax.websocket-api', version: '1.1'
// https://mvnrepository.com/artifact/javax.servlet/jstl
compile group: 'javax.servlet', name: 'jstl', version: '1.2'
// https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
// https://mvnrepository.com/artifact/javax.validation/validation-api
compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
</beans>
faces-config.xml:
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.3"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd">
</faces-config>
Thank your maress. Good adress! Solution:
I added the /META-INF/context.xml
<Context>
<Resource name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory" />
</Context>
I added weld-servlet shaded to my dependencies:
...
compile group: 'org.jboss.weld.servlet', name: 'weld-servlet-shaded', version: '3.0.5.Final'
...
Finally I used a local tomcat to run the artifact and not the gradle 'gretty' plugin.
It seems the plugin has problems with cdi.

Error Trying to migrate from icefaces to primefaces

I´m working on a migration of a project developed with Spring 3, JSF 1.2 and Icefaces 1.x to Spring 3, JSF 2-2 and PrimeFaces 6-2. (Yeah, it´s a huge change).
I've follow Balus guide in Migrating JSF1.x but didn't find any guide to migrate Ice to Prime.
I've delete every old file/folder/jar of Ice and replace everty tag in .xhtml's pages. But I guess I'm loosing some reference somewhere. Got this error now:
ADVERTENCIA: JSF 2.0 libraries detected. This version of ICEfaces is not supported on JSF 2.0. JSF 1.1 or 1.2 are required.
31-may-2018 11:20:47 com.sun.faces.config.ConfigureListener contextInitialized
GRAVE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Must have a Constructor that takes in a ComponentConfig
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:449)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:221)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1872)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: javax.faces.view.facelets.FaceletException: Must have a Constructor that takes in a ComponentConfig
at com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.<init>(AbstractTagLibrary.java:330)
at com.sun.faces.facelets.tag.AbstractTagLibrary.addComponent(AbstractTagLibrary.java:558)
at com.sun.faces.facelets.tag.TagLibraryImpl.putComponent(TagLibraryImpl.java:114)
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processComponent(FaceletTaglibConfigProcessor.java:588)
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:368)
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:321)
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:270)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:437)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:222)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1874)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:485)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:427)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:201)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:249)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:427)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:28)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:637)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:164)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:69)
... 3 more
Caused by: java.lang.NoSuchMethodException: com.icesoft.faces.component.facelets.IceComponentHandler.<init>(javax.faces.view.facelets.ComponentConfig)
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getConstructor(Class.java:1657)
at com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.<init>(AbstractTagLibrary.java:328)
at com.sun.faces.facelets.tag.AbstractTagLibrary.addComponent(AbstractTagLibrary.java:558)
at com.sun.faces.facelets.tag.TagLibraryImpl.putComponent(TagLibraryImpl.java:115)
... 43 more
31-may-2018 11:20:47 javax.faces.FactoryFinder$FactoryManager getFactory
GRAVE: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
31-may-2018 11:20:47 com.sun.faces.config.ConfigureListener contextDestroyed
GRAVE: Unexpected exception when attempting to tear down the Mojarra runtime
java.util.MissingResourceException: Can't find resource for bundle
java.util.PropertyResourceBundle, key severe.no_factory_backup_failed
at java.util.ResourceBundle.getObject(ResourceBundle.java:374)
at java.util.ResourceBundle.getString(ResourceBundle.java:334)
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1133)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:319)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:482)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.EventsManager.notifyContextDestroyedEvent(EventsManager.java:200)
at weblogic.servlet.internal.WebAppServletContext.destroy(WebAppServletContext.java:3228)
at weblogic.servlet.internal.ServletContextManager.destroyContext(ServletContextManager.java:248)
at weblogic.servlet.internal.HttpServer.unloadWebApp(HttpServer.java:461)
at weblogic.servlet.internal.WebAppModule.destroyContexts(WebAppModule.java:1536)
at weblogic.servlet.internal.WebAppModule.deactivate(WebAppModule.java:509)
at weblogic.application.internal.flow.ModuleStateDriver$2.previous(ModuleStateDriver.java:389)
at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:223)
at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:216)
at weblogic.application.internal.flow.ModuleStateDriver.deactivate(ModuleStateDriver.java:141)
at weblogic.application.internal.flow.ScopedModuleDriver.deactivate(ScopedModuleDriver.java:207)
at weblogic.application.internal.flow.ModuleListenerInvoker.deactivate(ModuleListenerInvoker.java:261)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.previous(DeploymentCallbackFlow.java:548)
at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:223)
at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:216)
at weblogic.application.internal.flow.DeploymentCallbackFlow.deactivate(DeploymentCallbackFlow.java:192)
at weblogic.application.internal.flow.DeploymentCallbackFlow.deactivate(DeploymentCallbackFlow.java:185)
at weblogic.application.internal.BaseDeployment$2.previous(BaseDeployment.java:643)
at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:223)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:63)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:164)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:69)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
31-may-2018 11:20:47 com.icesoft.faces.util.event.servlet.ContextEventRepeater contextDestroyed
This is web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
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_2_5.xsd">
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jExposeWebAppRoot</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Dispatcher Servlet -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<!-- Comentar el de arriba y descomentar este para jdeveloper>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>public_html/*.xhtml</url-pattern>
</servlet-mapping-->
<session-config>
<session-timeout>
60
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<!-- Servlets de ICEFaces -->
<!--<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet
</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.BlockingServlet
</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>-->
<!-- Mapeo de servlets -->
<!--<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>-->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<!--<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>-->
<!-- Facelets -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!--<listener>
<listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
</listener>-->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- PARA SUBIR ARCHIVO-->
<!--<context-param>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.uploadDirectory</param-name>
<param-value>upload</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.uploadMaxFileSize</param-name>
<param-value>15728640</param-value>-->
<!-- MAX FILE SIZE -->
<!--</context-param>
<servlet>
<servlet-name>uploadServlet</servlet-name>
<servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>
<load-on-startup> 3 </load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>uploadServlet</servlet-name>
<url-pattern>/uploadHtml</url-pattern>
</servlet-mapping>-->
This is my faces-config
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<message-bundle>cr.ac.ucr.framework.vista.util.ErroresBundle</message-bundle>
<locale-config>
<default-locale>es</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
<!--<view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler> -->
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>principal</from-outcome>
<to-view-id>/presentacion/principal.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/paginas/principal.xhtml</from-view-id>
<navigation-case>
<from-outcome>index</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<navigation-case>
<from-outcome>welcome</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
Any ideas of what am I missing?

jsf2-javax.el.PropertyNotFoundException: /index.xhtml except

I am new to JSF.
I have done everything right as far as I know but still getting this exception
javax.el.PropertyNotFoundException: /index.xhtml #22,55 value="#{navigator.pages}": Property 'pages' not found on type Navigator
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:174)
at javax.faces.component.UIInput.getValue(UIInput.java:291)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.el.PropertyNotFoundException: Property 'pages' not found on type Navigator
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:266)
at javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:243)
at javax.el.BeanELResolver.property(BeanELResolver.java:353)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:97)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
... 40 more
I have gone through lots of post regarding this exception and they all have mentioned about bean properties and their getters/setters which I have done correctly .
Here is my code:
1) Index.html
<!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://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<!-- When you make your own projects, copy and rename sample-file-with-form.xhtml
or sample-file-no-form.xhtml. Don't copy and rename THIS file, because
this file has too many extraneous things in it. -->
<h:head>
<title>JSF 2.2: Initial Learning Project</title>
<link href="./css/styles.css" rel="stylesheet" type="text/css"/>
</h:head>
<h:body>
<h1 class="title">JSF 2.2: Initial Learning Project</h1>
<div align="center">
<fieldset>
<legend>Selected Results Page</legend>
<h:form>
Please enter the page you want to see.
<br/>
<h:inputText id="pages" value="#{navigator.pages}" /><br />
<h:commandButton value="Go to Selected Page"
action="#{navigator.choosePage}"/>
</h:form>
</fieldset>
</div>
</h:body></html>
2) My bean class - Navigator.java
import javax.faces.bean.*;
#ManagedBean
public class Navigator {
private String pages;
public String getPages() {
return pages;
}
public void setPages(String pages) {
this.pages = pages;
}
public String choosePage() {
if(pages == "page1"){
return "page1";
} else if(pages == "page2"){
return "page2";
} else {
return "page3";
}
}
3) 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"
version="3.0">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (default). See JSF Specification section 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<!-- If you go to http://host/project/ (with no file name), it will
try index.jsf first, welcome.jsf next, and so forth.
-->
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
<welcome-file>welcome.jsf</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
4)faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<!-- Empty for now. There are many uses for faces-config.xml, but
the most common are navigation rules (instead of having
the return value of the "action" method be the base filename),
bean declarations (instead of using #ManagedBean), and
properties files (aka resource bundles).
If you are not using faces-config.xml, it is perfectly legal
to omit the file entirely. But, most people prefer to have
a blank one already in their project for later use.
From JSF 2 and PrimeFaces tutorial
at http://www.coreservlets.com/JSF-Tutorial/jsf2/ -->
</faces-config>
Please help me out on this.
try equals for String
public String choosePage()
{
if(pages.equals("page1")){
return "page1";
} else if(pages.equals("page2")){
return "page2";
} else {
return "page3";
}
}
Try with the below changes.
Change filename from index.html to index.xhtml and update the same file name as mentioned below.
<welcome-file>index.html</welcome-file>
Happy coding!

<rich:tree> Example reRender not working Richfaces 3.3.4 final

i'm using Richfaces 3.3.4 final with JSF 1.2 on a SAP NetWeaver AS 7.31.
Now im facing some Issues with dynamically showing selected Nodes from a rich:tree in a h:outputText. The selectedNodeListener is invoked correctly and the Name of the Node is saved in a String, but my h:outputText only refreshes on Page Refresh and not on Selection like in the Example from the Showcases(http://showcase-rf3.richfaces.org/richfaces/tree.jsf?tab=model&cid=26981).
Does anyone know if this is a common Issue with the above Setup or am I just missing something? As far as I know SAP NetWeaver isnt in the List of supported Servers but its JEE5 compliant. Could this be the Reason?
I simplified the Example from the Richfaces Showcases to reproduce the Problem in a small Environment. Here is some Code:
SimpleTreeBean.java
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.richfaces.component.html.HtmlTree;
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
import org.richfaces.model.TreeNodeImpl;
public class SimpleTreeBean {
private TreeNode rootNode = null;
private List<String> selectedNodeChildren = new ArrayList<String>();
private String nodeTitle;
private void loadTree() {
rootNode = new TreeNodeImpl();
TreeNodeImpl rt = new TreeNodeImpl();
rt.setData("Root");
rootNode.addChild(1, rt);
for(int i = 1; i <= 5; i++){
TreeNodeImpl child = new TreeNodeImpl();
child.setData("Child "+i);
rt.addChild(i, child);
}
}
public void processSelection(NodeSelectedEvent event) {
HtmlTree tree = (HtmlTree) event.getComponent();
nodeTitle = (String) tree.getRowData();
selectedNodeChildren.clear();
TreeNode currentNode = tree.getModelTreeNode(tree.getRowKey());
if (currentNode.isLeaf()) {
selectedNodeChildren.add((String) currentNode.getData());
} else {
Iterator<Map.Entry<Object, TreeNode>> it = currentNode
.getChildren();
while (it != null && it.hasNext()) {
Map.Entry<Object, TreeNode> entry = it.next();
selectedNodeChildren.add(entry.getValue().getData().toString());
}
}
}
public TreeNode getTreeNode() {
if (rootNode == null) {
loadTree();
}
return rootNode;
}
public String getNodeTitle() {
return nodeTitle;
}
public void setNodeTitle(String nodeTitle) {
this.nodeTitle = nodeTitle;
}
}
test.jsp:
<%#taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%#taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%#taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%#taglib uri="http://richfaces.org/rich" prefix="rich"%>
<html>
<head>
<title>TestTree</title>
</head>
<body>
<f:view>
<h:form>
<h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
<rich:tree style="width:300px" nodeSelectListener="#{simpleTreeBean.processSelection}"
reRender="selectedNode" ajaxSubmitSelection="true" switchType="client"
value="#{simpleTreeBean.treeNode}" var="item" ajaxKeys="#{null}">
</rich:tree>
<h:outputText escape="false" value="Selected Node: #{simpleTreeBean.nodeTitle}" id="selectedNode" />
</h:panelGrid>
</h:form>
</f:view>
</body>
</html>
Important Part of faces-config.xml:
<?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_1_2.xsd"
version="1.2">
<managed-bean>
<managed-bean-name>simpleTreeBean</managed-bean-name>
<managed-bean-class>
com.realcore.web.beans.SimpleTreeBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
<</faces-config>/faces-config>
Additionally there are some Validators and Converters in my faces-config too. But I think this isnt important for this Problem.
And here is the 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_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>SstSapWEB</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>login.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- Making the RichFaces skin spread to standard HTML controls -->
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<!-- Defining and mapping the RichFaces filter -->
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<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>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
This simple Example isnt working too.
I don't know how to fix or workaround this Issue. Any help is greatly appreciated.
Regards,
Daniel
just in fact somebody else has similar Problems: After working on other things in the mean time I now figured out how to solve this Issue.
It was rather easy and all work is done in the JSP:
Use Rich Tree Node inside the Rich Tree Tag
Use the ajaxSubmitSelection and reRender Attributes of the TreeNode
Wrap the Part of the Page, which should be rerendered in a <a4j:outputPanel/> and set its Attribute ajaxRendered to "true"
Ensure that the values of the id-Attribute of the <a4j:outputPanel/> and the reRender-attribute of the TreeNode are the same.
Hope this helps others with similar Problems,
Daniel

Don't upload more than 10mb primefaces

I'm having problem and it look's simple, but I don't find a answer...Maybe someone could help me?
I'm using fileUpload from primefaces 5.0 and I can't do uploads of files that have more than 10mb... One file with 9.9mb works fine! =o
What I need to change to increase this limit?
Codes:
<p:fileUpload multiple="false" cancelLabel="Cancelar" label="Selecionar Brasão..." fileUploadListener="#{back.uploadArquivo}" mode="advanced" dragDropSupport="true" auto="false"
fileLimit="1" sizeLimit="51380224" update="panel_grid_upload_arquivo, :growl" />
backBean:
public void uploadArquivo(FileUploadEvent event) {
DocumentoEntity arquivo = new DocumentoEntity();
try {
arquivo.setArquivo(IOUtils.toByteArray(event.getFile().getInputstream()));
arquivo.setNomeArquivo(event.getFile().getFileName());
arquivo.setNome(event.getFile().getFileName());
this.arquivo = arquivo;
exibirMensagemSucesso("Upload feito com sucesso", "O arquivo agora está associado ao documento");
} catch (IOException e) {
exibirMensagemErro("Ocorreu algum erro", "Ocorreu algum erro e o upload não pôde ser feito");
LOGGER.error("Não realizou o upload do arquivo");
e.printStackTrace();
}
}
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>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
A file with more than 10mb don't reach the BackBean...
Thanks in advance!
I discover the problem after some hours... and was really so simple. This happened because Wildfly 8! I need to put max-post-size="50485760" in the standalone.xml and now works fine.
<server name="default-server">
<http-listener name="default" socket-binding="http" max-post-size="50485760"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>

Resources