0

Right now, I am trying to connect to a database (MySQL) using Eclipse. Unfortunately, I can not start the server using Derby. I receive the following error message by Eclipse:

Cannot connect to MyDB/anonymous. Check your URL java.net.ConnectException : Error connecting to server localhost on port 1.527 with message Connection refused.

I already checked if I got two java version. Running the command:

java -version

returns: java version "1.8.0._301"

Running:

javac -version

returns: "The Operation couldn´t be completed. Unable to locate a Java Runtime that supports javac."

So there is only one Java Runtime installed. Digging a bit deeperm I tried to run the following code the start the server through my terminal:

export JAVA_HOME=/Library/Java/Home

then:

export DERBY_HOME=/Applications/db-derby-10.15.2.0-bin

followed by:

java -jar $DERBY_HOME/Applications/db-derby-10.15.2.0-bin/lib/derbyrun.jar start

When I run those commands the terminal tells me the following:

> Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/derby/drda/NetworkServerControl 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
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

Can somebody help me to start my server?

Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
  • 2
    Class file version 53 is Java 9, you need at least that to run that code. Note that Apache Derby is **not** [tag:mysql] that is a different product. – greg-449 Oct 12 '21 at 15:24

0 Answers0