Is V3 Identity Authentication compatible with JDK 1.6? If yes, which and how should I make use of it? - openstack

I am just wondering if the OSFactory.builderV3() method can run on JDK 1.6.
It returns the following error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openstack4j/openstack/OSFactory : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at Test.main(Test.java:9)
I do know there is a Jersy2JDK1.6 connector works on Keystone V2, like:
org.pacesys
openstack4j-core
3.0.0
org.pacesys.openstack4j.connectors
openstack4j-jersey2-jdk1.6
3.0.0
but in terms of my project, it requires V3 Authentication.

The problem is actually a Java problem. You are trying to run code that was built for JDK 1.8 or later on a JDK 1.6 platform. That won't work. The JDK 1.6 JVM does not understand that version of the bytecode.
In theory, you could try downloading the sourcecode for the library and its dependencies, and building them with a JDK 1.6 compiler / tool-chain. HOWEVER, that will only work if the library and its dependencies are fully Java 6 compatible; i.e. both in terms of source code syntax AND use of the standard Java SE APIs.
In this case, I think it is highly unlikely that that will work. According to the README.md file in the OpenStack4j Github repo:
Requirements
OpenStack4j 3.0.X - Java 7 (JDK 8 preferred)
OpenStack4j 2.0.X - Java 7
The best solution is to upgrade to Java 8. Java 6 was EOL'ed in April 2013.
There is a saying:
"The most important thing to do if you are in a hole is to stop digging."
A dev't project that is stuck on Java 6 is in a hole.

Related

URLClassLoader and Multi-release jar

I use the URLClassLoader to dynamically load JDBC drivers into my application.
My application is compiled under OpenJDK15. I cannot upgrade since some drivers would get issues under higher versions.
One of the drivers is using truffle-api-22.2.0.jar, which has support for two Java versions:
truffle-api-22.2.0.jar\META-INF\versions\11 and 17
When the jar is loaded, I get this exception:
java.lang.UnsupportedClassVersionError: META-INF/versions/17/module-info has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 59.0
java.lang.UnsupportedClassVersionError: META-INF/versions/17/module-info has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 59.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:825)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:723)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:646)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:576)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at com.wisecoders.dbs.dbms.driver.model.a.a(DriverClassLoader.java:132)
at com.wisecoders.dbs.dbms.driver.model.a.b(DriverClassLoader.java:110)
at com.wisecoders.dbs.dbms.driver.model.a.a(DriverClassLoader.java:88)
at com.wisecoders.dbs.dbms.driver.model.a.a(DriverClassLoader.java:66)
at com.wisecoders.dbs.dbms.driver.model.a.<init>(DriverClassLoader.java:34)
I used:
urlClassLoader = new URLClassLoader( urlsArray, OneClassFromMyCode.class.getClassLoader() );
urlClassLoader.loadClass( className );
The URLClassLoader documentation states that this should work with multi-version jars.
Which could be the issue?

How do I fix the controlsfx demo program to initialize class org.controlsfx.glyphfont.FontAwesome?

The controlsfx JavaFX library has a demo program and some controls fail to run, such as List Selection View, or List Action View or BreadCrumbBar.
I re-tested this on a new Windows 10 PC, with JDK11 and Gradle 5.5 freshly installed. I downloaded the branch 9 .zip, verified that the module-info.java files are present, and entered
gradlew run
For the above mentioned examples, the console shows:
Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: Could not initialize class org.controlsfx.glyphfont.FontAwesome
at org.controlsfx.samples/org.controlsfx.samples.HelloListActionView.createActions(HelloListActionView.java:144)
at org.controlsfx.samples/org.controlsfx.samples.HelloListActionView.getPanel(HelloListActionView.java:63)
at org.controlsfx.fxsampler/fxsampler.SampleBase.buildSample(SampleBase.java:77)
at org.controlsfx.fxsampler/fxsampler.FXSampler.buildSampleTabContent(FXSampler.java:397)
at org.controlsfx.fxsampler/fxsampler.FXSampler.updateTab(FXSampler.java:305)
at org.controlsfx.fxsampler/fxsampler.FXSampler.changeSample(FXSampler.java:296)
at org.controlsfx.fxsampler/fxsampler.FXSampler.lambda$start$1(FXSampler.java:159)
JAVA_HOME is C:\Program Files\Java\jdk-11.0.3
gradle --version
------------------------------------------------------------
Gradle 5.5
------------------------------------------------------------
Build time: 2019-06-28 17:36:05 UTC
Revision: 83820928f3ada1a3a1dbd9a6c0d47eb3f199378f
Kotlin: 1.3.31
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 11.0.3 (Oracle Corporation 11.0.3+12-LTS)
OS: Windows 10 10.0 amd64
I'd like to take advantage of FontAwesome as well as the above mentioned controls.
I experimented with
JDK 11, 11.0.1, 11.0.2, 11.0.2
Gradle 5.2, 5.5
Command line
IntelliJ
Another PC I usually develop on
ControlsFX has a large number of external dependencies which are handled in the build.gradle file.
If your project does not use gradle to build the library, but instead it imports a .jar of it, then you should add all those options to the VM. To do that in IntelliJ, go to Edit Configuration, there you can find a VM options field.
You can try to copy and paste these options:
--add-exports=javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls --add-exports=javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls --add-exports=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls --add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls --add-exports=javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls --add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls --add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls --add-exports=javafx.base/com.sun.javafx.collections=org.controlsfx.controls --add-exports=javafx.base/com.sun.javafx.runtime=org.controlsfx.controls --add-exports=javafx.web/com.sun.webkit=org.controlsfx.controls --add-exports=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls
This worked for me. I was facing the same issue with ControlsFX 11.0, while using ListSelectionView.

Sonar : Fail to load plugin SonarPLSQL [plsql]

My SonarQube version is sonarqube-7.5 community edition.
Sonar Scanner version is sonar-scanner-3.3.0.1492-windows
I downloaded sonar-plsql-plugin-3.3.0.2273.jar and placed it in \sonarqube-7.5\extensions\plugins\ folder.
My operating system is Windows.
When I try to start SonarQube, I get the below exception in web.log file.
The PLSQL plugin which I am using is compatible with SonarQube 6.7+ and I am using version 7.5 (https://docs.sonarqube.org/display/PLUG/SonarPLSQL)
How could I resolve this issue and start the server?
2019.01.28 16:00:00 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2019.01.28 16:00:01 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Fail to load plugin SonarPLSQL [plsql]
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:82)
at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:586)
at org.sonar.server.platform.Platform.start(Platform.java:211)
at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:185)
at org.sonar.server.platform.Platform.access$500(Platform.java:46)
at org.sonar.server.platform.Platform$1.lambda$doRun$0(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
at org.sonar.server.platform.Platform$1.doRun(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/sonarsource/plugins/license/api/LicensedPluginRegistration
at com.sonar.plsql.plugin.PlSqlPlugin.define(Unknown Source)
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:72)
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.sonarsource.plugins.license.api.LicensedPluginRegistration
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
... 11 common frames omitted
2019.01.28 16:00:02 INFO web[][o.s.p.StopWatcher] Stopping process
Sonar PLSQL plugin is a commercial product. You cannot install it on SonarQube Community edition. You have to buy at least Developer edition. Read more at Plans & Pricing.

Unsupported Class Version Error

While trying to call an EJB made using NETbeans (using jdk1.7) from a client made using Eclipse IDE (using jdk1.6), I am getting following error-
Exception in thread "main" java.lang.UnsupportedClassVersionError: stateless/TestEjbRemote : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:688)
at com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:463)
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:414)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at Main.main(Main.java:19)
Any solution to this problem ?
Try to change the Target JRE version to 1.6 in Build Configuration.
Problem was- I was calling EJB,made using jdk1.7 from client, which was using jdk1.6. Switched the jdk1.7 to jdk 1.6, it worked. or one can switch jdk1.6 to 1.7, then also it would work.
Conclusion- u can call any EJB which is using either the same version or lower version of jdk as the caller.
I had the same problem but I was using textpad though. The solution was pretty simple. Try placing the class in conflict on a different location (a backup folder perhaps whatever) or you can just simply delete it as long as it doesn't exist on the same directory. Then try compiling the java file so you can have a new class built to your computer's specification. Try if it works for you coz it worked for me. :)
It's the second time I've had the issue, just change the build configuration of this project.
Right click your project name --> [properties] --> [java compiler] --> [Enable project specific settings] --> set [compiler compliance level] to 1.7
Eclipse has it's own compiler, no matter which version of javac(jdk) in you system,so you must configure the version of eclipse compiler firstly.
Reference: java.lang.UnsupportedClassVersionError: Bad version number in .class file?

tomcat eclipse mssql driver demanding Java 1.6

I started writing my servlet in Java 1.6 for tomcat 7, but then I later needed to roll back to Java 1.5 for tomcat 6. I'm using eclipse. For some reason though, when I try to run my servlet it gives me the following error:
SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Please use the JDBC 4 driver (sqljdbc4.jar) instead.
Jun 20, 2011 12:33:40 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Auth threw exception
java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Please use the JDBC 4 driver (sqljdbc4.jar) instead.
Now originally I had sqljdbc4.jar in my WEB-INF/lib directory but I swapped it out for sqljdbc.jar so that it would be 1.5 compatible. That's when I started getting the error. Hunting around in the properties panels, I saw that JVM 1.6 was still in the Build Path libraries so I deleted those. But now it can't find HTTPServlet!
I added back a servlet.jar file I had but it just gives me the "version 1.6 is not supported by this driver" message. Curiously, I also have to use the oracle jdbc driver for this servlet and it is not giving me these errors when I backgraded the project and the driver jar to the 1.5 compatible version.
How do I get the eclipse project to not think it is 1.6?
You may need to change the Java facet from 1.6 to 1.5:
Project properties → Project Facets → Java → 1.5

Resources