Opening .jar file on mac using JDK 11 fails with RuntimeException - java

I am trying to open a .jar file (https://github.com/ptrckbnck/SQLChecker/releases) on my MAC Mojave 10.14 , I need it for my university course.
What I did:
installed java OpenJDK 11 as suggested here https://solarianprogrammer.com/2018/09/28/installing-openjdk-macos/
java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
But when I run java -jar SQLChecker-1.0.jar I keep on getting the following exception:
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
... 1 more
Exception in thread "main" java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
I have read related thread Migration to JDK 11 + JavaFX 11 giving RuntimeException and downloaded also JavaFX 11, namely JavaFX Mac OS X SDK from here https://gluonhq.com/products/javafx/. I also run the following code:
export PATH_TO_FX=my/path/to/javafx-sdk-11/lib
and run HelloWorld test using JavaFX 11 as described here https://openjfx.io/openjfx-docs/. Everything worked fine but did not solve my original problem.
As was suggested by #Drimux in the related thread some libraries are missing in the OpenJDK distribution. He sad that those probably are libprism_es2.dylib, libprism_sw.dylib, libglass.dylib, libjavafx_font.dylib. So I copied those files from the javafx-sdk-11.0.1/lib into /Library/Java/JavaVirtualMachine/jdk-11.0.1.jdk/Contents/Home/lib and tried to run my .jar file again. Got new exception:
GLFactory.static - Platform: Mac OS X - not available: com.sun.prism.es2.MacGLFactory
java.lang.ClassNotFoundException: com.sun.prism.es2.MacGLFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:108)
at com.sun.prism.es2.GLFactory$FactoryLoader.run(GLFactory.java:100)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.prism.es2.GLFactory.<clinit>(GLFactory.java:97)
at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:76)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.ClassNotFoundException: com.sun.glass.ui.mac.MacPlatformFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
at com.sun.glass.ui.Application.run(Application.java:144)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:258)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Failed to load Glass factory class
Exception in thread "main" java.lang.NullPointerException
at com.sun.glass.ui.Application.run(Application.java:144)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:258)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
This didn't fix the problem. If you need more information please request.
What else should I try?

If you have downloaded the jar from the first test release, when running it like:
java -jar SQLChecker-1.0.jar
you will get the posted exception.
As a first easy fix, if you have downloaded JavaFX 11 SDK, run this instead:
java --module-path /path-to/javafx-sdk-11/lib --add-modules javafx.controls,javafx.fxml -jar SQLChecker-1.0.jar
You can read about why you need those VM arguments here.
In any case, you shouldn't copy the native files from the JavaFX SDK to the JDK.
New releases
But there are two more new releases of SQLChecker.
If you try the last one:
java -jar SQLChecker-1.0.3.jar
that will work fine, without adding those extra arguments.
So what has changed?
They are distributing a fat Jar with the Maven shade plugin, and in order to work on JavaFX 11 on any platform, you need to include not only the jars, but also the native libraries.
As you can see, in this commit, by including the classifier tag for javafx.graphics, they added the required native libraries for Windows, Linux and Mac, as it has been also stated in this question.
If you want to know more about how to create a fat jar, see this doc.

Related

Running .jar with CLI

I am trying to export a runnable .jar file however I am faced with the following problems:
"VM arguments will not be part of the runnable JAR. Arguments can be passed on the command line when launching the JAR"
I ignored the warning and hit finish to create the runnable .jar file. When I double click it doesn't work.
I ran the following code in my command line:
**java -jar C:\path\file.jar --module-path "C:\pathtofxsdk11\lib" --add-modules javafx.controls,javafx.fxml,javafx.base,javafx.swing, javafx.graphics**
After which, I received the following error:
Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
... 1 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:830)
I need help with creating the executable Jar.
The options you provided in the command line are in the wrong order. Anything supplied after the name of the jar file (or the main class, if you are not using the -jar option) will be interpreted as an argument to your Java application (as opposed to an argument to the JVM), and passed to the string array in the
public static void main(String[])
method in the main class.
Thus you should use
java --module-path "C:\pathtofxsdk11\lib" --add-modules javafx.controls,javafx.fxml,javafx.base,javafx.swing,javafx.graphics -jar C:\path\file.jar
Note that this doesn't mean the jar file can be used as an "executable jar" that can simply be run on any system, because the JavaFX runtime is not included in the standard Java runtime from version 11 onwards. Instead, you can use the jpackage tool, which is included in JDK 14, to create a native installer bundle. This bundle will include a Java runtime, which you can configure to include JavaFX.
You should first download and unzip the modular version of JavaFX (the "jmods") from here.
Then your jpackage command looks something like the following:
jpackage --module-path "C:\pathtofxmods" --add-modules javafx.controls,javafx.fxml,javafx.swing --input "C:\path" --main-jar file.jar --type exe --name MyApp --dest "C:\path\to\generated\executable"
where C:\pathtofxmods is the library you unzipped in the previous step: it should include a collection of *.jmod files. This will generate an .exe file in C:\path\to\generated\executable which will install the application on a windows system. You can distribute this - note the end users do not even need a JRE, as this will bundle a JRE with the package.
You can also run jlink independently to create the JRE (with JavaFX) that is bundled with the application. See a full tutorial and the full tool documentation.

How to solve "Graphics Device initialization failed for : d3d, sw" when running a java Jar file with JavaFx

Good Afternoon everyone.
I'm having a problem when I try to run my Java Code as a Runnable Jar file. I'm using Eclipse and I created a normal Java Project. I included the JavaFX jars as a User Libary. The Program runs without a problem when I start it with the IDE. To create the Jar file I use the the build in Export of a Java Project in the Runnable Jar file.
When I check "Extract required libaries into generated JAR" and run it, I get this Error Message:
Error: JavaFX runtime components are missing, and are required to run this application
When I check "Package required libaries into generated JAR" and run it, I get this Error Message:
Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:244)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
... 1 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:835)
Does anyone know, why I cannot run the JAR but in the IDE it runs normally?
I installed JavaFX following the Documentation here https://openjfx.io/openjfx-docs/ .
I found a solution to my Problem. When I Export the Libaries into the Generated Jar I got the Error that the JavaFX Runtime components are missing. I now remembered that I got the same Error in Eclipse before although there was no Error in the Code and I used JavaFX elements. But to get it up and running I had to add VM Arguments. So I only had to write this in the command promt when I wanted to run the program.
Assuming you already are in the directory of your build Jar file:
java --module-path "C:\Path\to\javafx-sdk-13.0.2\lib" --add-modules javafx.controls,javafx.fxml -jar YourJar.jar
It's working now for me. Hope it will help others too.
Best Wishes
Check your built jar file manifest file to see what are its dependencies. There will be an variable called Class-path:
U can do this by right clicking on the jar file and opening with winrar or normal explorer META.INF
If they all begin with libs/ then create an libs folder where your built jar file is located and copy all javafx specified jar files into that folder and then execute

How do I troubleshoot the installation of Apache Accumulo on Linux?

I am trying to install open source Accumulo on RHEL 7.x. I have two GB of swap space. I have installed Java 1.8, Hadoop 3, and Zookeeper. I have run the bootstrap_config.sh script for Accumulo 1.9.2.
I ran this (and expected it to work):
/bin/accumulo-1.9.2/bin/accumulo init
But I get this error:
[start.Main] ERROR: Uncaught exception
java.util.ServiceConfigurationError:
org.apache.accumulo.start.spi.KeywordExecutable: Provider
org.apache.accumulo.proxy.Proxy could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.apache.accumulo.start.Main.checkDuplicates(Main.java:237)
at org.apache.accumulo.start.Main.getExecutables(Main.java:228)
at org.apache.accumulo.start.Main.main(Main.java:84) Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/configuration/Configuration
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 5 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.Configuration
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.apache.accumulo.start.classloader.AccumuloClassLoader$2.loadClass(AccumuloClassLoader.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more
I used the Accumulo bootstrap_config.sh script to configure Hadoop version 3. How do I get "/bin/accumulo-1.9.2/bin/accumulo init" to work?
Accumulo 1.9.2 expects Hadoop 2 out of the box, but does have a build profile to rebuild a tarball specifically for use with Hadoop 3. You can build Accumulo with the Hadoop 3 profile by downloading the source tarball and doing:
mvn clean package -Dhadoop.profile=3 -DskipTests
If you're not interested in rebuilding from source, it may be possible to simply fix the class path issues by reading the error message, and adjusting your class path accordingly. In this case, it seems you're missing a commons-configuration jar.

Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

What version of gRPC are you using?
1.13.1
I am using java 8 to build an executable jar. Below is the java version:
$ /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2~14.04-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
I am using gradle 3.4.1 to generate the jar as follows:
/opt/gradle-3.4.1/bin/gradle jar -Dorg.gradle.java.home=/usr/lib/jvm/java-1.8.0-openjdk-amd64/
Below are the dependencies defined in the module-level build.gradle file:
dependencies {
compile files("$TOOLCHAIN_VERSION_DIR/lib/commons-io-2.6.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/grpc-all.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/java-protobuf.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/jetty.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/log4j-core-2.8.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/log4j-slf4j-impl-2.8.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/netty-tcnative-boringssl-static-2.0.20.Final.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/netty-tcnative-2.0.20.Final.jar")
compile files("$TOOLCHAIN_VERSION_DIR/lib/picocli-3.8.2.jar")
compile group: 'com.google.guava', name: 'guava', version: '20.0'
compile files("$TOOLCHAIN_VERSION_DIR/lib/javassist-3.19.0-GA.jar")
compile project(':annotation')
}
After building, I am running the jar on an AIX7.2 machine as follows:
/usr/java8_64/jre/bin/java -jar agent-1.0.jar
The java version on the AIX machine is as follows:
$ /usr/java8_64/jre/bin/java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 8.0.5.26 - pap6480sr5fp26-20181115_03(SR5 FP26))
IBM J9 VM (build 2.9, JRE 1.8.0 AIX ppc64-64-Bit Compressed References 20181106_401576 (JIT enabled, AOT enabled)
OpenJ9 - fde1d6f
OMR - d8c3617
IBM - 5c4a9f0)
JCL - 20181022_01 based on Oracle jdk8u191-b26
But I am getting the following error while running:
Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
INFO: netty-tcnative unavailable (this may be normal)
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_aix_ppc_64, netty_tcnative_ppc_64, netty_tcnative]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:93)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:430)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:97)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:242)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
at com.ankit.agents.AgentMain.main(AgentMain.java:132)
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_aix_ppc_64
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
... 9 more
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_aix_ppc_64.a
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_aix_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_aix_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
at java.security.AccessController.doPrivileged(AccessController.java:647)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
... 11 more
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_ppc_64
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
... 9 more
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_ppc_64.a
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_ppc_64 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
at java.security.AccessController.doPrivileged(AccessController.java:647)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
... 11 more
Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
... 9 more
Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative.a
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
... 10 more
Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
at java.lang.System.loadLibrary(System.java:565)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
at java.security.AccessController.doPrivileged(AccessController.java:647)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
... 11 more
Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
INFO: Conscrypt not found (this may be normal)
Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
INFO: Jetty ALPN unavailable (this may be normal)
java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.ALPN
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:403)
at io.grpc.netty.JettyTlsUtil.isJettyAlpnConfigured(JettyTlsUtil.java:64)
at io.grpc.netty.JettyTlsUtil.getJettyAlpnUnavailabilityCause(JettyTlsUtil.java:75)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:255)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
at com.ankit.agents.AgentMain.main(AgentMain.java:132)
Exception in thread "main" java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:256)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
at com.ankit.agents.AgentMain.main(AgentMain.java:132)
However, it is running fine on an Ubuntu machine. I am running the jar as follows:
/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -jar agent-1.0.jar
The java version here is:
$ /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2~14.04-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
What is the problem here and how to solve this?
It could be that: https://github.com/grpc/grpc-java/blob/master/SECURITY.md#tls-with-netty-tcnative-on-boringssl
I added runtime 'io.netty:netty-tcnative-boringssl-static:2.0.25.Final' in my build.gradle and it worked
I have answered this in another similar question also, this issue can also be because of alpine base image incompaitibility if you are using it.
"Looks like you are using base image as alpine, which actually doesn't supports gRPC, you need to add the gcompact apk in your application. So, what you can do is : Using docker :"
RUN apk add gcompat
ENV LD_PRELOAD=/lib/libgcompat.so.0
In my case, just updating the Java version from 8 to 14 solved the issue (version 11 should also be fine).
If you are on Intellij, make sure your version change worked properly.

Signapk.jar giving error java.lang.ClassNotFoundException: sun.misc.BASE64Encoder

I have tried to make my app system app and i converted successfully on my windows machine but when I tried to run following same command on mac machine it kept on giving error. I have downloaded signapk.jar from different sources as well not able to run the command.
java -jar signapk.jar platform.x509.pem platform.pk8 device-owner.apk device-owner_sign.apk
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
at com.android.signapk.SignApk.addDigestsToManifest(SignApk.java:169)
at com.android.signapk.SignApk.main(SignApk.java:325)
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
Looks like the app you're trying to run isn't JDK 9 compatible.
Try again using Java SE 8.

Categories

Resources