schemaspy

Java Runtime Error with class file version error


I've downloaded just about every JDBC driver version I can find along with multiple versions of JAVA.

Everytime I try to run SchemaSpy I get the following error:

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver has been compiled by a more recent version of the Java Runtime (class file version 57.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(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.schemaspy.input.dbms.DbDriverLoader.getDriverClass(DbDriverLoader.java:170)
        at org.schemaspy.input.dbms.DbDriverLoader.getDriver(DbDriverLoader.java:144)
        at org.schemaspy.input.dbms.DbDriverLoader.getConnection(DbDriverLoader.java:93)
        at org.schemaspy.input.dbms.DbDriverLoader.getConnection(DbDriverLoader.java:75)
        at org.schemaspy.input.dbms.service.SqlService.connect(SqlService.java:70)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:220)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:123)
        at org.schemaspy.cli.SchemaSpyRunner.runAnalyzer(SchemaSpyRunner.java:98)
        at org.schemaspy.cli.SchemaSpyRunner.run(SchemaSpyRunner.java:87)
        at org.schemaspy.Main.main(Main.java:55)
        ... 8 mor

Any ideas on how to resolve this issue?


Solution

  • @texnoob I have seen this when trying to run SchemaSpy using an old database type. Try with -t mssql08 instead of -t mssql for later versions of SQL Server.

    Running SchemaSpy with the -dbhelp command line switch should return supported types, but it did not work for me. Another way to find the types is to open the SchemaSpy JAR file in an app that allows you to browse the archive (WinZip, WinRAR, etc.). Once open you will find the listed database types in the path "BOOT-INF\classes\org\schemaspy\types".

    If changing your database type still does not work, please provide the command line statement you are issuing for further analysis.