Compilation using native image is failing - graalvm

I have no idea why am getting this error. someone may have at least a clue please.
\[1/7\] Initializing... (0.0s # 0.30GB)
Fatal error: java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "\<local2\>" is null
at com.oracle.svm.core.option.OptionOrigin.from(OptionOrigin.java:81)
at com.oracle.svm.core.option.LocatableMultiOptionValue.lambda$getValuesWithOrigins$1(LocatableMultiOptionValue.java:87)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.processClassInitializationOptions(ClassInitializationFeature.java:82)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:812)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:554)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:514)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:413)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:591)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:129)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:621)
it fails where running gradle nativeCompile
MacBook Pro M1 chip.
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment GraalVM CE 22.1.0-dev (build 17.0.3+4-jvmci-22.1-b03)
OpenJDK 64-Bit Server VM GraalVM CE 22.1.0-dev (build 17.0.3+4-jvmci-22.1-b03, mixed mode, sharing)
tried to change the GraalVM versions but no success.

Related

Jruby - TypeError: illegal access on 'clone'

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.zlib.RubyZlib to field java.util.zip.CRC32.crc
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.zlib.RubyZlib
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
rails aborted!
TypeError: illegal access on 'clone': class org.jruby.javasupport.JavaMethod cannot access a member of class java.lang.Object (in module java.base) with modifiers "protected native"
I'm suddenly getting this error. Any help would be appreciated.
java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
Hi I too faced the same problem with OpenJDK9.
# java --version
openjdk 9.0.4
OpenJDK Runtime Environment (build 9.0.4+12-Debian-4)
OpenJDK 64-Bit Server VM (build 9.0.4+12-Debian-4, mixed mode)
# jruby -v
jruby 9.1.16.0 (2.3.3) 2018-02-21 8f3f95a OpenJDK 64-Bit Server VM 9.0.4+12-Debian-4 on 9.0.4+12-Debian-4 +jit [linux-x86_64]
and
activerecord-jdbc-adapter -v 1.3.24
I just gave the fix in gem level then it's not blocking me to proceed further. Just try this.
Go to the driver.rb in the following path:
activerecord-jdbc-adapter-1.3.24/lib/arjdbc/jdbc/driver.rb
Then edit the following line in the connection method
properties = self.properties.clone
Change this to:
properties = self.properties.dup

Can't run NiFi on OSX

I installed NiFi on my OSX machine using
brew install nifi
This worked fine, but when I run the command
nifi run
I checked the nifi-app log and this is what pops out:
2017-10-27 00:24:26,211 WARN [main] org.apache.nifi.bootstrap.Command
Launched Apache NiFi but could not determined the Process ID
I tried nifi startas well but get the following as status:
2017-10-27 00:26:48,081 INFO [main] org.apache.nifi.bootstrap.Command
Apache NiFi is currently running, listening to Bootstrap on port
50289, PID=unknown
Not sure if I have to edit something, but I'm concerned by PID is unknown.
EDIT:
When running
2017-10-27 11:14:13,809 ERROR [main] org.apache.nifi.NiFi Failure to
launch NiFi due to java.util.ServiceConfigurationError:
org.apache.nifi.processor.Processor: Provider
org.apache.nifi.processors.standard.ParseCEF could not be instantiated
java.util.ServiceConfigurationError:
org.apache.nifi.processor.Processor: Provider
org.apache.nifi.processors.standard.ParseCEF could not be instantiated
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:581)
at java.base/java.util.ServiceLoader.access$100(ServiceLoader.java:390)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:799)
at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721)
at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1389)
at org.apache.nifi.nar.ExtensionManager.loadExtensions(ExtensionManager.java:142)
at org.apache.nifi.nar.ExtensionManager.discoverExtensions(ExtensionManager.java:117)
at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:702)
at org.apache.nifi.NiFi.<init>(NiFi.java:160)
at org.apache.nifi.NiFi.main(NiFi.java:268)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.apache.bval.jsr.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:357)
at org.apache.bval.jsr.ConfigurationImpl.createBootstrapConfiguration(ConfigurationImpl.java:349)
at org.apache.bval.jsr.ConfigurationImpl.prepare(ConfigurationImpl.java:340)
at org.apache.bval.jsr.ConfigurationImpl.__privileged_doBuildValidatorFactory(ConfigurationImpl.java:329)
at org.apache.bval.jsr.ConfigurationImpl.doBuildValidatorFactory(ConfigurationImpl.java)
at org.apache.bval.jsr.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:324)
at org.apache.nifi.processors.standard.ParseCEF.<init>(ParseCEF.java:179)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:777)
... 7 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 19 common frames omitted
I was using JDK 9. Turns out as of today, this doesn't work. I downgraded to JDK 8 and voila! Thanks y'all
No need to download to JDK 8, but you do need it installed.
Picking which JDK to Run
I have an app (nifi) which does not work on JDK 9, so I want to switch the JDK Version.
List Possible Versions
This is the command
/usr/libexec/java_home -V
And the correctponing output
Matching Java Virtual Machines (2):
9.0.1, x86_64: "Java SE 9.0.1" /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
1.8.0_151, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
Set your Java-Home
For picking just a major Version you can do this
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Run App (nifi)
I now just need to select this Java, export it. And run the startup script...
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
tim#T-Mac-mini bin $ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
tim#TMac-mini bin $ ./nifi.sh run
It now works.

Openlayers Custom build tutorial is crashing

I am working through the openlayers custom build tutorial and I am getting the following error
info ol Parsing dependencies
info ol Compiling 345 sources
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn java ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit
(internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:441:9)
at process._tickCallback (node.js:355:17)
Exit 1
when I run:
node tasks/build.js build/ol-custom.json build/ol-custom.js
Googling the error gives a solution where it could be another node instance running in the background (there isnt)
also the tutorial says closure-util should be in:
node_modules/openlayers/node_modules
but it is actually in:
node_modules/closure-util
Any idea why this is happening?
It turns out java wasn't set up properly on my path and so it couldn't build. Remember to check your environment with java -version.
On Ubuntu you can install install java 11 (working with this version):
sudo apt install openjdk-11-jre-headless
It should return:
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)
Then you can run again:
node tasks/build.js build/ol-custom.json build/ol-custom.js

Can't get neo4j to start - conf/log4j.properties

I've just used homebrew to successfully install the latest neo4j (Community Edition 2.1.4) on my MacBook Pro - however, I've been unable to get the server to start.
My question seems similar to this though that question remains unresolved (and the suggestions haven't worked for me).
Just quickly: I have previously successfully installed and booted the trial of the Enterprise Edition (over a year ago) and I've since removed it. Pure speculation but I'm guessing that my issues could be related to this.
When I run neo4j start
I get
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew -Djava.awt.headless=true
Starting Neo4j Server...WARNING: not changing user
process [1368]... waiting for server to be ready.. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
Then I inspect with neo4j console and get
WARNING: Max 256 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
Starting Neo4j Server console-mode...
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew -Djava.awt.headless=true
log4j:ERROR Could not read configuration file from URL [file:conf/log4j.properties].
java.io.FileNotFoundException: conf/log4j.properties (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1037)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:459)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:243)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:121)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:154)
at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:252)
at org.neo4j.server.configuration.PropertyFileConfigurator.loadPropertiesConfig(PropertyFileConfigurator.java:147)
at org.neo4j.server.configuration.PropertyFileConfigurator.<init>(PropertyFileConfigurator.java:67)
at org.neo4j.server.Bootstrapper.createConfigurator(Bootstrapper.java:220)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:98)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:62)
log4j:ERROR Ignoring configuration file [file:conf/log4j.properties].
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
at org.apache.commons.configuration.ConfigurationUtils.locate(ConfigurationUtils.java:447)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:213)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:197)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:162)
at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:252)
at org.neo4j.server.configuration.PropertyFileConfigurator.loadPropertiesConfig(PropertyFileConfigurator.java:147)
at org.neo4j.server.configuration.PropertyFileConfigurator.<init>(PropertyFileConfigurator.java:67)
at org.neo4j.server.Bootstrapper.createConfigurator(Bootstrapper.java:220)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:98)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:62)
It seems conf/log4j.properties isn't created at all. I've then copied the contents of that file from my brothers successful installation which seems to remedy the first error though the second error persists with the same result when I try to start the server again.
I've also tried to install via direct download and get the same result.
Other details:
>> java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
>> sw_vers
ProductName: Mac OS X
ProductVersion: 10.9.4
BuildVersion: 13E28
I'm aware of the Max open files warning though don't believe that to be the issue.
Help would be much appreciated. Thanks in advance.
I've had some success – or, at least, I've got neo4j working now on my machine.
Following the suggestion in this google thread I removed slf4j-api-1.5.8.jar and slf4j-log4j12-1.5.8.jar from /Library/Java/Extensions and the server now boots.
I have no idea if this will have unexpected negative consequences but it definitely seems to solve my problem. Moving on.

JavaCV-OpenCV MacOSX 10.7.4 x64

I have tried everything possible to solve this error, I was able to run in Windows x86 but I can't compile anything in my MacOSX x64.
I have installed OpenCV using Xcode and port -v opencv +python27 option all the linkpaths are correct. One thing that i have found different is inside the code
public static final String genericIncludepath = "/opt/local/include/";
public static final String genericLinkpath = "/opt/local/lib/:/opt/local/lib64/:/usr/local/lib/:/usr/local/lib64/";
The genericLinkpath for MacOSX does not contains lib64.
What steps will reproduce the problem?
1. Try to run HoughLines or any sample
What is the expected output? What do you see instead?
Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core2612287037709553365.dylib: Library not loaded: lib/libopencv_core.2.4.dylib Referenced from: /private/var/folders/qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core2612287037709553365.dylib Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1020)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:403)
at com.googlecode.javacpp.Loader.load(Loader.java:342)
at com.googlecode.javacpp.Loader.load(Loader.java:316)
at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.googlecode.javacpp.Loader.load(Loader.java:335)
at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.googlecode.javacpp.Loader.load(Loader.java:335)
at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:91)
at com.javacv.HoughLines.main(HoughLines.java:32)
What version of the product are you using? On what operating system?
MacOS X 10.7.4
$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)
JAVACV -- javacv-bin-20120512
echo $PATH
/opt/local/include:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
$ ls | grep opencv
opencv_createsamples
opencv_haartraining
opencv_performance
opencv_traincascade
$ ls | grep opencv
libopencv_calib3d.2.4.0.dylib
libopencv_calib3d.2.4.dylib
libopencv_calib3d.dylib
libopencv_contrib.2.4.0.dylib
libopencv_contrib.2.4.dylib
libopencv_contrib.dylib
libopencv_core.2.4.0.dylib
libopencv_core.2.4.dylib
libopencv_core.dylib
libopencv_features2d.2.4.0.dylib
libopencv_features2d.2.4.dylib
libopencv_features2d.dylib
libopencv_flann.2.4.0.dylib
libopencv_flann.2.4.dylib
libopencv_flann.dylib
libopencv_gpu.2.4.0.dylib
libopencv_gpu.2.4.dylib
libopencv_gpu.dylib
libopencv_highgui.2.4.0.dylib
libopencv_highgui.2.4.dylib
libopencv_highgui.dylib
libopencv_imgproc.2.4.0.dylib
libopencv_imgproc.2.4.dylib
libopencv_imgproc.dylib
libopencv_legacy.2.4.0.dylib
libopencv_legacy.2.4.dylib
libopencv_legacy.dylib
libopencv_ml.2.4.0.dylib
libopencv_ml.2.4.dylib
libopencv_ml.dylib
libopencv_nonfree.2.4.0.dylib
libopencv_nonfree.2.4.dylib
libopencv_nonfree.dylib
libopencv_objdetect.2.4.0.dylib
libopencv_objdetect.2.4.dylib
libopencv_objdetect.dylib
libopencv_photo.2.4.0.dylib
libopencv_photo.2.4.dylib
libopencv_photo.dylib
libopencv_stitching.2.4.0.dylib
libopencv_stitching.2.4.dylib
libopencv_stitching.dylib
libopencv_ts.2.4.0.dylib
libopencv_ts.2.4.dylib
libopencv_ts.dylib
libopencv_video.2.4.0.dylib
libopencv_video.2.4.dylib
libopencv_video.dylib
libopencv_videostab.2.4.0.dylib
libopencv_videostab.2.4.dylib
libopencv_videostab.dylib
System.out.println(System.getProperty("os.arch")); x86_64
System.out.println(System.getProperty("sun.arch.data.model")); 64

Resources