1

我有一个在 Firefox、Chrome 中运行良好的 JSF 应用程序(Majorra 2.1.20、PrimeFaces 4.0-SNAPSHOT、OmniFaces 1.4.1,在 Glassfish 3.1.2 上运行)。只有在 Internet Explorer 中运行时,我才会收到此错误:

java.lang.NullPointerException: in is null
at java.util.zip.ZipInputStream.<init>(ZipInputStream.java:100)
at java.util.zip.ZipInputStream.<init>(ZipInputStream.java:79)
at com.sun.faces.application.resource.ZipDirectoryEntryScanner.<init>(ZipDirectoryEntryScanner.java:76)
at com.sun.faces.application.resource.ClasspathResourceHelper.findLibraryWithZipDirectoryEntryScan(ClasspathResourceHelper.java:204)
at com.sun.faces.application.resource.ResourceManager.findLibraryOnClasspathWithZipDirectoryEntryScan(ResourceManager.java:409)
at com.sun.faces.application.resource.ResourceManager.doLookup(ResourceManager.java:247)
at com.sun.faces.application.resource.ResourceManager.findResource(ResourceManager.java:197)
at com.sun.faces.application.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:143)
at com.sun.faces.application.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:123)
at javax.faces.application.ResourceHandlerWrapper.createResource(ResourceHandlerWrapper.java:96)
at javax.faces.application.ResourceHandlerWrapper.createResource(ResourceHandlerWrapper.java:96)
at org.omnifaces.resourcehandler.UnmappedResourceHandler.createResource(UnmappedResourceHandler.java:118)
at com.sun.faces.el.ResourceELResolver.getValue(ResourceELResolver.java:136)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
at com.sun.faces.application.resource.ResourceHelper$ELEvaluatingInputStream.evaluateExpressionIntoBuffer(ResourceHelper.java:791)
at com.sun.faces.application.resource.ResourceHelper$ELEvaluatingInputStream.readExpressionIntoBufferAndEvaluateIntoBuffer(ResourceHelper.java:722)
at com.sun.faces.application.resource.ResourceHelper$ELEvaluatingInputStream.read(ResourceHelper.java:690)
at java.io.InputStream.read(InputStream.java:179)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:385)
at org.omnifaces.util.Utils.stream(Utils.java:215)
at org.omnifaces.resourcehandler.UnmappedResourceHandler.handleResourceRequest(UnmappedResourceHandler.java:196)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:591)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:131)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:328)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)

我迷路了。我似乎无法理解为什么这只会发生在 IE 而不会发生在其他浏览器中。

任何解决此问题的帮助将不胜感激。帮助理解这一点的解释也非常受欢迎(你知道的越多!)

更新 :

我现在在 Chrome 中也遇到了这个错误。还在研究这个。

更新 2:

我找到了这个问题的根源(不是原因,而是错误的代码)。这在我的 css 表中:

a.map_sms:hover {
background: #3E9945 url("#{resource['templateImages/map:map_sms.png']}")
    no-repeat;
}

导致错误。删除它可以解决它。此错误在升级到 PrimeFaces 4.0 时开始出现,以前从未出现过。幸运的是,这是我刚刚删除的遗留代码,错误不再出现。

更新 3

我认为解决此错误的解决方案绝对不是。仍然得到它,回到绘图板。

更新 4

似乎更新 2 是正确的。在喜欢中发现了另一个错误的 css。花了很多时间在这里找到这个。仍然不确定错误的原因 - 在升级到 PrimeFaces 4 之前不存在。

更新 5

在认为我已经修复了这个问题之后,当我在 Eclipse 中我喜欢 2 个项目时,它又回来了(在构建路径上添加了第二个项目)。不确定这是否指向任何潜在客户。

4

3 回答 3

1

WEB-INF/lib当您的容器扫描文件夹中的 jar 文件时,您似乎遇到了这个问题。

ZipDirectoryEntryScanner是 mojarra 类。我建议您获取源代码并在该类中添加一条日志语句,以查看哪个文件有问题。

我遇到了类似的问题,就我而言,该WEB-INF/lib文件夹包含另一个logs导致异常的文件夹。

于 2015-04-02T19:22:24.387 回答
0

我用过 Customer.class.getResourceAsStream("fi.png"); 而不是 Customer.class.getClassLoader().getResourceAsStream("fi.png") 所以得到这个异常

于 2015-06-10T15:26:50.147 回答
0

我遇到过同样的问题。问题出在文件名路径中 - 它包含“ ”符号。我改变了路径,问题就解决了。

于 2015-12-03T16:01:49.163 回答