NoClassDefFoundError sun / io / ByteToCharConverter with InterBase JDBC driver

With InterClient 7.5.1 and 8.1.5, creating a new JDBC connection in Java 8 fails with

java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter 

This class appears to be referenced or used by the JDBC InterClient library. The error does not occur with Java 7. Is there a way around this error?


This code reproduces the problem in Java 8:

 package com.example.so25365952; import java.sql.DriverManager; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; public class Main { interbase.interclient.Connection conn; public static void main(String[] args) { try { Class.forName("interbase.interclient.Driver"); DriverManager.getConnection("jdbc:interbase://localhost/data/mydb.gdb", "sysdba", "password123"); } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } 

Output:

An exception was thrown in the main thread java.lang.NoClassDefFoundError: sun / io / ByteToCharConverter on interbase.interclient.Connection.connect (Unknown source) in interbase.interclient.Connection. (Unknown source) in interbase.interclient.Driver.connect (Unknown source) in java.sql.DriverManager.getConnection (DriverManager.java:664) in java.sql.DriverManager.getConnection (DriverManager.java:247) in com.example .so25365952.Main.main (Main.java:14) Raised: java.lang.ClassNotFoundException: sun.io.ByteToCharConverter at java.net.URLClassLoader $ 1.run (URLClassLoader.javahaps72) in java.net.URLClassLoader $ 1. run (URLClassLoader.javahaps61) in java.security.AccessController.doPrivileged (native method) in java.net.URLClassLoader.findClass (URLClassLoader.javahaps60) in java.lang.ClassLoader.loadClass (ClassLoader.java:424) at sun.misc.Launcher $ AppClassLoader.loadClass (Launcher.java.308) at java.lang.ClassLoader.loadClass (ClassLoader.javahaps57) ... 6 more

+7
java java-8 jdbc interbase
source share
4 answers

Sun Packages * and sunw. * are internal and should not be used for this reason. Someone from InterClient seems to squint. I would advise you to contact them with an error message, so they will know how to fix this for future releases.

If you can’t wait for a future release and are ready to break some licenses (which I certainly do not recommend). You can create your own sun.io.ByteToCharConverter by copying the code from here and adding it to the bootstrap class path using -Xbootclasspath , but this will be the last thing.

+5
source share

sun.io.ByteToCharConvertor was deprecated in java 7. and it seems like it removes it in java 8.

+3
source share

use db2jcc4.jar, which is the latest version. if you change your mind about using Java8, you need to use this. I have a problem with similirar and this change helps me fix the error.

+3
source share

The answer to the question interbase.interclient.UnlicensedComponentException with the latest interclient.jar IB (v7.5.80) seems to work for me too. He suggests using version 1.5 of the JDBC driver for Firebird. Fortunately, this driver does not rely on outdated classes of solar panels and works with JRE 8.

+1
source share

All Articles