0

spring boot starter + ZK 9.5.1 issue on reload/reboot

asked 2021-03-24 20:49:50 +0800

Ignis11 gravatar image Ignis11
11 1

updated 2021-03-25 10:38:02 +0800

cor3000 gravatar image cor3000
5833 2 7
ZK Team

Hello,

I'm using ZK spring boot starter 2.3.1 with ZK 9.5.1 and Spring boot 2.4.4 (latest versions) And everything is working well except when I need to reload the changes in spring boot devtools.

Spring boot reload working well but when I try to reload the webpage, hundreds of errors appear in the log, and some button and notification show wrong labels.

I guess is an issue when locale labels are reloaded.

The trace is:

2021-03-24 13:47:16.172 ERROR 12868 --- [nio-9080-exec-1] org.zkoss.mesg.Messages                  : Message code not found: 27113401 not in es_ES:[org.zkoss.zul.mesg.MZul, /metainfo/mesg/msgzul]
2021-03-24 13:47:16.172  INFO 12868 --- [nio-9080-exec-1] o.z.util.resource.impl.LabelLoaderImpl   : Loading labels for es_ES
2021-03-24 13:47:16.174 ERROR 12868 --- [nio-9080-exec-1] org.zkoss.mesg.Messages                  : 

java.lang.IllegalStateException: The resources may not be accessed if they are not currently started
    at org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:246) ~[catalina.jar:9.0.41]
    at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:212) ~[catalina.jar:9.0.41]
    at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:206) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:538) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:205) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.StandardContext$NoPluggabilityServletContext.getResource(StandardContext.java:6467) ~[catalina.jar:9.0.41]
    at org.zkoss.web.util.resource.ServletLabelLocator.locate0(ServletLabelLocator.java:94) ~[zweb-9.5.1.jar:9.5.1]
    at org.zkoss.web.util.resource.ServletLabelLocator.locate(ServletLabelLocator.java:77) ~[zweb-9.5.1.jar:9.5.1]
    at org.zkoss.util.resource.impl.LabelLoaderImpl.loadLabels(LabelLoaderImpl.java:272) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.util.resource.impl.LabelLoaderImpl.getLabel(LabelLoaderImpl.java:130) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.util.resource.impl.LabelLoaderImpl.getLabel(LabelLoaderImpl.java:121) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.util.resource.Labels.getLabel(Labels.java:61) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.mesg.Messages.getFromBundle(Messages.java:81) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.mesg.Messages.getNotFound(Messages.java:105) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.mesg.Messages.get(Messages.java:157) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.mesg.Messages.get(Messages.java:52) ~[zcommon-9.5.1.jar:9.5.1]
    at org.zkoss.zul.impl.Utils.addLocaleJS(Utils.java:317) ~[zul-9.5.1.jar:9.5.1]
    at org.zkoss.zul.impl.Utils.outLocaleJavaScript(Utils.java:306) ~[zul-9.5.1.jar:9.5.1]
    at org.zkoss.zul.impl.ZulMessageLoader.load(ZulMessageLoader.java:34) ~[zul-9.5.1.jar:9.5.1]
    at org.zkoss.zk.ui.http.Wpds.outLocaleJavaScript(Wpds.java:116) ~[zk-9.5.1.jar:9.5.1]
    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 org.zkoss.zk.ui.http.AbstractExtendlet.invoke(AbstractExtendlet.java:140) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.zk.ui.http.WpdExtendlet.write(WpdExtendlet.java:617) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.zk.ui.http.WpdExtendlet.access$1700(WpdExtendlet.java:88) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.zk.ui.http.WpdExtendlet$WpdContent.toByteArray(WpdExtendlet.java:905) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.zk.ui.http.WpdExtendlet$WpdContent.access$400(WpdExtendlet.java:855) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.zk.ui.http.WpdExtendlet.retrieve(WpdExtendlet.java:195) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.zk.ui.http.WpdExtendlet.service(WpdExtendlet.java:113) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.web.util.resource.ClassWebResource.web0(ClassWebResource.java:605) ~[zweb-9.5.1.jar:9.5.1]
    at org.zkoss.web.util.resource.ClassWebResource.web(ClassWebResource.java:592) ~[zweb-9.5.1.jar:9.5.1]
    at org.zkoss.web.util.resource.ClassWebResource.service(ClassWebResource.java:272) ~[zweb-9.5.1.jar:9.5.1]
    at org.zkoss.zk.au.http.DHtmlResourceServlet.doGet0(DHtmlResourceServlet.java:117) ~[zk-9.5.1.jar:9.5.1]
    at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:397) ~[zk-9.5.1.jar:9.5.1]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[servlet-api.jar:4.0.FR]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[servlet-api.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.41]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.41]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter.doFilterInternal(DefaultLogoutPageGeneratingFilter.java:58) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:237) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:223) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:218) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:178) ~[spring-security-oauth2-client-5.4.5.jar:5.4.5]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.4.5.jar:5.4.5]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.5.jar:5.3.5]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.41]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.41]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.41]
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93) ~[spring-boot-actuator-2.4.4.jar:2.4.4]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.41]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.5.jar:5.3.5]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.5.jar:5.3.5]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[catalina.jar:9.0.41]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[catalina.jar:9.0.41]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[catalina.jar:9.0.41]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[catalina.jar:9.0.41]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[catalina.jar:9.0.41]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-coyote.jar:9.0.41]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-coyote.jar:9.0.41]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) ~[tomcat-coyote.jar:9.0.41]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) ~[tomcat-coyote.jar:9.0.41]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:9.0.41]
    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.41]
    at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-25 10:48:31 +0800

cor3000 gravatar image cor3000
5833 2 7
ZK Team

updated 2021-03-25 10:52:59 +0800

I personally try to avoid restarts by using DCEVM (or JRebel if available)

However if that's not an option the devtools restart needs to be configured to include the ZK jars during a restart. This spring-boot-devtools functionality is documented here:

https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-devtools-customizing-classload

A simple config I found working on my side is to add the following:

src/main/resources/META-INF/spring-devtools.properties

restart.include.zklibs=/z[\\w]+-[\\w\\d-\.]+\.jar

it will ensure jars starting with z such as zk-9.5.1.jar or zul-9.5.1.jar are reloaded during restart.

This is necessary, because ZK relies on static initializers - e.g. to load the label properties.

You might have to customize the regex to exclude non-zk jars also starting with z.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2021-03-24 20:49:50 +0800

Seen: 9 times

Last updated: Mar 25

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More