JS Scripting filewatcher in automation not working

Hi,

Has someone observed and solved the same problem.
A fresh install of openhabian and JS Scripting.

My text based js scripts in ‘OH-conf’/automation/js will not detected. I can’t see an entry in openhab.log after saving the rule. The rule is the simplest sceleton:

rules.JSRule({
  name: "my test script",
  description: "test ...",
  triggers: [triggers.GenericCronTrigger("0/6 * * * * ? *")],
  execute: (event) => {
    console.log('this is a test !!!!!!!!!!')
  }
});

I have installed openhabian and OH snapshot (openHAB 3.4.0, Build 3218). ECMA262-11 scripts created in UI are working fine.
btw: Changes at item-, thins-, sitemap- files are observed.

There were a couple of changes to the file watcher last week. Try this in the release candidate and if the problem persists, post to the 3.4 release thread.

Edit: don’t try to post without your glasses

It’s running again.

I had installed java openJDK17 and finally downgraded this to openJDK11. now my scripts are detected and running.
Thank you Rich for your reply.

That‘s a known issue with JDK 17. It works if you install the Nashorn scripting engine from the community marketplace.

1 Like

@J-N-K
I am a little confused.
My intention is to use JSscripting. I have installed the JavaScript Scripting add-on. Do you mean to install this add-on from the marketplace.

I think the issue is there is a problem with the JS Scripting file watcher when the Nashorn language isn’t present. In Java 17, Nashorn is no longer included and needs to be installed separately. There is a Nashorn add-on on the marketplace.

2 Likes

Exactly, Rich. The current implementation expects Nashorn to be present, even if you use Graal.

1 Like

Thanks again

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.