Closed dk8pn closed 4 years ago
Linked discussion, with error log https://community.openhab.org/t/js-transformation-stopped-working-after-upgrade-to-2-5-6-snapshot-131/99705/3
Would you report the Java version you use, please? I think OH uses the javascript from host Java.
Ubuntu 19.04 openjdk version "1.8.0_252" OpenJDK Runtime Environment (Zulu 8.46.0.19-CA-linux64) (build 1.8.0_252-b14) OpenJDK 64-Bit Server VM (Zulu 8.46.0.19-CA-linux64) (build 25.252-b14, mixed mode)
I suspect it comes from the main issue, if I send :
http://192.168.0.199:8080/rest/items?recursive=false
I get no answer from the server, an NPE being raised :
Caused by: java.lang.NullPointerException
at org.openhab.transform.javascript.internal.JavaScriptEngineManager.getScript(JavaScriptEngineManager.java:68) ~[?:?]
at org.openhab.transform.javascript.internal.JavaScriptTransformationService.transform(JavaScriptTransformationService.java:74) ~[?:?]
at org.eclipse.smarthome.core.transform.TransformationHelper.transform(TransformationHelper.java:125) ~[?:?]
at org.eclipse.smarthome.core.transform.TransformationHelper.transform(TransformationHelper.java:100) ~[?:?]
at org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper.considerTransformation(EnrichedItemDTOMapper.java:124) ~[?:?]
at org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper.map(EnrichedItemDTOMapper.java:67) ~[?:?]
at org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper.map(EnrichedItemDTOMapper.java:61) ~[?:?]
at org.eclipse.smarthome.io.rest.core.internal.item.ItemResource.lambda$0(ItemResource.java:230) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_252]
at java.util.HashMap$KeySpliterator.tryAdvance(HashMap.java:1577) ~[?:1.8.0_252]
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:295) ~[?:1.8.0_252]
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:207) ~[?:1.8.0_252]
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:170) ~[?:1.8.0_252]
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:301) ~[?:1.8.0_252]
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) ~[?:1.8.0_252]
at org.eclipse.smarthome.io.rest.Stream2JSONInputStream.fillBuffer(Stream2JSONInputStream.java:93) ~[?:?]
at org.eclipse.smarthome.io.rest.Stream2JSONInputStream.read(Stream2JSONInputStream.java:69) ~[?:?]
at java.io.InputStream.read(InputStream.java:179) ~[?:1.8.0_252]
at java.io.InputStream.read(InputStream.java:101) ~[?:1.8.0_252]
at org.glassfish.jersey.message.internal.ReaderWriter.writeTo(ReaderWriter.java:115) ~[bundleFile:?]
at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeTo(AbstractMessageReaderWriterProvider.java:79) ~[bundleFile:?]
at org.glassfish.jersey.message.internal.InputStreamProvider.writeTo(InputStreamProvider.java:105) ~[bundleFile:?]
at org.glassfish.jersey.message.internal.InputStreamProvider.writeTo(InputStreamProvider.java:60) ~[bundleFile:?]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) ~[bundleFile:?]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) ~[bundleFile:?]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[bundleFile:?]
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) ~[?:?]
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[bundleFile:?]
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86) ~[?:?]
... 53 more
JavaScriptTransformationService
Yup, that failure blows up the Item REST fetch
Linked discussion, with error log https://community.openhab.org/t/js-transformation-stopped-working-after-upgrade-to-2-5-6-snapshot-131/99705/3
Would you report the Java version you use, please? I think OH uses the javascript from host Java.
Have Windows10, 64bit, openHAB2.5.5 snapshot #111 (working), openHAB2.5.6 snapshot #131 (not working, has the issue), JavaScript 1.8.0_251
Whilst I don't use Windows, or 2.5.6 (yet) I have seen this error lots as part of implementing a newer JS engine. When loading the newer JS engine it 'takes over' the existing one (Nashorn) and leaves it in a broken state. This will cause the exception here. This probably isn't much use to any non-devs, but hopefully it's a useful data point!
I suspect it comes from the main issue, if I send :
http://192.168.0.199:8080/rest/items?recursive=false
I get no answer from the server, an NPE being raised :
Caused by: java.lang.NullPointerException at org.openhab.transform.javascript.internal.JavaScriptEngineManager.getScript(JavaScriptEngineManager.java:68) ~[?:?] at org.openhab.transform.javascript.internal.JavaScriptTransformationService.transform(JavaScriptTransformationService.java:74) ~[?:?] at org.eclipse.smarthome.core.transform.TransformationHelper.transform(TransformationHelper.java:125) ~[?:?] at org.eclipse.smarthome.core.transform.TransformationHelper.transform(TransformationHelper.java:100) ~[?:?] at org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper.considerTransformation(EnrichedItemDTOMapper.java:124) ~[?:?] at org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper.map(EnrichedItemDTOMapper.java:67) ~[?:?] at org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper.map(EnrichedItemDTOMapper.java:61) ~[?:?] at org.eclipse.smarthome.io.rest.core.internal.item.ItemResource.lambda$0(ItemResource.java:230) ~[?:?] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_252] at java.util.HashMap$KeySpliterator.tryAdvance(HashMap.java:1577) ~[?:1.8.0_252] at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:295) ~[?:1.8.0_252] at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:207) ~[?:1.8.0_252] at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:170) ~[?:1.8.0_252] at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:301) ~[?:1.8.0_252] at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) ~[?:1.8.0_252] at org.eclipse.smarthome.io.rest.Stream2JSONInputStream.fillBuffer(Stream2JSONInputStream.java:93) ~[?:?] at org.eclipse.smarthome.io.rest.Stream2JSONInputStream.read(Stream2JSONInputStream.java:69) ~[?:?] at java.io.InputStream.read(InputStream.java:179) ~[?:1.8.0_252] at java.io.InputStream.read(InputStream.java:101) ~[?:1.8.0_252] at org.glassfish.jersey.message.internal.ReaderWriter.writeTo(ReaderWriter.java:115) ~[bundleFile:?] at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeTo(AbstractMessageReaderWriterProvider.java:79) ~[bundleFile:?] at org.glassfish.jersey.message.internal.InputStreamProvider.writeTo(InputStreamProvider.java:105) ~[bundleFile:?] at org.glassfish.jersey.message.internal.InputStreamProvider.writeTo(InputStreamProvider.java:60) ~[bundleFile:?] at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) ~[bundleFile:?] at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) ~[bundleFile:?] at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[bundleFile:?] at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) ~[?:?] at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[bundleFile:?] at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86) ~[?:?] ... 53 more
I have the same issue. I am running the stable version openHAB 2.5.6-1 on Ubuntu 18.04.4 and OpenJDK 1.8.0_252. When I try to view items in BasicUI, the NPE is thrown on the server. Frames are not being displayed. 😞
@openhab/add-ons-maintainers Does anyone of you have an idea what could have broken this code?
Looking at https://github.com/openhab/openhab-addons/commits/2.5.x/bundles/org.openhab.transform.javascript, the only change in 2.5.6 was applying spotless on the pom.xml - I cannot see any other change.
What change could cause the ScriptEngineManager
to not find the engine for javascript
anymore...?
Note that some users reporting some javascript transformations work, some don't. Context for the transformation (binding, label, etc.) appears irrelevant. No-one has yet reported JSR223 javascript rules as a roblem, but that usage might be rare.
After Upgrading to 2.5.6 same issue here.
Only using Java Script transform in the HTTP Binding for a cached URL
(config in /etc/openhab2/services/http.cfg):
(Ical.url=http://REMOTEURL.ics)
The .ics is than transformed thru Java Script:
String i_STRING { http="<[Ical:3600000:JS(transform.js)]" }
I get an "transform error" in the log every second:
- Error while executing background thread HTTP Refresh Service
java.lang.NullPointerException: null
at org.openhab.transform.javascript.internal.JavaScriptEngineManager.getScript(JavaScriptEngineManager.java:68) ~[?:?]
at org.openhab.transform.javascript.internal.JavaScriptTransformationService.transform(JavaScriptTransformationService.java
:74) ~[?:?]
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:69) ~[
bundleFile:?]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:218) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile
:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]
So I stopped the HTTP Binding, to get rid of these log entries.
Regards
Helmar
Same issue also here after upgrade to 2.5.6
Debian stretch with official openhab2 repositories.
Issue: JavaScript transformation
Expected Behavior
Using 2.5.5 snapshot #111, everything worked out normal. JS transform was used to add an offset to a watermeter counter in order to create the grand total water consumption in qubic meters.
Current Behavior
After upgrade to 2.5.6 snapshot #131 or newer, JS transformation from sitemap item label doesn't longer work out. Sitemap line item (see below) needs to be disabled to make other group members working again. Other transforms defined vs paperUI items definition still work out.
Steps to Reproduce (for Bugs)
Sitemap line item: Text item=WassermesserSensor_1_GasEnergyCounter label="Wasserzähler Stand [JS(wasseruhr_offset.js):%s]" icon="watermeter"
JavaSript file: (function(i) { var scale = " m3"; //workaround for display of the unit m3 var total = parseFloat(i) + 623.162; //sum of the water meter offset 623,162 m3 and the HomeMatic counter value var new_total = total.toFixed(3); //limits the digits after the dot to 3 return new_total.toString().replace('.', ',') + scale; //replaces dot by comma and adds the unit m3 })(input)
Your Environment
Windows10, openHAB2.5.5, snapshot #111