senx / nifi-warp10-processor

NiFi WarpScript™ Processor
1 stars 1 forks source link

nifi-warp10-processor could not be instantiated #2

Closed lacey10 closed 1 year ago

lacey10 commented 1 year ago

The nifi-warp10-processor (build from source or the compiled version from release pages) can not be instantiated (nifi-1.19). The logs show the following message Nifi UI message Unable to obtain temporary component for io.warp10.nifi.WarpScriptProcessor

Nifi app logs message 2023-02-04 12:50:05,531 INFO [NiFi Web Server-22] io.warp10.continuum.store.Constants ########[ Initialized with 1000 time units per millisecond ]######## 2023-02-04 12:50:05,549 WARN [NiFi Web Server-22] i.warp10.script.WarpFleetMacroRepository No validator macro, default macro will reject all URLs. 2023-02-04 12:50:05,903 INFO [NiFi Web Server-22] io.warp10.script.functions.REPORT REPORT secret not set, using 'dbe74d59-f0cc-409b-9b8a-653e25802ce1'. 2023-02-04 12:50:06,338 INFO [NiFi Web Server-22] io.warp10.nifi.WarpScriptProcessor


| / / ____ < / \ | /| / / `/_ _/ \ _ / / / / |/ |/ / / // / / // / / / // / __/|/ __,/ // ./ // \/ /_/

Revision: 2.11.1

2023-02-04 12:50:06,346 INFO [NiFi Web Server-22] io.warp10.script.WarpScriptLib LOADED extension 'io.warp10.script.ext.debug.DebugWarpScriptExtension' 2023-02-04 12:50:06,351 INFO [NiFi Web Server-22] io.warp10.script.WarpScriptLib LOADED extension 'io.warp10.script.ext.http.HttpWarpScriptExtension' 2023-02-04 12:50:06,352 INFO [NiFi Web Server-22] io.warp10.script.WarpScriptLib LOADED extension 'io.warp10.script.ext.logging.LoggingWarpScriptExtension' 2023-02-04 12:50:06,354 INFO [NiFi Web Server-22] io.warp10.script.WarpScriptLib LOADED extension 'io.warp10.script.ext.rexec.RexecWarpScriptExtension' 2023-02-04 12:50:06,359 INFO [NiFi Web Server-22] io.warp10.script.WarpScriptLib LOADED extension 'io.warp10.script.ext.sensision.SensisionWarpScriptExtension' 2023-02-04 12:50:06,383 ERROR [NiFi Web Server-22] o.a.n.n.StandardExtensionDiscoveringManager Could not instantiate class of type io.warp10.nifi.WarpScriptProcessor using ClassLoader for bundle io.warp10:nifi-warp10-processor:1.0.0 java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap') at io.warp10.continuum.gts.UnsafeString.getChars(UnsafeString.java:98) at io.warp10.continuum.gts.UnsafeString.sanitizeStrings(UnsafeString.java:436) at io.warp10.script.MemoryWarpScriptStack.exec(MemoryWarpScriptStack.java:555) at io.warp10.script.WarpScriptExecutor.(WarpScriptExecutor.java:162) at io.warp10.script.WarpScriptExecutor.(WarpScriptExecutor.java:120) at io.warp10.script.WarpScriptExecutor.(WarpScriptExecutor.java:116) at io.warp10.nifi.WarpScriptProcessor.init(WarpScriptProcessor.java:163)

Could it be a cast of type which is not allowed ? Is there a dependency on a specific java version ?

hbs commented 1 year ago

Hi, Warp 10 up to versions 2.x is only compatible with Java 8, the error you see is due to the use of a JDK version 9 or above, Oracle modified the internals of the String class in JDK9, changing from an array of chars ([C) to an array of bytes ([B), therefore any code making use of Unsafe to access the char array of classes String for performance reason will fail with a ClassCastException.

Starting with Warp 10 3.x and satellite code depending on it, like the NiFi processor, JDK 9+ will be supported.

Warp 10 version 3.0 should be available in alpha during Q1 and in beta then GA during Q2 2023.

lacey10 commented 1 year ago

Hi, thank you for clarifying the java.lang.ClassCastException. The Apache Nifi instance is indeed running with a higher version of Java and hence explains the behavior seen. Configuration of the Apache nifi instance using Java 8 should hopefully help.