NoClassDefFoundError sun/io/ByteToCharConverter with InterBase JDBC driver

后端 未结 7 1576
天命终不由人
天命终不由人 2020-12-02 00:22

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


        
相关标签:
7条回答
  • 2020-12-02 00:43

    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.

    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.

    0 讨论(0)
  • 2020-12-02 00:43

    I agree with Sergio, this is now an even older question! :-) But at my workplace, too, we are unfortunately as of 2018 for various reasons still using a super-old Interbase (v9, 2009). So at some point I too was unable to continue using the interclient.jar packaged with IBv9, because I would receive this same sun.io.ByteToCharConverter error. No doubt this was because the Java on my client machine was so much newer now. After all, it is 9 years later. But I did not want in my case to go with the solution of installing a legacy Java on my machine, as has worked for others.

    So as a solution, on my client machine (Linux/Debian x64), I installed Interbase 2017, the latest at the time(*). But when installing, I only installed the IB Client (not Server + Client). The /opt/interbase/lib/interclient.jar that is packaged with the IB 2017 client works just fine now (no sun.io error). And yes, this IB 2017 (v13) interclient.jar works just fine connecting to our old IB 2009 server.

    (I have to hand it to Embarcadero: They are still 'supporting' being able to connect to older versions -- at least in their interclient.jar and libgds.so. This makes sense as useful of course for those sysadmins who want to migrate from older systems to newer ones.)

    (*) You can get a free trial version of Interbase from embarcadero. As far as I can tell, though, when you install it, if you install the Client only and use the interclient.jar, this does not require a license. Only installing the IB server (and depending on number of users/connections, etc) but that is nothing new to IB users/admins.

    Works for us, at least, until we upgrade our server's IB version, or move to Firebird.

    Hope this helps at least one other person out there.

    0 讨论(0)
  • 2020-12-02 00:48

    This is an old question, but in case this helps someone:

    Find the Java 7 rt.jar in the lib folder. Open the file, and go to the folder sun/io.

    Find the Java 8 rt.jar in the lib folder. Open the file, and go to the folder sun/io.

    Move all the .class files in the folder sun/io from the Java 7 to the Java 8 sun/io folder, except for Win32ErrorMode.class (this class was in both jar files).

    Save the Java 8 rt.jar with the added classes.

    This worked for me, using an old jdbc driver for SQL Server.

    0 讨论(0)
  • 2020-12-02 00:54

    use

    <!-- https://mvnrepository.com/artifact/com.ibm.db2.jcc/db2jcc -->
            <dependency>
                <groupId>com.ibm.db2.jcc</groupId>
                <artifactId>db2jcc</artifactId>
                <version>db2jcc4</version>
            </dependency>
    

    replace

    <dependency>
                <groupId>com.ibm.db2.jcc</groupId>
                <artifactId>db2jcc</artifactId>
                <version>10.1</version>
            </dependency>
    

    can Solve the problem

    0 讨论(0)
  • 2020-12-02 01:01

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

    0 讨论(0)
  • 2020-12-02 01:04

    Use db2jcc4.jar which is latest version. If you changed your mind to use Java 8 you need to use this.

    I have the similiar problem and this change help me to fix the error.

    0 讨论(0)
提交回复
热议问题