gpt4 book ai didi

jsf - java.util.zip.DataFormatException : incorrect data check

转载 作者:行者123 更新时间:2023-12-05 07:55:41 25 4
gpt4 key购买 nike

我在加载 JSF 页面时遇到下面提到的错误。页面加载成功,页面上的所需操作也已完成,但出现此错误。

JSF 页面包含选项卡面板,如果我尝试将可用项目中的某些项目包含到已包含项目中,则会出现错误。以下是列表的 XHTML。

<a4j:outputPanel id="selectItems">
<div id="div_selectItems" class="scroll_container">
<s:div styleClass="dialogueAttribute">
<rich:listShuttle sourceValue="#{itemReportEditor.itemsList}"
targetValue="#{itemReportEntry.itemReportData}"
var="items"
listsHeight="28em"
sourceListWidth="45em"
targetListWidth="45em"
sourceCaptionLabel="Available Items"
targetCaptionLabel="Included Items"
removeAllControlLabel="Remove all"
removeControlLabel="Remove"
copyControlLabel="Add"
copyAllControlLabel="Add all"
fastOrderControlsVisible="true"
orderControlsVisible="true"
converter="#{itemReportEditor.itemReportDataModelConverter}">
<rich:column>
<f:facet name="header">
<h:outputText title="Performance item name"
value="Name"/>
</f:facet>
<h:outputText value="#{items['itemName']}"></h:outputText>
</rich:column>

<rich:column>
<f:facet name="header">
<h:outputText title="Performance Item Protocol"
value="Protocol"/>
</f:facet>
<h:outputText value="#{items['protocol']}"></h:outputText>
</rich:column>

<a4j:support event="onlistchanged"
action="#{itemReportEntry.updateItemsList()}"
reRender="la"
oncomplete="resizeScrollBox2();"
status="workingStatus"
eventsQueue="ajaxQueue"/>
</rich:listShuttle>
</s:div>
</div>
</a4j:outputPanel>

我正在尝试使用从左手边到右手边的列表穿梭添加一些项目,但我在日志(能够应用所有正确更改,只是得到以下异常)。我的 FireFox 版本是 35.0.1

2015-04-06 15:42:34,272 ERROR [http-0.0.0.0-8080-8] org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/client].[Faces Servlet]
Servlet.service() for servlet Faces Servlet threw exception

javax.faces.FacesException: Error decode resource data
at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:627)
at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceDataForKey(ResourceBuilderImpl.java:369)
at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:156)
at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.zip.DataFormatException: incorrect data check
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:238)
at java.util.zip.Inflater.inflate(Inflater.java:256)
at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:621)
... 30 more

谷歌搜索我发现“问题似乎是像'!'这样的字符被 FireFox 转换为“%21”。以下过滤器会将 %21 转换回“!”所以可以在服务器中找到资源”

就我而言,我只是在日志中收到异常,但所有源均已成功加载

为了排除异常,我加了过滤器

package juno.sa.server;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

public class RichFacesFirefox11Filter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(new HttpServletRequestWrapper((HttpServletRequest) request) {
@Override
public String getRequestURI() {
try {
return URLDecoder.decode(super.getRequestURI(), "UTF-8");
} catch (UnsupportedEncodingException e) {

throw new IllegalStateException("Cannot decode request URI.", e);
}
}
}, response);
}

@Override
public void init(FilterConfig filterConfig) throws ServletException {
// do nothing
}

@Override
public void destroy() {
// do nothing
}
}
<filter>
<filter-name>RichFacesFirefox11Filter</filter-name>
<filter-class>juno.sa.server.RichFacesFirefox11Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>RichFacesFirefox11Filter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>

最佳答案

即使我收到这样的异常。Caused by: java.util.zip.ZipException: 不正确的数据检查 在 java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)

但在我的例子中,根本原因是我尝试读取的流是使用平面编码器压缩的,因此尝试解压缩的流是 InflaterInputStream。

在我的例子中,最后一个字节中出现的数据不是 eof 参数,而是实际数据,eof 参数出现在流中最后一个字节之前的某个位置。因此,当流读取 block 数据的最后一个字节时,它无法找到 eof,因此会抛出不正确的数据检查。

也许在你这边验证一下......你这边也可能是同样的问题。

关于jsf - java.util.zip.DataFormatException : incorrect data check,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29469566/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com