1

I am getting this error when I try to connect my java application to Apache Derby using hibernate.

Caused by: java.lang.UnsupportedClassVersionError: org/apache/derby/jdbc/EmbeddedDriver has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I have read everywhere that it could be because of the missing jars, but i have even added the below jars in the lib folder:

derby-10.15.2.0.jar
derbyclient-10.15.2.0.jar
derbynet-10.15.2.0.jar
derbyshared-10.15.2.0.jar
derbytools-10.15.2.0.jar

Below is my datasource connection variables:

database.url=jdbc:derby://opt/derby/sampleDerbyDB;create=true
database.driver=org.apache.derby.jdbc.ClientDriver (Also tried using EmbeddedDriver but same error)
hibernate.dialect=org.hibernate.dialect.DerbyDialect

Could you please tell me what is it that i am doing wrong? I want to keep using the same jre/java versions and wouldnt like to upgrade.

V.Bhanderi
  • 47
  • 8

1 Answers1

5

According to https://en.wikipedia.org/wiki/Java_class_file, the error that you encountered is because you are using Derby that compiled with Java 9 (class file version 53.0) and you are trying to run it in Java 8 (class file version 52) environment. Every java runtime able to run byte code update their supported version.

You can either upgrade your JDK/JRE to Java 9 and above or using the Derby that compatible with Java 8

MK Tan
  • 586
  • 1
  • 4
  • 12
  • Also, i would like to know if there exists any way to use mysql data-types in apache derby? – V.Bhanderi Dec 08 '20 at 08:12
  • This doesn't seem like related to this question. Perhaps create a new question in SO. Thanks – MK Tan Dec 08 '20 at 08:18
  • Sorry for that, have raise this new question : https://stackoverflow.com/questions/65196315/use-mysql-datatypes-in-apache-derby Can you please have a look at it? – V.Bhanderi Dec 08 '20 at 09:28