Sun.security cannot be found after upgrading Java - 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. :(

Related

FTB Infinity Evolved server not starting with JDK 8

I have downloaded and unzipped the FTB Infinity server from CurseForge on my Arch Linux machine and run both the install and run scripts, and I am presented with this error:
Starting server
OpenJDK 64-Bit Server VM warning: ignoring option PermSize=256M; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release
A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at cpw.mods.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:43)
at cpw.mods.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:12)
Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Level
at net.minecraft.launchwrapper.Launch.launch(Launch.java:94)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Level
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 8 more
My directory listing:
changelogs FTBserver.jar ServerStart.sh
config libraries settings.bat
eula.txt minecraft_server.1.7.10.jar settings.sh
FTBInstall.bat modpack version.json
FTBInstall.sh mods
FTBServer-1.7.10-1614.jar ServerStart.bat
I looked at all of the questions online, and most of them said to install jdk 8, but I am already using it. Any ideas?
Okay, so this is pretty dumb of the install script. It downloaded an XML file saying that the jar could not be found instead of the actual jar. (laughs) I should probably report that.

SSL certificates execution in the JDK upgrade from 1.8.0_51 to 1.8.0_202

I am utilizing JDK version 1.8.0_51. Over here, I encountered the following error, while fetching the content via WebClient:
Caused by: java.io.IOException: HTTPS hostname wrong: should be <*.*.*>
at sun.net.www.protocol.https.HttpsClient.checkURLSpoofing(HttpsClient.java:653) ~[?:1.8.0_51]
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:577) ~[?:1.8.0_51]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) ~[?:1.8.0_51]
However, when I upgrade the JDK version to 1.8.0_202, the problem gets rectified.
When I place both the versions in debug mode to understand the library code, I see the peer certificates created in both the flows are different.
Can someone guide me why is 1.8.0_51 version causing the issue?

Java Mission Control 7 running on Java 11 cannot connect to Wildfly with "jmx:remoting-jmx" protocol

As far as I can tell, I am having the same issue described here:
https://developer.jboss.org/thread/278895
(That forum is closed and no additional comments are allowed, their recommendation is to post to SO)
I am trying to run JMC 7.1.2 on OpenJDK 64-Bit Server VM Corretto-11.0.8.10.1 (build 11.0.8+10-LTS, mixed mode) on my workstation and connect to a remote Wildfly server using the "jmx:remoting-jmx" protocol. This worked for years, but AFAICT does not work in the constellation Java-11 and JMC7.
There is no error about unknown protocol or similar
(Yes, I have already read and followed instructions in:
Connect Java Mission Control to Wildfly 16), but I get this error when connecting:
org.openjdk.jmc.rjmx.ConnectionException caused by javax.security.sasl.SaslException: org/ietf/jgss/GSSManager [Caused by java.lang.NoClassDefFoundError: org/ietf/jgss/GSSManager]
at org.openjdk.jmc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:441)
at org.openjdk.jmc.rjmx.internal.ServerHandle.doConnect(ServerHandle.java:116)
at org.openjdk.jmc.rjmx.internal.ServerHandle.connect(ServerHandle.java:106)
at org.openjdk.jmc.console.ui.editor.internal.ConsoleEditor$ConnectJob.run(ConsoleEditor.java:99)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: javax.security.sasl.SaslException: org/ietf/jgss/GSSManager [Caused by java.lang.NoClassDefFoundError: org/ietf/jgss/GSSManager]
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:426)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:242)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:599)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:561)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:549)
at org.jboss.remotingjmx.RemotingConnector.internalRemotingConnect(RemotingConnector.java:268)
at org.jboss.remotingjmx.RemotingConnector.internalConnect(RemotingConnector.java:156)
at org.jboss.remotingjmx.RemotingConnector.connect(RemotingConnector.java:103)
at org.openjdk.jmc.rjmx.internal.RJMXConnection.connectJmxConnector(RJMXConnection.java:487)
at org.openjdk.jmc.rjmx.internal.RJMXConnection.establishConnection(RJMXConnection.java:464)
at org.openjdk.jmc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:434)
... 4 more
Caused by: java.lang.NoClassDefFoundError: org/ietf/jgss/GSSManager
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
at java.base/java.lang.Class.getConstructor0(Class.java:3342)
at java.base/java.lang.Class.getConstructor(Class.java:2151)
at java.base/java.security.Provider.newInstanceUtil(Provider.java:153)
at java.base/java.security.Provider$Service.newInstance(Provider.java:1891)
at org.wildfly.security.WildFlyElytronBaseProvider$ProviderService.newInstance(WildFlyElytronBaseProvider.java:218)
at org.wildfly.security.sasl.util.SecurityProviderSaslClientFactory.createSaslClient(SecurityProviderSaslClientFactory.java:94)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.ProtocolSaslClientFactory.createSaslClient(ProtocolSaslClientFactory.java:50)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.ServerNameSaslClientFactory.createSaslClient(ServerNameSaslClientFactory.java:50)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.ServerNameSaslClientFactory.createSaslClient(ServerNameSaslClientFactory.java:50)
at org.wildfly.security.sasl.util.FilterMechanismSaslClientFactory.createSaslClient(FilterMechanismSaslClientFactory.java:102)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.LocalPrincipalSaslClientFactory.createSaslClient(LocalPrincipalSaslClientFactory.java:76)
at org.wildfly.security.sasl.util.PrivilegedSaslClientFactory.lambda$createSaslClient$0(PrivilegedSaslClientFactory.java:64)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.wildfly.security.sasl.util.PrivilegedSaslClientFactory.createSaslClient(PrivilegedSaslClientFactory.java:64)
at org.wildfly.security.auth.client.AuthenticationConfiguration.createSaslClient(AuthenticationConfiguration.java:1496)
at org.wildfly.security.auth.client.AuthenticationContextConfigurationClient.createSaslClient(AuthenticationContextConfigurationClient.java:408)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:420)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:242)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
If I use OpenJDK 8 with JMC 7 then it works (that is, I can connect and also read jfr files created with jdk11) but is that really the only way to get this configuration to work?

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

After installing JDK, unable to run .jar

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.

Categories