ClassCastException opening screens with a SideMenu

I recently setup a new Mac with my App. I setup my project and everything compiles and run. However, I am experiencing the strangest error.

I can login and open the Administration Menu in my SideMenu and select Users, the users browse screen shows. If I then attempt to open the Settings screen I see this error.

ClassCastException: com.haulmont.cuba.web.app.ui.core.settings.SettingsWindow incompatible with com.haulmont.cuba.gui.app.security.user.browse.UserBrowser

If I start a fresh debug session and open Users and and try Roles, I generate the error:

ClassCastException: com.haulmont.cuba.gui.app.security.role.browse.RoleBrowser incompatible with com.haulmont.cuba.gui.app.security.user.browse.UserBrowser

Anytime I attempt to open a second screen whether it’s a CUBA screen or one if my screens the ClassCastException is generated with the format <new screen to open> incompatible with <current screen>

For example: ‘ClassCastException: gov.azgfd.fins.web.stdmasterwaterbody.StdMasterWaterbodyBrowse incompatible with com.haulmont.cuba.gui.app.security.user.browse.UserBrowser’

The only difference I know of is that my new Mac has Java 11.0.6, my other Mac is 11.0.3. The screens work fine on my other Mac. I am going to install Java 11.0.3 on my new Mac to see if there is a compatibility issue.

I tried the steps here that @tsarev gave me before to refresh dependencies without success.


  1. remove tomcat
  2. clean the project ( ./gradlew clean )
  3. build the project and refresh dependencies ( ./gradlew assemble --refresh-dependencies )
  4. deploy and run the project again ( ./gradlew setupTomcat deploy start )

Please also check that local maven ( ~/.m2/repository/ ) doesn’t contain anything, if the project is using .m2 .

I have tried generating a new SideMenu and updated my cuba.web.mainScreenId value to use the new SideMenu screen. I can login, but receive the same ClassCastException opening a second screen.

I created a test app with a SideMenu and switching from screen to screen causes works perfectly.

Here’s an example an error in catalina.out after the ClassCastException is thrown.

13:11:22.021 ERROR com.haulmont.cuba.web.log.AppLog - Exception in com.haulmont.cuba.web.widgets.CubaSideMenu: com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method menuItemTriggered in com.haulmont.cuba.web.widgets.client.verticalmenu.CubaSideMenuServerRpc at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:157) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:115) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:431) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:396) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:260) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:82) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1577) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:425) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:329) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:215) ~[cuba-web-7.1.5.jar:7.1.5] at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.19] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.19] at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:108) ~[spring-web-5.1.13.RELEASE.jar:5.1.13.RELEASE] at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:74) ~[spring-web-5.1.13.RELEASE.jar:5.1.13.RELEASE] at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:93) ~[cuba-web-7.1.5.jar:7.1.5] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[catalina.jar:9.0.19] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[catalina.jar:9.0.19] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[catalina.jar:9.0.19] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[catalina.jar:9.0.19] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[catalina.jar:9.0.19] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-coyote.jar:9.0.19] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-coyote.jar:9.0.19] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836) ~[tomcat-coyote.jar:9.0.19] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747) ~[tomcat-coyote.jar:9.0.19] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:9.0.19] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:9.0.19] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na] Caused by: java.lang.reflect.InvocationTargetException: null at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:153) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] ... 38 common frames omitted Caused by: java.lang.RuntimeException: Unable to bind consumer handler at com.haulmont.cuba.gui.sys.UiControllerDependencyInjector.initSubscribeListeners(UiControllerDependencyInjector.java:369) ~[cuba-gui-7.1.5.jar:7.1.5] at com.haulmont.cuba.gui.sys.UiControllerDependencyInjector.inject(UiControllerDependencyInjector.java:114) ~[cuba-gui-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.WebScreens.createScreen(WebScreens.java:242) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.WebScreens.create(WebScreens.java:175) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.gui.config.MenuItemCommands$ScreenCommand.run(MenuItemCommands.java:313) ~[cuba-gui-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.SideMenuBuilder$MenuCommandExecutor.accept(SideMenuBuilder.java:264) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.SideMenuBuilder$MenuCommandExecutor.accept(SideMenuBuilder.java:249) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.gui.components.mainwindow.WebSideMenu$MenuItemImpl.menuSelected(WebSideMenu.java:573) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.gui.components.mainwindow.WebSideMenu$MenuItemImpl$$Lambda$1082/0000000000000000.accept(Unknown Source) ~[na:na] at com.haulmont.cuba.web.widgets.CubaSideMenu$1.menuItemTriggered(CubaSideMenu.java:90) ~[cuba-web-widgets-7.1.5.jar:na] ... 43 common frames omitted Caused by: java.lang.ClassCastException: gov.azgfd.fins.web.stdmasterwaterbody.StdMasterWaterbodyBrowse incompatible with com.haulmont.cuba.gui.app.security.user.browse.UserBrowser at com.haulmont.cuba.gui.sys.UiControllerDependencyInjector.initSubscribeListeners(UiControllerDependencyInjector.java:365) ~[cuba-gui-7.1.5.jar:7.1.5] ... 52 common frames omitted 13:21:43.362 ERROR com.haulmont.cuba.web.log.AppLog - Exception in com.haulmont.cuba.web.widgets.CubaSideMenu: com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method menuItemTriggered in com.haulmont.cuba.web.widgets.client.verticalmenu.CubaSideMenuServerRpc at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:157) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:115) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:431) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:396) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:260) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:82) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1577) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:425) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:329) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:215) ~[cuba-web-7.1.5.jar:7.1.5] at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.19] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.19] at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:108) ~[spring-web-5.1.13.RELEASE.jar:5.1.13.RELEASE] at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:74) ~[spring-web-5.1.13.RELEASE.jar:5.1.13.RELEASE] at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:93) ~[cuba-web-7.1.5.jar:7.1.5] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.19] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[catalina.jar:9.0.19] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[catalina.jar:9.0.19] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[catalina.jar:9.0.19] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) ~[catalina.jar:9.0.19] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[catalina.jar:9.0.19] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[catalina.jar:9.0.19] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-coyote.jar:9.0.19] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-coyote.jar:9.0.19] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836) ~[tomcat-coyote.jar:9.0.19] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747) ~[tomcat-coyote.jar:9.0.19] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:9.0.19] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:9.0.19] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na] Caused by: java.lang.reflect.InvocationTargetException: null at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:153) ~[vaadin-server-8.6.4-26-cuba.jar:8.6.4-26-cuba] ... 38 common frames omitted Caused by: java.lang.RuntimeException: Unable to bind consumer handler at com.haulmont.cuba.gui.sys.UiControllerDependencyInjector.initSubscribeListeners(UiControllerDependencyInjector.java:369) ~[cuba-gui-7.1.5.jar:7.1.5] at com.haulmont.cuba.gui.sys.UiControllerDependencyInjector.inject(UiControllerDependencyInjector.java:114) ~[cuba-gui-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.WebScreens.createScreen(WebScreens.java:242) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.WebScreens.create(WebScreens.java:175) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.gui.config.MenuItemCommands$ScreenCommand.run(MenuItemCommands.java:313) ~[cuba-gui-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.SideMenuBuilder$MenuCommandExecutor.accept(SideMenuBuilder.java:264) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.sys.SideMenuBuilder$MenuCommandExecutor.accept(SideMenuBuilder.java:249) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.gui.components.mainwindow.WebSideMenu$MenuItemImpl.menuSelected(WebSideMenu.java:573) ~[cuba-web-7.1.5.jar:7.1.5] at com.haulmont.cuba.web.gui.components.mainwindow.WebSideMenu$MenuItemImpl$$Lambda$1082/0000000000000000.accept(Unknown Source) ~[na:na] at com.haulmont.cuba.web.widgets.CubaSideMenu$1.menuItemTriggered(CubaSideMenu.java:90) ~[cuba-web-widgets-7.1.5.jar:na] ... 43 common frames omitted Caused by: java.lang.ClassCastException: com.haulmont.cuba.gui.app.security.role.browse.RoleBrowser incompatible with com.haulmont.cuba.gui.app.security.user.browse.UserBrowser at com.haulmont.cuba.gui.sys.UiControllerDependencyInjector.initSubscribeListeners(UiControllerDependencyInjector.java:365) ~[cuba-gui-7.1.5.jar:7.1.5] ... 52 common frames omitted

Mike.

One other difference between the two Mac’s. The working one is using the Oracle HotSpot JVM for 11.0.3 and my new Mac is using the Open9 JVM for 11.0.6.

When I download Java 11.0.3 on my new Mac I will download the Oracle HotSpot one.

AFAIK, the platform is not tested with Open J9. I would recommend using either OpenJDK HotSpot from https://adoptopenjdk.net/ or Liberica JDK https://bell-sw.com/

1 Like

I will switch to the AdoptOpenJDK HotSpot JVM on my new Mac as that is what I’m using on my other working Mac.

In the Setup/Java SE Development Kit (JDK) section of the documentation it might be worth clarifying the supported Java version JDK and JVM choices. I chose the Open9 JVM as it isn’t Oracle and decided to give that one a go.

I’ll respond back if switching to the AdoptOpenJDK HotSpot JVM does resolve the issue.

1 Like

I can confirm that switching back to Java 11.0.3 AdoptOpenJDK with the HotSpot JVM resolved my ClassCastException.