vaadin / multiplatform-runtime

4 stars 1 forks source link

NPE in MprUIInitHandler.synchronizedHandleRequest #60

Closed mvysny closed 1 year ago

mvysny commented 4 years ago

Vaadin 8.9.4+14.1.16, MPR 2.0.1. The original bug report is located at https://gitlab.com/mvysny/vaadin14-mpr-gradle-demo/issues/3

When I launch a Gradle-based MPR project in Intellij Ultimate in Tomcat and navigate to http://localhost:8080, the page flickers and there is a NPE in the log. Workaround is to press F5 which reloads the page and everything starts to work properly.

Stacktrace:

Feb 04, 2020 1:43:31 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [com.vaadin.mpr.MprServlet] in context with path [] threw exception [com.vaadin.server.ServiceException: java.lang.NullPointerException] with root cause
java.lang.NullPointerException
    at com.vaadin.mpr.core.MprUIInitHandler.synchronizedHandleRequest(MprUIInitHandler.java:57)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1602)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:448)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
...

Steps to reproduce:

  1. git clone https://gitlab.com/mvysny/vaadin14-mpr-gradle-demo
  2. Run ./gradlew clean vaadinPrepareFrontend assemble
  3. Run the WAR project in Intellij Ultimate in Tomcat
  4. Open http://localhost:8080 and check the logs
mvysny commented 4 years ago

Sounds like AbstractMprUIContent is constructed at AbstractLegacyWrapper:182 when the wrapper itself is attached to V14 UI; however there could be a race condition where MprUIInitHandler is invoked sooner. Can somebody explain in what scenario this could occur?

TatuLund commented 4 years ago

Regarding the same classes client side counter parts I have observed some oddness in client side as well https://github.com/vaadin/multiplatform-runtime/issues/56

Tostino commented 3 years ago

Also getting similar error, this is happening many many times a day at this point:


[2021-03-16 12:23:55] [crit] java.lang.NullPointerException: MprUIContent has not been initialized for 'b2a541fb-ac40-4f81-bb2a-35c5f2d6a58e' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60
[2021-03-16 12:23:55] [crit]     at java.base/java.util.Objects.requireNonNull(Objects.java:334)
[2021-03-16 12:23:55] [crit]     at com.vaadin.mpr.core.MprUIInitHandler.synchronizedHandleRequest(MprUIInitHandler.java:62)
[2021-03-16 12:23:55] [crit]     at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
[2021-03-16 12:23:55] [crit]     at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1435)
[2021-03-16 12:23:55] [crit]     at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380)
[2021-03-16 12:23:55] [crit]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[2021-03-16 12:23:55] [crit]     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
[2021-03-16 12:23:55] [crit]     at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[2021-03-16 12:23:55] [crit]     at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:128)
[2021-03-16 12:23:55] [crit]     at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
[2021-03-16 12:23:55] [crit]     at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:103)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
[2021-03-16 12:23:55] [crit]     at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:121)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
[2021-03-16 12:23:55] [crit]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
[2021-03-16 12:23:55] [crit]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
[2021-03-16 12:23:55] [crit]     at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
[2021-03-16 12:23:55] [crit]     at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
[2021-03-16 12:23:55] [crit]     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
[2021-03-16 12:23:55] [crit]     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639)
[2021-03-16 12:23:55] [crit]     at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
[2021-03-16 12:23:55] [crit]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[2021-03-16 12:23:55] [crit]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[2021-03-16 12:23:55] [crit]     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[2021-03-16 12:23:55] [crit]     at java.base/java.lang.Thread.run(Thread.java:832)```
rolandbinder commented 3 years ago

Hi, I am getting the following error:

SEVERE: Servlet.service() for servlet [com.vaadin.mpr.MprServlet] in context with path [/kfa_webgui] threw exception [com.vaadin.server.ServiceException: java.lang.NullPointerException: MprUIContent has not been initialized for '67068eef-dc41-44dd-9603-2a8279157a41' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60] with root cause
java.lang.NullPointerException: MprUIContent has not been initialized for '67068eef-dc41-44dd-9603-2a8279157a41' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60
    at java.util.Objects.requireNonNull(Objects.java:290)
    at com.vaadin.mpr.core.MprUIInitHandler.synchronizedHandleRequest(MprUIInitHandler.java:62)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1438)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
raja0812 commented 3 years ago

Hi, Even I got issue with the following versions

14.6.1 2.6.1 7.7.26 2.2.0 Error Stack trace is below ]] Root cause of ServletException. com.vaadin.server.ServiceException: java.lang.NullPointerException: MprUIContent has not been initialized for '276c6ec7-b128-4fbc-82fa-d27f5abd1e2e' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60 at com.vaadin.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1490) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1450) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at weblogic.websocket.tyrus.TyrusServletFilter.doFilter(TyrusServletFilter.java:274) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at com.cgi.arm.foundation.ui.spring.security.InsecureFilterChain.doFilter(InsecureFilterChain.java:34) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3797) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3763) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344) at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2451) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2299) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2277) at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1710) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1670) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272) at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352) at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337) at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57) at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420) at weblogic.work.ExecuteThread.run(ExecuteThread.java:360) Caused By: java.lang.NullPointerException: MprUIContent has not been initialized for '276c6ec7-b128-4fbc-82fa-d27f5abd1e2e' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60 at java.util.Objects.requireNonNull(Objects.java:290) at com.vaadin.mpr.core.MprUIInitHandler.synchronizedHandleRequest(MprUIInitHandler.java:62) at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1438) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at weblogic.websocket.tyrus.TyrusServletFilter.doFilter(TyrusServletFilter.java:274) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at com.cgi.arm.foundation.ui.spring.security.InsecureFilterChain.doFilter(InsecureFilterChain.java:34) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3797) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3763) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344) at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2451) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2299) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2277) at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1710) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1670) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272) at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352) at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337) at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57) at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420) at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)
Michael-OTS commented 3 years ago

Same problem after updating mpr-v8 from 5.0.3 to 5.0.4 with update to vaadin flow 21.0.1.

` 15:35:51,027 ERROR [stderr] (default task-2) java.lang.NullPointerException: MprUIContent has not been initialized for 'ee223455-795d-4799-9508-ac830247ea39' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60

15:35:51,028 ERROR [stderr] (default task-2) at java.base/java.util.Objects.requireNonNull(Objects.java:347)

15:35:51,028 ERROR [stderr] (default task-2) at deployment.eAkteMPR.ear.eakte-plus-web.war//com.vaadin.mpr.core.MprUIInitHandler.synchronizedHandleRequest(MprUIInitHandler.java:59)

`

Michael-OTS commented 3 years ago

Problem was reappearing with mpr-v8 5.0.4

dbenninger commented 3 years ago

Still happening with vaadin 8.14.1 / 14.6.7. Locally it happens all the time.

On production this has happened once in 7 hours...

any updates on this one?

TatuLund commented 3 years ago

Still happening with vaadin 8.14.1 / 14.6.7. Locally it happens all the time.

I recommend to update to 14.7.5.

In the latest version handling of the attribute name of the object related to this exception was changed. This fix is not included yet in 14.6.7. Note also that you need to update Vaadin 8 version to 8.14.2 due this fix.

dbenninger commented 3 years ago

Thanks Tatu, I tried but updating vaadin to 14.7.5 causes this issue

https://github.com/vaadin/multiplatform-runtime/issues/103

joheriks commented 2 years ago

@dbenninger Have you tried Vaadin 14.8.2 or newer (where #103 is fixed). Does the NPE in MprUIInitHandler.synchronizeHandlerRequest still occur? We were unable to reproduce this problem.

joheriks commented 2 years ago

Closing, please comment here if you can still reproduce the problem and we will re-open the ticket.

avackova commented 2 years ago

With:

7.7.30 14.8.4 2.7.11 I get: ``` SEVERE: Servlet.service() for servlet [com.vaadin.mpr.MprServlet] in context with path [/pxinfo] threw exception [com.vaadin.server.ServiceException: java.lang.NullPointerException: MprUIContent has not been initialized for id = '1613fccd-074e-4be1-b2f0-d47055921808' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60] with root cause java.lang.NullPointerException: MprUIContent has not been initialized for id = '1613fccd-074e-4be1-b2f0-d47055921808' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60 at java.base/java.util.Objects.requireNonNull(Objects.java:347) at com.vaadin.mpr.core.MprUIInitHandler.synchronizedHandleRequest(MprUIInitHandler.java:65) at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1467) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380) at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:659) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1732) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:829) ``` This occures, when opennig the page. After refresh the application looks OK.
lcorson-carma commented 1 year ago

vaadin.version = 14.10.7 vaadin-flow-version = 2.9.8 vaadin7.version = 7.7.40 And obviously running MPR Getting the following at random intervals in our Tomcat log. I do note that there is a call to one of our classes that implements javax.servlet.Filter (Carma.Log4jPerUserSessionFilter, in case that is not covered in this ticket.)

javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.NullPointerException: MprUIContent has not been initialized for id = '3eba9a74-221f-41af-84d3-265960f46092' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:379) ~[vaadin-server-7.7.40.jar:7.7.40]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[servlet-api.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[catalina.jar:9.0.64]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[catalina.jar:9.0.64]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.64]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[catalina.jar:9.0.64]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[catalina.jar:9.0.64]
    at Carma.Log4jPerUserSessionFilter.doFilter(Log4jPerUserSessionFilter.java:64) ~[carma-legacy-20.x.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[catalina.jar:9.0.64]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[catalina.jar:9.0.64]
    at au.com.vaadinutils.servlet.EntityManagerInjectorFilter$1.exec(EntityManagerInjectorFilter.java:34) ~[VaadinUtils-0.2.0.jar:?]
    at au.com.vaadinutils.servlet.EntityManagerInjectorFilter$1.exec(EntityManagerInjectorFilter.java:30) ~[VaadinUtils-0.2.0.jar:?]
    at au.com.vaadinutils.dao.EntityManagerProvider.setThreadLocalEntityManager(EntityManagerProvider.java:164) ~[VaadinUtils-0.2.0.jar:?]
    at au.com.vaadinutils.servlet.EntityManagerInjectorFilter.doFilter(EntityManagerInjectorFilter.java:30) [VaadinUtils-0.2.0.jar:?]
    at com.carmacloud.carma.vaadin.ConnectionManagerInjectorFilter.doFilter(ConnectionManagerInjectorFilter.java:20) [classes/:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.64]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.64]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) [catalina.jar:9.0.64]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [catalina.jar:9.0.64]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [catalina.jar:9.0.64]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [catalina.jar:9.0.64]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.64]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) [catalina.jar:9.0.64]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [catalina.jar:9.0.64]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) [catalina.jar:9.0.64]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) [tomcat-coyote.jar:9.0.64]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote.jar:9.0.64]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) [tomcat-coyote.jar:9.0.64]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1787) [tomcat-coyote.jar:9.0.64]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.64]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-util.jar:9.0.64]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-util.jar:9.0.64]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.64]
    at java.lang.Thread.run(Thread.java:750) [?:1.8.0_332]
Caused by: com.vaadin.server.ServiceException: java.lang.NullPointerException: MprUIContent has not been initialized for id = '3eba9a74-221f-41af-84d3-265960f46092' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60
    at com.vaadin.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1509) ~[vaadin-server-7.7.40.jar:7.7.40]
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1469) ~[vaadin-server-7.7.40.jar:7.7.40]
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:377) ~[vaadin-server-7.7.40.jar:7.7.40]
    ... 33 more
Caused by: java.lang.NullPointerException: MprUIContent has not been initialized for id = '3eba9a74-221f-41af-84d3-265960f46092' in current session. It should be added when the first LegacyComponent is attached. Please report this to https://github.com/vaadin/multiplatform-runtime/issues/60
    at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_332]
    at com.vaadin.mpr.core.MprUIInitHandler.synchronizedHandleRequest(MprUIInitHandler.java:65) ~[mpr-core-2.2.18.jar:?]
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:34) ~[vaadin-server-7.7.40.jar:7.7.40]
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1457) ~[vaadin-server-7.7.40.jar:7.7.40]
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:377) ~[vaadin-server-7.7.40.jar:7.7.40]
    ... 33 more

Thanks, Les

TatuLund commented 1 year ago

@lcorson-carma Have you recompiled the widgetset?

lcorson-carma commented 1 year ago

@TatuLund yes, every time we build the project.

TatuLund commented 1 year ago

@lcorson-carma This exception happens because MPR UI content is not found from the session attribute. The attribute key is set in window.mprUiId and furthermore passed by vaadinBootstrap.js in v-mui request parameter. The parameter is there (you would get other exception if not). This is the connecting logic between the two frameworks. MPR sets up Vaadin 7 UI provider which will also store instance of the legacy UI to this attribute. Now, this does not work if you have your own UI provider in the application. This is mentioned in the limitations section of the MPR documentation.

lcorson-carma commented 1 year ago

@TatuLund I don't believe we have our own UI provider. But, there is still a lot of unused legacy code in this project, so I'm guessing there is going to be some issues until I remove it all.

lcorson-carma commented 1 year ago

Hi Guys, this is all good from my side now. Found some old servlet code that had found its way back into the project. Removed, no longer seeing that error.

TatuLund commented 1 year ago

@lcorson-carma thanks for the update. Closing this for now.