After installing JDK, unable to run .jar - java

During a course it was installed JDK on my computer in order to be able to run eXist database. After this, after executing the command java -jar fileName.jar I get 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: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.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)
Windows 10
java -version
openjdk version "12.0.2" 2019-07-16 OpenJDK Runtime Environment Adopt
OpenJDK (build 12.0.2+10) OpenJDK 64-Bit Server VM Adopt
OpenJDK (build 12.0.2+10, mixed mode, sharing)

From your log its clear that you'r using JDK-12, and it seems that your jar is developed with JDK-8 where this version of JDK contains the JavaFx library.
But Oracle is removing JavaFX from the JDK-11, so it is no longer present in the JDK-11+, instead you have two solutions :
use JDK-8 which contains this JavaFx,
or include the JavaFx package or dependency in your project check the link

I uninstalled JDK 12 (it was listed in the Apps as AdoptOpen... with no 'java' keyword), then installed both jdk8 and JRE 8. Now I can run both eXist database and the other .jar software (the developer told me that was indeed the issue with JavaFx.

Related

HIVE: Exception: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader using JDK8 on Mac

I have installed jdk8 and while running hive, I got the following information
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = f9b039ac-ca16-4fe1-ba61-aecb31e0462e
Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:413)
at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:389)
at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683)
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.apache.hadoop.util.RunJar.run(RunJar.java:323)
at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
I have tried the solutions in similar_question and similar_question , but I still got the same problem.
I have already set my jdk version to be jdk8:
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
I installed hadoop and hive using brew, and the corresponding versions are:
Hadoop 3.2.1
and
Hive 3.1.2
Git git://HW13934/Users/gates/tmp/hive-branch-3.1/hive -r 8190d2be7b7165effa62bd21b7d60ef81fb0e4af
Compiled by gates on Thu Aug 22 15:01:18 PDT 2019
From source with checksum 0492c08f784b188c349f6afb1d8d9847
How can I solve this problem?
I really have the same feeling as you. But if you don't give up, you will get it in the end. Good luck!
You can definitely find something helpful in this article
Hive : Exception.. class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader
it told us to set the correct configuration.
You have to make sure that you start your hadoop cluster before running hive and
also guarantee that all the services are running normally.
cd /usr/local/Cellar/hadoop/3.2.1/sbin/
./start-all.sh
above is the terminal shell code for you to start the hadoop
[important]
To make sure all the nodes are started well.
also you have to configure hadoop in Pseudo-distributed mode rather than
standalone mode.
If you can read chinese, below is also an useful article which helps me a lot.
https://www.jianshu.com/p/af8a50f5a653

java.lang.ClassNotFoundException: sun.reflect.ConstantPool while running cucumber features

I am using eclipse to run cucumber feature and I got this error.I have installed java 11.0.4.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by cucumber.runtime.java8.ConstantPoolTypeIntrospector (file:/Users/test1/.m2/repository/info/cukes/cucumber-java8/1.2.5/cucumber-java8-1.2.5.jar) to method java.lang.Class.getConstantPool()
WARNING: Please consider reporting this to the maintainers of cucumber.runtime.java8.ConstantPoolTypeIntrospector
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
Exception in thread “main” cucumber.runtime.CucumberException: Failed to instantiate class test.sample.cucumber.steps.TestAPISteps
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:47)
at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:33)
at cucumber.runtime.java.JavaBackend.buildWorld(JavaBackend.java:131)
at cucumber.runtime.Runtime.buildBackendWorlds(Runtime.java:141)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:38)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.runtime.Runtime.run(Runtime.java:122)
at cucumber.api.cli.Main.run(Main.java:36)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.reflect.InvocationTargetException
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:490)
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:41)
... 8 more
Caused by: java.lang.NoClassDefFoundError: sun/reflect/ConstantPool
at cucumber.runtime.java8.ConstantPoolTypeIntrospector.getGenericTypes(ConstantPoolTypeIntrospector.java:29)
at cucumber.runtime.java.Java8StepDefinition.getParameterInfos(Java8StepDefinition.java:54)
at cucumber.runtime.java.Java8StepDefinition.<init>(Java8StepDefinition.java:44)
at cucumber.runtime.java.JavaBackend.addStepDefinition(JavaBackend.java:162)
at cucumber.api.java8.En.Given(En.java:199)
at com.cbre.host.foodandbeverages.cucumber.steps.ProductStoreApiSteps.<init>(ProductStoreApiSteps.java:40)
... 13 more
Caused by: java.lang.ClassNotFoundException: sun.reflect.ConstantPool
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)
... 19 more
What could be the reason of this ?
This is happening only on my machine. On other machines, this issue is not replicated.
I have tried updating maven project. Tried and got the same issue on STS as well.
Both machine are having same java installed ..
java version "11.0.4" 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)
You are currently using Cucumber JVM 1.2.5. This version of Cucumber can't run on Java 9 or higher. You may want to consider upgrading.
The latest released version of Cucumber JVM is 4.8.0. Note that the groupId has changed from info.cukes to io.cucumber.
Your other machines must be running on java8. Your error trace is suggesting to use java8.
WARNING: Please consider reporting this to the maintainers of cucumber.runtime.java8.ConstantPoolTypeIntrospector

native library for attach API not available in this JRE

I am attempting to build a new project with gradle, junit, and jmock. When I run my build, I get this stack trace:
com.heavyweightsoftware.daybook.ws.TypeCodeWsTest STANDARD_ERROR
java.lang.IllegalStateException: Native library for Attach API not available
in this JRE
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.ru
nTestClass(JUnitTestClassExecuter.java:80)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.ex
ecute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.p
rocessTestClass(JUnitTestClassProcessor.java:64)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.process
TestClass(SuiteTestClassProcessor.java:50)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionD
ispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionD
ispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(Con
textClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocat
ionHandler.invoke(ProxyDispatchAdapter.java:93)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestCl
ass(TestWorker.java:106)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionD
ispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionD
ispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(Messa
geHub.java:360)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.
onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableE
xecutorImpl.java:40)
Caused by: java.lang.UnsatisfiedLinkError: no attach in java.library.path
... 14 more
Gradle Test Executor 1 finished executing tests.
com.heavyweightsoftware.daybook.ws.TypeCodeWsTest > testGetTypeCodes FAILED
java.lang.ExceptionInInitializerError
at com.heavyweightsoftware.daybook.ws.TypeCodeWsTest.testGetTypeCodes(Ty
peCodeWsTest.java:40)
Caused by:
java.lang.IllegalStateException: Native library for Attach API not avail
able in this JRE
at mockit.internal.startup.AgentLoader.getVirtualMachineImplementati
onFromEmbeddedOnes(AgentLoader.java:78)
at mockit.internal.startup.AgentLoader.loadAgent(AgentLoader.java:46
)
at mockit.internal.startup.Startup.verifyInitialization(Startup.java
:172)
at mockit.Invocations.<clinit>(Invocations.java:26)
... 1 more
Caused by:
java.lang.NoClassDefFoundError: Could not initialize class sun.tools
.attach.WindowsVirtualMachine
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unk
nown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at mockit.internal.startup.AgentLoader.getVirtualMachineImplemen
tationFromEmbeddedOnes(AgentLoader.java:70)
... 4 more
So I looked and found these questions: JMockit ERROR - Native library for Attach API not available in this JRE and jmockit: Native library for Attach API not available in this JRE error
And I've made the changes in eclipse, but this error happens even when running outside of eclipse and so it's not the eclipse settings.
Here's the output of java -version from the command prompt:
C:\Users\thom\git\daybook\WebServices>java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
This is part of gradle build --info:
Executing task ':test' (up-to-date check took 0.193 secs) due to:
Value of input property 'candidateClassFiles' has changed for task ':test'
Starting process 'Gradle Test Executor 1'. Working directory: C:\Users\thom\git\
daybook\WebServices Command: C:\java\bin\java.exe -Djava.security.manager=jarjar
.org.gradle.process.internal.child.BootstrapSecurityManager -Dfile.encoding=wind
ows-1252 -Duser.country=US -Duser.language=en -Duser.variant -ea -cp C:\Users\th
om\.gradle\caches\2.4\workerMain\gradle-worker.jar jarjar.org.gradle.process.int
ernal.launcher.GradleWorkerMain 'Gradle Test Executor 1'
Successfully started process 'Gradle Test Executor 1'
Gradle Test Executor 1 started executing tests.
Which tells me it's running java from c:\java\bin which is the right install. I looked and this directer has javac in it, which I think confirms that it's a JDK and not a JRE.
Any input, oh wise above wise?
I added c:\java\jre\bin to my path and the build started working again.

can't run griffon app

I am trying to run a test app in griffon. I can create the app, but when I go to run it I get the following error(s):
2013-01-25 11:12:02,352 [main] INFO griffon.swing.SwingApplication - Initializing all startup groups: [test1]
2013-01-25 11:12:05,702 [AWT-EventQueue-0] ERROR org.codehaus.griffon.runtime.builder.UberBuilder - An error occurred while building test1.Test1View#63935d75
java.lang.RuntimeException: Failed to create component for 'application' reason: java.awt.HeadlessException
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.invokeFactoryMethod(UberInterceptorMetaClass.groovy:97)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.this$3$invokeFactoryMethod(UberInterceptorMetaClass.groovy)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass$this$3$invokeFactoryMethod.callCurrent(Unknown Source)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.invokeMethod(UberInterceptorMetaClass.groovy:168)
at test1.Test1View.run(Test1View.groovy:11)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.invokeMethod(UberInterceptorMetaClass.groovy:152)
at org.codehaus.griffon.runtime.builder.UberBuilder.build(UberBuilder.groovy:160)
at org.codehaus.griffon.runtime.core.AbstractMVCGroup$1.run(AbstractMVCGroup.java:129)
Caused by: java.awt.HeadlessException
at griffon.swing.SwingUtils.createApplicationFrame(SwingUtils.java:133)
at griffon.swing.AbstractSwingGriffonApplication.createApplicationContainer(AbstractSwingGriffonApplication.java:99)
at griffon.core.GriffonApplication$createApplicationContainer.call(Unknown Source)
at griffon.swing.factory.ApplicationFactory.newInstance(ApplicationFactory.groovy:54)
... 8 more
2013-01-25 11:12:05,714 [main] ERROR griffon.util.GriffonExceptionHandler - Uncaught Exception
java.lang.RuntimeException: Failed to create component for 'application' reason: java.awt.HeadlessException
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.invokeFactoryMethod(UberInterceptorMetaClass.groovy:97)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.this$3$invokeFactoryMethod(UberInterceptorMetaClass.groovy)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass$this$3$invokeFactoryMethod.callCurrent(Unknown Source)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.invokeMethod(UberInterceptorMetaClass.groovy:168)
at test1.Test1View.run(Test1View.groovy:11)
at org.codehaus.griffon.runtime.builder.UberInterceptorMetaClass.invokeMethod(UberInterceptorMetaClass.groovy:152)
at org.codehaus.griffon.runtime.builder.UberBuilder.build(UberBuilder.groovy:160)
at org.codehaus.griffon.runtime.core.AbstractMVCGroup$1.run(AbstractMVCGroup.java:129)
Caused by: java.awt.HeadlessException
at griffon.swing.SwingUtils.createApplicationFrame(SwingUtils.java:133)
at griffon.swing.AbstractSwingGriffonApplication.createApplicationContainer(AbstractSwingGriffonApplication.java:99)
at griffon.core.GriffonApplication$createApplicationContainer.call(Unknown Source)
at griffon.swing.factory.ApplicationFactory.newInstance(ApplicationFactory.groovy:54)
... 8 more
Any insight you can give would be great.
My set up is:
Kubuntu Linux 12.10 64-bit
------------------------------------------------------------
Griffon 1.2.0
------------------------------------------------------------
Build: 11-Jan-2013 09:10 AM
Groovy: 2.0.6
Ant: 1.8.4
Slf4j: 1.7.2
Spring: 3.2.0.RELEASE
JVM: 1.7.0_09 (Oracle Corporation 23.2-b09)
OS: Linux 3.5.0-22-generic amd64
Thanks!!
ironmantis7x
As mentionioned in the docs at http://docs.oracle.com/javase/6/docs/api/java/awt/HeadlessException.html , this should be a problem with keyboard, mouse or display.
Assuming you did not force "-Djava.awt.headless=true", this is most likely caused by a missing connection to a X-server.
Type
echo $DISPLAY
in a terminal window. Usually this outputs ":0". Make sure that variable is set (happens automatically for terminal windows), and try starting a very basic X application, such as "xterm". If that works, the griffon app should launch and display.
Found it!!!
I needed to have the JRE installed and I didn't. It was looking for a dependency that I needed.

Sun.security cannot be found after upgrading Java

I have an application created with Play 2.0. I implemented scribe-java library to use some OAuth services. Until today everything was fine but when I upgrade jdk and reboot the server I couldn't use scribe-java library. It seems it uses some classes like sun/security/pkcs11/P11Key and sun/security/pkcs11/Length in sun.security package but couldn't find it.
"java -version" returns this:
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)
Play 2.0 stacktrace:
! #6bk5o8md2 - Internal server error, for request [GET /user/service/google/oauth_callback/?code=[SECRET]] ->
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NoClassDefFoundError: sun/security/pkcs11/P11Key]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.2]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.2]
at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.2]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
Caused by: java.lang.NoClassDefFoundError: sun/security/pkcs11/P11Key
at sun.security.pkcs11.P11ECKeyFactory.generatePublic(P11ECKeyFactory.java:234) ~[sunpkcs11.jar:na]
at sun.security.pkcs11.P11ECKeyFactory.implTranslatePublicKey(P11ECKeyFactory.java:103) ~[sunpkcs11.jar:na]
at sun.security.pkcs11.P11ECKeyFactory.engineGeneratePublic(P11ECKeyFactory.java:152) ~[sunpkcs11.jar:na]
at java.security.KeyFactory.generatePublic(KeyFactory.java:334) ~[na:1.7.0_03]
at sun.security.x509.X509Key.buildX509Key(X509Key.java:223) ~[na:1.7.0_03]
at sun.security.x509.X509Key.parse(X509Key.java:170) ~[na:1.7.0_03]
After another update && upgrade, jdk upgraded from 2.1.1pre to 2.3.2 and the problem fixed. What happened is that Oracle wasted my 2 hours, sucks. :(

Categories