0

I'm getting the following exception since the upgrade to Tomcat 8 from Tomcat 6. In Tomcat 6 the project works correctly. The project contains Hibernate 3.3.1 and Spring 2.5.5. JSF version is 2.1.3. Currently Java 6 is used. As Tomcat 8 requires Java 7 an upgrade would be done as well. I already tried it with the option org.apache.el.parser.COERCE_TO_ZERO but it doesn't helped. Maybe someone of you out there could help me with my problem? The expected behaviour should be that the DEFAULT_GREY is used in the jsf page.

As a hint maybe it helps. I've tried it in Tomcat 7 with the same result as in Tomcat 8. With the tomcat 7 test I've used the same Java version with it is now working under Tomcat 6. The only thing changed in this test was the Tomcat version from 6 to 7.

Codesnippet of jsf page:

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

Code of corresponding 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;

}

Exception:

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)

EDIT 13.06.2017: I've debuggeed right into the el depths. The exact versions what I use right now for tomcat are 8.5.4 and java 1.8.0_77. I saw that the BeanELResolver is able to resolve my property. In the ELContext which was a method param the resolved property was set to true. After the following Code (javax.el.BeanELResolver line 94) the property resolved in ELContext switches back to false:

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

Can anyone help me why this happens?

Buddy145
  • 1
  • 2
  • Please create a [mcve] like stated in [ask] – Kukeltje Mar 02 '17 at 08:26
  • I think I found the root cause. The problem is that we used inside the method which was called by the EL, another instance of the ELContext. That leads towards that the origin ELContext (session scoped) was modified and therefore not able to resolve the other one. See my other question for an other way to solve it: https://stackoverflow.com/questions/44539370/expression-language-other-way-to-invoke-method – Buddy145 Jun 16 '17 at 11:56

0 Answers0