OpenHAB 3 - Javascript Transformation

Hello everyone,

since my docker container was running on the milestone build, it automatically updated to 3.0.0M1 over the weekend. (Thanks to Watchtower)

I could now restart the old container and restore a backup, but I would like to see if the errors that occurred cannot be solved.

Or is the effort too much?

One error concerns the Javascript transformation:
It does not seem to find the js file anymore, but the javascript transformation is installed and is shown in the web ui under Settings -> Addons -> Transformations.

What’s wrong here?
Do the files have to be located somewhere else?

2020-10-15 08:24:39.382 [ERROR] [org.openhab.transform.javascript ] - bundle org.openhab.transform.javascript:3.0.0.M1 (243)[org.openhab.transform.javascript.internal.JavaScriptEngineManager(6)] : Error during instantiation of the implementation object
java.lang.reflect.InvocationTargetException: null
at jdk.internal.reflect.GeneratedConstructorAccessor182.newInstance(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
at org.apache.felix.scr.impl.inject.ComponentConstructor.newInstance(ComponentConstructor.java:309) ~[bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:277) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:114) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:982) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:955) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:900) [bundleFile:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212) [org.eclipse.osgi-3.12.100.jar:?]
at java.security.AccessController.doPrivileged(Native Method) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:508) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:624) [org.eclipse.osgi-3.12.100.jar:?]
at org.apache.felix.scr.impl.manager.SingleRefPair.getServiceObject(SingleRefPair.java:86) [bundleFile:?]
at org.apache.felix.scr.impl.inject.BindParameters.getServiceObject(BindParameters.java:47) [bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.BindMethod.getServiceObject(BindMethod.java:664) [bundleFile:?]
at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(DependencyManager.java:2308) [bundleFile:?]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.prebind(DependencyManager.java:1154) [bundleFile:?]
at org.apache.felix.scr.impl.manager.DependencyManager.prebind(DependencyManager.java:1568) [bundleFile:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.collectDependencies(AbstractComponentManager.java:1029) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:935) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:900) [bundleFile:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212) [org.eclipse.osgi-3.12.100.jar:?]
at java.security.AccessController.doPrivileged(Native Method) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:508) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461) [org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:624) [org.eclipse.osgi-3.12.100.jar:?]
at org.openhab.core.transform.TransformationHelper.getTransformationService(TransformationHelper.java:69) [bundleFile:?]
at org.openhab.binding.mqtt.generic.internal.MqttThingHandlerFactory.getTransformationService(MqttThingHandlerFactory.java:88) [bundleFile:?]
at org.openhab.binding.mqtt.generic.ChannelStateTransformation.processValue(ChannelStateTransformation.java:82) [bundleFile:?]
at org.openhab.binding.mqtt.generic.ChannelState.processMessage(ChannelState.java:159) [bundleFile:?]
at org.openhab.core.io.transport.mqtt.internal.Subscription.processMessage(Subscription.java:85) [bundleFile:?]
at org.openhab.core.io.transport.mqtt.internal.Subscription.lambda$1(Subscription.java:81) [bundleFile:?]
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) [?:?]
at java.util.concurrent.ConcurrentHashMap$KeySpliterator.forEachRemaining(ConcurrentHashMap.java:3566) [?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) [?:?]
at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290) [?:?]
at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746) [?:?]
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) [?:?]
at java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:408) [?:?]
at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:736) [?:?]
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159) [?:?]
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173) [?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) [?:?]
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) [?:?]
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:661) [?:?]
at org.openhab.core.io.transport.mqtt.internal.Subscription.messageArrived(Subscription.java:81) [bundleFile:?]
at org.openhab.core.io.transport.mqtt.internal.Subscription.messageArrived(Subscription.java:66) [bundleFile:?]
at com.hivemq.client.internal.mqtt.mqtt3.Mqtt3AsyncClientView.lambda$callbackView$1(Mqtt3AsyncClientView.java:73) [bundleFile:?]
at com.hivemq.client.internal.mqtt.MqttAsyncClient$CallbackSubscriber.onNext(MqttAsyncClient.java:227) [bundleFile:?]
at com.hivemq.client.internal.mqtt.MqttAsyncClient$CallbackSubscriber.onNext(MqttAsyncClient.java:212) [bundleFile:?]
at com.hivemq.client.rx.FlowableWithSingle$SingleFutureSubscriber.onNext(FlowableWithSingle.java:377) [bundleFile:?]
at com.hivemq.client.internal.rx.operators.FlowableWithSingleCombine$SplitSubscriber$Default.tryOnNextActual(FlowableWithSingleCombine.java:206) [bundleFile:?]
at com.hivemq.client.internal.rx.operators.FlowableWithSingleCombine$SplitSubscriber.tryOnNext(FlowableWithSingleCombine.java:171) [bundleFile:?]
at io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnConditionalSubscriber.runAsync(FlowableObserveOn.java:649) [bundleFile:?]
at io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:176) [bundleFile:?]
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66) [bundleFile:?]
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
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.NoClassDefFoundError: javax/script/ScriptEngineFactory
at java.lang.ClassLoader.findBootstrapClass(Native Method) ~[?:?]
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1258) ~[?:?]
at java.lang.System$2.findBootstrapClassOrNull(System.java:2134) ~[?:?]
at jdk.internal.loader.ClassLoaders$BootClassLoader.loadClassOrNull(ClassLoaders.java:118) ~[?:?]
at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:616) ~[?:?]
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
at org.eclipse.osgi.internal.framework.ContextFinder.loadClass(ContextFinder.java:127) ~[org.eclipse.osgi-3.12.100.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:398) ~[?:?]
at java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1209) ~[?:?]
at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1220) ~[?:?]
at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264) ~[?:?]
at java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299) ~[?:?]
at java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384) ~[?:?]
at javax.script.ScriptEngineManager.initEngines(ScriptEngineManager.java:123) ~[java.scripting:?]
at javax.script.ScriptEngineManager.init(ScriptEngineManager.java:87) ~[java.scripting:?]
at javax.script.ScriptEngineManager.(ScriptEngineManager.java:62) ~[java.scripting:?]
at org.openhab.transform.javascript.internal.JavaScriptEngineManager.(JavaScriptEngineManager.java:46) ~[?:?]
… 70 more
2020-10-15 08:24:39.388 [WARN ] [t.generic.ChannelStateTransformation] - Transformation service JS for pattern convertShellyRollershutter.js not found!

Kind regards
Thomas de Lange

This file needs to be located where the pattern is looking for it. The folder structure is no longer openhab2 for some reason

Thanks for the hint, but inside the docker container it was already /openhab/conf and /openhab/userdata before the update.

So nothing should have changed there.
Is there any way I can see which folder openHAB is searching in?

I not sure it may be a permissions issue that gives you the issue.

1 Like

Which version of Java are you using?

It’s the official docker container with Java 11

javaVersion: 11.0.8
javaVendor: Azul Systems, Inc.
javaVendorVersion: Zulu11.41+23-CA

In the container the files of the folders are all owned by the openhab-user.
That looks correct to me.

how was this resolved? i’m trying to use transformations too and i get the same error. i’m putting scripts in /etc/openhab/transform, i’ve also tried creating a script in the ui with no luck either