Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemaps defined in UI do not load anymore in 4.1M2 #3846

Closed
mherwege opened this issue Oct 16, 2023 · 10 comments · Fixed by #3850
Closed

Sitemaps defined in UI do not load anymore in 4.1M2 #3846

mherwege opened this issue Oct 16, 2023 · 10 comments · Fixed by #3850
Labels
bug An unexpected problem or unintended behavior of the Core

Comments

@mherwege
Copy link
Contributor

mherwege commented Oct 16, 2023

I updated my install to 4.1M2. I have all my sitemaps defined in the UI. They are still confirmed to be valid in the UI, but don't load anymore. Also saving them again does not solve the issue.
Putting them in text files makes them work again.

Below is the log.

@lolodomo I suspect it is caused by #3819, converting an single condition to a collection of conditions. Therefore the logic expects a different json format. The UI sitemap creation support will need to be enhanced with the new functionality, and sitemaps will have to be resaved. Sitemaps in the saved json db do not have the correct syntax anymore.

2023-10-16 18:01:03.915 [ERROR] [omponents.UIComponentSitemapProvider] - Cannot build sitemap thuis
java.lang.ClassCastException: class org.openhab.core.model.sitemap.sitemap.impl.ConditionImpl cannot be cast to class java.util.Collection (org.openhab.core.model.sitemap.sitemap.impl.ConditionImpl is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @c7f527; java.util.Collection is in module java.base of loader 'bootstrap')
	at org.openhab.core.model.sitemap.sitemap.impl.VisibilityRuleImpl.eSet(VisibilityRuleImpl.java:130) ~[?:?]
	at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.addWidgetVisibility(UIComponentSitemapProvider.java:387) ~[?:?]
	at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildWidget(UIComponentSitemapProvider.java:296) ~[?:?]
	at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildWidget(UIComponentSitemapProvider.java:288) ~[?:?]
	at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildSitemap(UIComponentSitemapProvider.java:165) ~[?:?]
	at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.getSitemapNames(UIComponentSitemapProvider.java:124) ~[?:?]
	at org.openhab.core.io.rest.sitemap.internal.SitemapResource.getSitemapBeans(SitemapResource.java:429) ~[?:?]
	at org.openhab.core.io.rest.sitemap.internal.SitemapResource.getSitemaps(SitemapResource.java:244) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[bundleFile:3.6.2]
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[bundleFile:3.6.2]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) ~[bundleFile:3.6.2]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) ~[bundleFile:3.6.2]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[bundleFile:3.6.2]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) ~[bundleFile:3.6.2]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:222) ~[bundleFile:3.6.2]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:497) ~[bundleFile:4.0.4]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279) ~[bundleFile:3.6.2]
	at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:102) ~[bundleFile:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656) ~[bundleFile:9.4.52.v20230823]
	at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:100) ~[bundleFile:?]
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:320) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) ~[bundleFile:9.4.52.v20230823]
	at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.52.v20230823]
	at java.lang.Thread.run(Thread.java:833) [?:?]
@mherwege mherwege added the bug An unexpected problem or unintended behavior of the Core label Oct 16, 2023
@lolodomo
Copy link
Contributor

Sorry I am not familiar at all with the MainUI generator. And I had not in mind there was a specific JSON behind!
I assume #3820 could also have an impact (merged after M2).
Can you help?

@mherwege
Copy link
Contributor Author

I will see what I can do the next few days. I first need to understand exactly what is happening here.

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-4-1-milestone-discussion/149502/69

@lolodomo
Copy link
Contributor

It is 4.1M2, not 4.0M2 ?

@mherwege
Copy link
Contributor Author

Yes, 4.1M2. Sorry.

@mherwege mherwege changed the title Sitemaps defined in UI do not load anymore in 4.0M2 Sitemaps defined in UI do not load anymore in 4.1M2 Oct 18, 2023
@mherwege
Copy link
Contributor Author

@lolodomo I am afraid the impact of these changes is very big for user defined rules. So far, in UI defined rules, the conditions for color and visibility are just passed as a single field, including the resulting state. It is then analyzed using a regex in the UIComponentSitemapProvider. This mechanism will not work anymore, as there can be multiple conditions with an AND in between, and a single argument at the end.

@lolodomo
Copy link
Contributor

Maybe the REGEX could be updated to match several AND conditions?

@mherwege
Copy link
Contributor Author

I looked into changing the REGEX, but didn't see an obvious way to do it. The main issue is that the UI strips quotes from the conditions when creating the JSON config format. That same format ends up in the JSONDB. So quotes can no longer be used as a separator in the REGEX to identify strings. The REGEX relies on the comparison characters to split out parts again. AND would just be interpreted as part of a string.
The better solution would be to extend the JSON configuration format to explicitely encode the parts of conditions in separate fields. It implies major changes in the sitemap editor UI code. It would also change the format of stored sitemap definitions in the JSONDB, so it would require a convertor from old to new. An advantage would be that it allows improving the UI to have separate fields for all parts fo the conditions. All of this is something I cannot do quickly and easily.

@mherwege
Copy link
Contributor Author

See connected PR's #3846 and openhab/openhab-webui#2145. I believe I now have a workable solution for this.

Remains to be done in separate webui PR: support for configuring buttongrid elements.

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/update-from-3-to-4-no-sitemap-works/150471/8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants