<a4j:mediaoutput>在Tomcat 7中无法进行图像渲染</a4j:mediaoutput>

时间:2015-04-06 10:57:34

标签: java spring tomcat richfaces ajax4jsf

我正在尝试使用上传图像。一旦用户上传图像,我试图使用以下代码显示图像 <a4j:mediaOutput element="img" createContent="#{bean.paint}" value="1" style="width:275px; height:75px;" mimeType="image/jpg" id="media" cacheable="false"> <f:param value="#{bean.timeStamp}" name="time" /> </a4j:mediaOutput>
我的Java代码是
     public Part part; //getters & Setters public void paint(OutputStream stream, Object data) throws IOException{ InputStream inputStream = null; try { inputStream = part.getInputStream(); stream.write(IOUtils.toByteArray(inputStream)); stream.close(); } catch (Exception e){
} }


我的部分包含文件。但我得到了以下的例外情况。

严重:反序列化数据的输入错误 java.io.InvalidClassException:未经授权的反序列化尝试; org.apache.el.lang.VariableMapperImpl     at org.richfaces.util.LookAheadObjectInputStream.resolveClass(LookAheadObjectInputStream.java:97)     at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)     at java.io.ObjectInputStream.readClassDesc(Unknown Source)     at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)     at java.io.ObjectInputStream.readObject0(Unknown Source)     at java.io.ObjectInputStream.readObject(Unknown Source)     at org.apache.el.MethodExpressionImpl.readExternal(MethodExpressionImpl.java:297)     at java.io.ObjectInputStream.readExternalData(Unknown Source)     at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)     at java.io.ObjectInputStream.readObject0(Unknown Source)     at java.io.ObjectInputStream.defaultReadFields(Unknown Source)     at java.io.ObjectInputStream.readSerialData(Unknown Source)     at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)     at java.io.ObjectInputStream.readObject0(Unknown Source)     at java.io.ObjectInputStream.readObject(Unknown Source)     at com.sun.faces.facelets.el.TagMethodExpression.readExternal(TagMethodExpression.java:158)     at java.io.ObjectInputStream.readExternalData(Unknown Source)     at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)     at java.io.ObjectInputStream.readObject0(Unknown Source)     at java.io.ObjectInputStream.defaultReadFields(Unknown Source)     at java.io.ObjectInputStream.readSerialData(Unknown Source)     at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)     at java.io.ObjectInputStream.readObject0(Unknown Source)     at java.io.ObjectInputStream.readArray(Unknown Source)     at java.io.ObjectInputStream.readObject0(Unknown Source)     at java.io.ObjectInputStream.readObject(Unknown Source)     在org.richfaces.util.Util.decodeObjectData(Util.java:237)     at org.richfaces.resource.DefaultCodecResourceRequestData.getData(DefaultCodecResourceRequestData.java:97)     在org.richfaces.resource.ResourceFactoryImpl.createResource(ResourceFactoryImpl.java:337)     在org.richfaces.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:156)     在javax.faces.webapp.FacesServlet.service(FacesServlet.java:643)     在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)     在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)     at com.wellsfargo.ecar.common.util.ServerFilter.doFilter(ServerFilter.java:46)     在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)     在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)     在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)     在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)     在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)     在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)     在org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)     在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)     在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)     在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)     at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:515)     at org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:304)     at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(Unknown Source)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)     在java.lang.Thread.run(未知来源) 2015年4月6日下午4:06:13 org.apache.catalina.core.StandardWrapperValve调用 SEVERE:servlet [Faces Servlet]的Servlet.service()与路径
的上下文
有什么我想念的吗?请帮帮我。

1 个答案:

答案 0 :(得分:0)

您可以升级到修复此问题的最新版本。或者打开你的RichFaces jar / zip并找到resource-serialization.properties,然后添加&#34; org.apache.el.lang.VariableMapperImpl&#34;白名单。