提问人:Joe 提问时间:4/8/2021 最后编辑:Joe 更新时间:4/16/2021 访问量:691
Primefaces 10 dataTable p:dataExporter 在迁移后在渲染时生成 ArrayIndexOutOfBoundsException
Primefaces 10 dataTable p:dataExporter generate ArrayIndexOutOfBoundsException on render after migration
问:
环境:
- Jboss 7.2 版本
- 素脸 10
- 爪哇 11
我已经从素面 8 迁移到素面 10 dataTable p:dataExporter 在渲染 xhtml 时生成 ArrayIndexOutOfBoundsException。 当我注释掉 dataexporter 时,xhtml 渲染得很好。
按照迁移指南,唯一重要的变化似乎是 PDF 库已从 iText 切换到 Libre OpenPDF。
我尝试了两种不同的上下文,一种有效,一种无效,差异:
- 它工作的上下文没有身份验证
- 它不起作用的上下文具有 keycloack 身份验证和两个主题依赖项。
我不认为与素数主题有关,但可能是因为 keycloak,因为它在日志错误中显示处理请求。
为什么给出这个错误?
服务器错误
[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 [email protected]//javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1439)
at [email protected]//javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1460)
at [email protected]//javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:955)
at [email protected]//com.sun.faces.application.view.JspStateManagementStrategy.restoreView(JspStateManagementStrategy.java:273)
at [email protected]//com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:139)
at [email protected]//com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
at [email protected]//com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:295)
at [email protected]//com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:157)
at [email protected]//javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:125)
at [email protected]//javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:125)
at [email protected]//com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:204)
at [email protected]//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at [email protected]//com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:133)
at [email protected]//com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
at [email protected]//javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
at [email protected]//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at [email protected]//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 [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at [email protected]//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 [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at [email protected]//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 [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at [email protected]//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 [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at [email protected]//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at [email protected]//io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:55)
at [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at [email protected]//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at [email protected]//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at [email protected]//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at [email protected]//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at [email protected]//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at [email protected]//org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//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 [email protected]//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at [email protected]//io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
at [email protected]//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at [email protected]//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at [email protected]//io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
at [email protected]//io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at [email protected]//io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at [email protected]//io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at [email protected]//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at [email protected]//org.keycloak.adapters.undertow.ServletPreAuthActionsHandler.handleRequest(ServletPreAuthActionsHandler.java:69)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at [email protected]//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at [email protected]//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at [email protected]//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extensio[email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at [email protected]//io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
at [email protected]//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at [email protected]//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>
答:
0赞
Joe
4/16/2021
#1
我终于找到了为什么我无法使用 p:dataExporter 导出文件的问题。
web.xml文件包含javax.faces.PARTIAL_STATE_SAVING定义为 false 的上下文参数,所以我注释掉了,我工作得很好!
web.xml的问题
...
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
...
评论