Running Eureka Client with JDK 1.7 - java

I am getting following error when running a eureka client discovery sample code.
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/netflix/servo/monitor/Monitors : Unsupported major.minor version 52.0
I guess this is probably due to the fact that eureka is compiled with Java 8 (52).
But does it mean that we can not use it with JDK 1.7 ? My project is in JDK7 and is it possible to run eureka(1) with JDK 1.7 ?

If you are running the official sample application use the correct dependencies, servo-core latest dependencies are compiled with JDK8, Use an older version
<dependency>
<groupId>com.netflix.servo</groupId>
<artifactId>servo-core</artifactId>
<version>0.10.0</version>
</dependency>

README.md says:
Building
The build requires java8 because of some required libraries that are
java8 (servo), but the source and target compatibility are still set
to 1.7.
Reference:
https://github.com/Netflix/eureka

Related

An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar

We have upgraded from 7.6>7.9>8.9>9.0.
And now we are facing the same issue,
plugin:3.9.0.2155:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar: java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I have gone through the documentation https://docs.sonarqube.org/latest/analysis/languages/java/#header-3, but how can we user sonar.java.jdkHome and where? And this jdk should be on jenkins slave or sonarqube server?
We dont use the sonarqube properties file, we have jenkins build where we have maven config and only sonar:sonar for scans. How can we manage this scenario.
Thanks in advance.
Since SonarQube 9.0 analysis must be done using JDK11. This is one of the breaking changes in 9.0, see official documentation.

JBoss Unsupported major.minor version 52.0

I have an application that needs to be deployed in JBoss 6.0.0 and I am using Eclipse Mars. My system variable points to Java 1.6, from build path I've selected Java 1.6 and also, JBoss is using Java 1.6. My problem is that when trying to deploy the app to JBoss the following error
[org.jboss.detailed.classloader.ClassLoaderManager] Unexpected error during load of:com.xservice.java.velocity.VelocityLoader: java.lang.UnsupportedClassVersionError: com/xservice/java/velocity/VelocityLoader : Unsupported major.minor version 52.0.
I don't have any idea how to handle this considering the given settings.
The problem was fixed by changing the Java version from Project Facets(it was 1.8 instead of 1.6). Thanks go to Sanjeev Saha.
Project facets screen
Please locate the Jar which contains the class com.xservice.java.velocity.VelocityLoader.
This class is compiled with JDK 8. The class file version for Java SE 8 is 52.0 as per http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html Your JVM is Java 6. You may not be able to run a Java class compiled with JDK 8.0 by JVM 6.0. This is the reason you are getting 'Unsupported major.minor version 52.0'
My suggestion is using a Jar which contains classes compiled by JDK 6.0.

Akka Hello World Problems - Unsupported major.minor version 52.0

I am trying to run this example using option 3. I think I was able to build the project using activator but failed when I tried to run it using ./activator run command. When trying to run this the console spits out this cryptic message that I would not find much information about on Google. Here is the error:[warn] Error reading API from class file : java.lang.UnsupportedClassVersionError: akka/actor/UntypedActor : Unsupported major.minor version 52.0
java.lang.UnsupportedClassVersionError: akka/actor/UntypedActor : Unsupported major.minor version 52.0
What does this mean?
I am using Java 7 JDK on a Linux Ubuntu laptop.
Regards,
This example contains a pom.xml so you can see which version of Akka is used: http://www.typesafe.com/activator/template/akka-sample-main-java?_ga=1.217401040.754558484.1443808082#code/pom.xml
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.11</artifactId>
<version>2.4.0</version>
</dependency>
Akka 2.4.0 requires Java 8: http://akka.io/news/2015/09/30/akka-2.4.0-released.html
dropped support for Java 6 & 7 as announced in the last roadmap
update, and now require Java 8 or later—this will allow us to create
modern idiomatic Java APIs over the course of the upcoming releases
Therefore it is not just this example which will not work. Any akka code which uses akka 2.4.0 will fail with your jdk.
However, these examples are stored in github under the akka project so you could clone from there and checkout an older version, which should work with your machine:
https://github.com/akka/akka/tree/v2.3.14/akka-samples/akka-sample-main-java
Your class is compiled for Java 8 (that's what version 52 means). You need to recompile (or find a precompiled version) for Java 7.

Maven-install Unsupported Class Version Error

I have cloned a Maven repository which I wish to use and build on my machine. I used to be able to build this particular project, but now when I choose maven install, it gives me this error
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
Which is really strange. I know that this maven project uses java 6, and it shows so in the pom.xml, but my machine already has java 6 installed. In fact, the project says it's using it. What's going on?
Although your project uses Java 6, Maven version 3.3.3 (latest at this time) needs Java 7.
Either use Maven 3.2.5 (that uses Java 6) or install Java 7.
Reference:
https://maven.apache.org/docs/history.html

Unsupported major.minor version 51.0 while executing JSP

I am trying to deploy my JSP and java files on the server. But when I try to access the jsp I get the error msg
javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: com/usct/db/DBConnect : Unsupported major.minor version 51.0
I read a few posts and found out that this is due to difference in Java version on the two different platforms but I am using JAVA 1.7 on my server and my client when I do
java -version
in my jdk/bin it shows that the java version is 1.7.0_10 and
Java SE Runtime Environment (build 1.7.0_10-b18)
Can someone please help me with this issue?
Thank you
... but I am using JAVA 1.7 on my server and my client when I do ...
The most likely explanation is that you are actually using Java 1.6 or earlier ... despite what you think. In other words, when you run java -version from the command-line, you are getting a different Java installation to the one that is being used to run your web container.
(If you are on a Linux system, you should be able to tell which JVM is being used by running ps -efl and greping for "java" or similar. Alternatively, use the approach suggested by #dbf.)
It is worth noting that the version of Java on the client is not relevant. The exception is occurring on the server side.
Reference: How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
- explains the general problem and solution.
java.lang.UnsupportedClassVersionError error occurs due to higher JDK during compile time and lower JDK during runtime.
Java Version Major Version
Java 4 48.0
Java 5 49.0
Java 6 50.0
Java 7 51.0
So if you compile your Java source file with javac of JDK 1.7 it will
create class files with major version 51.0 and if you run those class
files with Java 1.6 it will throw
java.lang.unsupportedclassversionerror unsupported major.minor version
51.0 error
Try Compiling with older JDK or Upgrade the JRE.
More more information visit.
I believe com/usct/db/DBConnect is not a class provided by Java. And hence the reason of your error is not the version of jdk and jre on both your coding and execution environment. It seems the jar you used for the class DBConnect on your client and environment are of different java versions.
Try to print System.getProperty("java.version") from your JSP to check what version is actually used by your server.

Categories

Resources