具有InterBase JDBC驱动程序的NoClassDefFoundError sun / io / ByteToCharConverter [英] NoClassDefFoundError sun/io/ByteToCharConverter with InterBase JDBC driver

查看:1522
本文介绍了具有InterBase JDBC驱动程序的NoClassDefFoundError sun / io / ByteToCharConverter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用InterClient 7.5.1和8.1.5,在Java 8中创建新的JDBC连接失败,

With InterClient 7.5.1 and 8.1.5, the creation of a new JDBC connection in Java 8 fails with

java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter

此类似乎被InterClient引用或使用JDBC库。
Java 7不会发生错误。有没有办法解决这个错误?

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

这个代码重现了Java 8上的问题:

This code reproduces the problem on 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);
        }
    }
}

输出:


线程main中的异常java.lang.NoClassDefFoundError:
sun / io / ByteToCharConverter at
interbase.interclient.Connection。连接(未知来源)
interbase.interclient.Connection。(未知来源)
interbase.interclient.Driver.connect(未知来源)at
java.sql.DriverManager.getConnection(DriverManager) .java:664)
java.sql.DriverManager.getConnection(DriverManager.java:247)at
com.example.so25365952.Main.main(Main.java:14)引起:
java.lang.ClassNotFoundException:
的sun.io.ByteToCharConverter java.net.URLClassLoader $ 1.run(URLClassLoader.java:372)
java.net.URLClassLoader $ 1.run(URLClassLoader.java) :361)at
java.security.AccessController.doPrivileged(Native Method)at
java.net.URLClassLoader.findClass(URLClassLoader.java:360)at
java.lang.ClassLoader.load Class(ClassLoader.java:424)at
sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)at
java.lang.ClassLoader.loadClass(ClassLoader.java:357).. .6 more

Exception in thread "main" java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter at interbase.interclient.Connection.connect(Unknown Source) at interbase.interclient.Connection.(Unknown Source) at interbase.interclient.Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at com.example.so25365952.Main.main(Main.java:14) Caused by: java.lang.ClassNotFoundException: sun.io.ByteToCharConverter at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more


推荐答案

太阳。*和sunw。*包是内部的,不应该正是出于这个原因才被使用。好像InterClient的某个人搞砸了。我建议你用错误报告联系他们,这样他们就会知道为将来的版本解决这个问题。

The sun.* and sunw.* packages are internal and should not be used for exactly this reason. Seems like someone at InterClient screwed up. I'd advise you to contact them with a bug report, so they'll know to fix this for future releases.

如果你不能等待将来的发布,并且愿意打破一些许可证(我当然不推荐)。您可以通过复制这里,并使用 -Xbootclasspath 将其添加到bootstrap类路径中,但这将是不得已。

If you can't wait for a future release, and are willing to break some licences (which I don't recommend of course). You may be able to create your own sun.io.ByteToCharConverter by copying the code from here, and adding it to the bootstrap classpath with -Xbootclasspath, but that would be a last resort.

这篇关于具有InterBase JDBC驱动程序的NoClassDefFoundError sun / io / ByteToCharConverter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆