Tomcat 8升级EL

时间:2017-03-02 08:12:58

标签: jsf tomcat7 java-7 el tomcat8

我从Tomcat 6升级到Tomcat 8后出现以下异常。在Tomcat 6中,项目正常运行。该项目包含Hibernate 3.3.1和Spring 2.5.5。 JSF版本是2.1.3。目前使用Java 6。由于Tomcat 8需要Java 7,因此也会进行升级。 我已经使用选项org.apache.el.parser.COERCE_TO_ZERO尝试了它,但它没有帮助。也许有人在那里可以帮助我解决我的问题?预期的行为应该是在jsf页面中使用DEFAULT_GREY。

作为暗示可能有帮助。我在Tomcat 7中尝试过与Tomcat 8相同的结果。通过tomcat 7测试,我使用了相同的Java版本,现在在Tomcat 6下工作。在这个测试中唯一改变的是Tomcat版本从6到7。

jsf页面的代码片段:

.tableRow2 {
            background-color: #{bean.greyRowColorValue};
        }

相应java bean的代码:

private String DEFAULT_GREY = "#F6F6F6";

public String getGreyRowColorValue() {

         if(greyRowColorValue == null) {
            RequestContextData requestContext = ContextUtil.getRequestContextData();
            if (SystemEnum.XY.getId().equals(requestContext.getSystem()) ||
                    SystemEnum.ZY.getId().equals(requestContext.getSystem())) {
                // get from DB
                UserSettingsFacade facade = (UserSettingsFacade) ObjectFactory.getInstance().getObject("userSettingsFacade");
                    Result<UserSettingsModel> result =  facade.getUserSettings(requestContext);
                if(!result.isSuccess()) {
                    return DEFAULT_GREY;
                }
                UserSettingsModel userSettingsModel = result.getResult();
                if(userSettingsModel == null) {
                    return DEFAULT_GREY;
                }
                // if DB delivers null
                UserSettings userSetting = userSettingsModel.getUssColumn(UserSettingsModel.GREY_SCALE_FOR_XY);
                if(userSetting == null){
                    greyRowColorValue = DEFAULT_GREY;
                    return DEFAULT_GREY;
                }
                greyRowColorValue = userSettingsModel.getUssColumn(UserSettingsModel.GREY_SCALE_FOR_XY).getUssColFilter();
                if(greyRowColorValue == null) {
                    greyRowColorValue = DEFAULT_GREY;
                    return DEFAULT_GREY;
                }
            } else {
                return DEFAULT_GREY;
            }
        }
        return greyRowColorValue;

}

例外:

SEVERE: Error Rendering View[/user/homeCalypso.xhtml]
javax.el.ELException: /xhtmlTemplates/mainTemplate.xhtml: ELResolver did not handle type: null with property of 'greyRowColorValue'
    at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:88)
    at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
    at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:286)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.hvbsystems.c4.cms.cmsclient.presentation.user.LoginFilter.doFilter(LoginFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

编辑13.06.2017: 我已经调试到了深度。我现在用于tomcat的确切版本是8.5.4和java 1.8.0_77。 我看到BeanELResolver能够解析我的属性。在作为方法参数的ELContext中,已解析的属性设置为true。在以下代码(javax.el.BeanELResolver第94行)之后,在ELContext中解析的属性切换回false:

    try {
        return m.invoke(base, (Object[]) null);
    } catch (InvocationTargetException e) {

任何人都可以帮助我为什么会这样吗?

0 个答案:

没有答案