OH3 Error in Log when editing ZoneDateTime with VSCode

When I enter “ZoneDateTime” into a rule in VSCode OpenHAB puts an error in the log. Do I need to import something before using this type? The rule works without any imports.

2021-01-24 14:58:02.804 [ERROR] [xt.ide.server.concurrent.ReadRequest] - Error during request: 
java.lang.RuntimeException: Cannot create a resource for 'java:/Objects/java.time.ZonedDateTime'; a registered resource factory is needed
at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:263) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.ProjectManager.getResource(ProjectManager.java:169) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:436) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.findReferences.WorkspaceResourceAccess.readOnly(WorkspaceResourceAccess.java:36) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.doRead(DocumentSymbolService.java:332) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:112) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:99) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$24(LanguageServerImpl.java:603) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:438) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:602) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:590) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$23(LanguageServerImpl.java:581) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:66) [bundleFile:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
2021-01-24 14:58:03.867 [ERROR] [t.ide.server.concurrent.WriteRequest] - Error during request: 
java.util.concurrent.CompletionException: java.lang.RuntimeException: Cannot create a resource for 'java:/Objects/java.time.ZonedDateTime'; a registered resource factory is needed
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331) ~[?:?]
at java.util.concurrent.CompletableFuture.andTree(CompletableFuture.java:1452) ~[?:?]
at java.util.concurrent.CompletableFuture.andTree(CompletableFuture.java:1444) ~[?:?]
at java.util.concurrent.CompletableFuture.andTree(CompletableFuture.java:1444) ~[?:?]
at java.util.concurrent.CompletableFuture.andTree(CompletableFuture.java:1444) ~[?:?]
at java.util.concurrent.CompletableFuture.allOf(CompletableFuture.java:2337) ~[?:?]
at org.eclipse.xtext.ide.server.concurrent.RequestManager.cancel(RequestManager.java:114) ~[?:?]
at org.eclipse.xtext.ide.server.concurrent.RequestManager.runWrite(RequestManager.java:80) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.runBuildable(LanguageServerImpl.java:453) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.didChange(LanguageServerImpl.java:393) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.RuntimeException: Cannot create a resource for 'java:/Objects/java.time.ZonedDateTime'; a registered resource factory is needed
at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:263) ~[?:?]
at org.eclipse.xtext.ide.server.ProjectManager.getResource(ProjectManager.java:169) ~[?:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:436) ~[?:?]
at org.eclipse.xtext.ide.server.findReferences.WorkspaceResourceAccess.readOnly(WorkspaceResourceAccess.java:36) ~[?:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.doRead(DocumentSymbolService.java:332) ~[?:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:112) ~[?:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:99) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$24(LanguageServerImpl.java:603) ~[?:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:438) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:602) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:590) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$23(LanguageServerImpl.java:581) ~[?:?]
at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:66) ~[?:?]
... 5 more

Yes. When using a ECMA script it would be:

var ZonedDateTime = Java.type("java.time.ZonedDateTime");

This is with the old rules format. It’s something I encountered when converting my old rules to OH3.

We’ll need to see the rule.

This is where it just became interesting. After editing the rules file throwing up the error I created a new one with just the getZonedDateTime statement in it and the new rules file isn’t throwing up the error. The original file contains 12 rules and is 543 lines long.
Now everything is working I’ll revisit my extensive set of rules and see if I can find something reproducible

A variant has just popped up when adding logInfo statements to rules. The relevant line is

 logInfo("Timers2", "calculate all heat/cool times rule")

and it resulted in

 2021-02-02 12:37:55.222 [ERROR] [t.ide.server.concurrent.WriteRequest] - Error during request: 

java.util.concurrent.CompletionException: java.lang.RuntimeException: Cannot create a resource for ‘java:/Objects/org.openhab.core.model.script.actions.Log’; a registered resource factory is needed
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331) ~[?:?]
at java.util.concurrent.CompletableFuture.andTree(CompletableFuture.java:1452) ~[?:?]
at java.util.concurrent.CompletableFuture.andTree(CompletableFuture.java:1444) ~[?:?]
at java.util.concurrent.CompletableFuture.andTree(CompletableFuture.java:1442) ~[?:?]
at java.util.concurrent.CompletableFuture.allOf(CompletableFuture.java:2337) ~[?:?]
at org.eclipse.xtext.ide.server.concurrent.RequestManager.cancel(RequestManager.java:114) ~[?:?]
at org.eclipse.xtext.ide.server.concurrent.RequestManager.runWrite(RequestManager.java:80) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.runBuildable(LanguageServerImpl.java:453) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.didChange(LanguageServerImpl.java:393) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor286.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) ~[?:?]
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.RuntimeException: Cannot create a resource for ‘java:/Objects/org.openhab.core.model.script.actions.Log’; a registered resource factory is needed
at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:263) ~[?:?]
at org.eclipse.xtext.ide.server.ProjectManager.getResource(ProjectManager.java:169) ~[?:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:436) ~[?:?]
at org.eclipse.xtext.ide.server.findReferences.WorkspaceResourceAccess.readOnly(WorkspaceResourceAccess.java:36) ~[?:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.doRead(DocumentSymbolService.java:332) ~[?:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:112) ~[?:?]
at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:99) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$24(LanguageServerImpl.java:603) ~[?:?]
at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:438) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:602) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:590) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$23(LanguageServerImpl.java:581) ~[?:?]
at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:66) ~[?:?]
… 5 more

Curiously enough trying to run rules from the admin GUI on the same machine results in the web browser often hanging by just listing the rules and clicking on one of them