我正在使用 Primefaces 5.0, JSF 2.0, Weblogic 10.3(11g), J2ee 5。
当我使用p:graphicImage从我的bean渲染流内容时,我注意到日志中的ajaxresponse异常,最后是el异常,如下所示。添加el2.0是一个解决这个问题的选项,如果是,那么我不确定我是否只能将el2.0添加到我的项目中,因为我不想将它添加到Weblogic的域文件中。请帮忙。
java.lang.NoClassDefFoundError: javax/el/ValueReference
at org.primefaces.el.InterceptingResolver.setValue(InterceptingResolver.java:28)
at com.sun.el.parser.AstValue.setValue(Unknown Source)
at com.sun.el.ValueExpressionImpl.setValue(Unknown Source)
at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:131)
at org.primefaces.el.ValueExpressionAnalyzer.getExpression(ValueExpressionAnalyzer.java:49)
at org.primefaces.util.DynamicResourceBuilder.build(DynamicResourceBuilder.java:49)
at org.primefaces.component.graphicimage.GraphicImageRenderer.getImageSrc(GraphicImageRenderer.java:74)
at org.primefaces.component.graphicimage.GraphicImageRenderer.encodeEnd(GraphicImageRenderer.java:40)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:884)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:68)
at org.primefaces.component.overlaypanel.OverlayPanelRenderer.encodeMarkup(OverlayPanelRenderer.java:59)
at org.primefaces.component.overlaypanel.OverlayPanelRenderer.encodeEnd(OverlayPanelRenderer.java:37)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:884)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:68)
以下是我的代码
<p:graphicImage value="#{lev.viewFile}" width="300" cache="false">
<f:param name="id" value="#{lev.levId}" />
</p:graphicImage>
下面是我的bean代码,它是viewscoped ......
public StreamedContent getViewFile() {
try{
File viewfileobj = new File("C:/LEAVEMODULEFOLDER/p1.jpeg");
log.debug("viewfileobj.length() = "+viewfileobj.length());
InputStream stream = new FileInputStream(viewfileobj);
log.debug("stream = "+stream);
this.viewFile = new DefaultStreamedContent(stream,"image/jpeg",Utility.getRandomString());
}catch(Exception e){
log.error("Error in Leave.toString() ::"+e);
log.error(Utility.getStackTrace(e));
}
return viewFile;
}
答案 0 :(得分:0)
将视图范围更改为会话范围应该有效。