NetSuite java.lang.NoClassDefFoundError:getConnection上的sun / io / MalformedInputException

时间:2014-10-21 16:24:25

标签: java jdbc netsuite

尝试使用DriverManager在java中连接时出现以下错误。我在网上搜索过,发现没有解决办法。有人可以告诉我出现以下错误的原因或解释如何解决它。

conn = DriverManager.getConnection(connectionString, login, password);

"C:\Program Files\Java\jdk1.8.0_20\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54111,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath "Z:\scripts\Local\NetSuite\bin;Z:\scripts\Local\NetSuite\lib\c3p0-0.9.5-pre8.jar;Z:\scripts\Local\NetSuite\lib\mchange-commons-java-0.2.7.jar;Z:\scripts\Local\NetSuite\lib\mysql-connector-java-5.1.23-bin.jar;Z:\scripts\Local\NetSuite\lib\NQjc.jar;Z:\scripts\Local\NetSuite\netsuite.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_20\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.5\lib\idea_rt.jar" connection.Main
Connected to the target VM, address: '127.0.0.1:54111', transport: 'socket'
Using connection string: jdbc:ns://odbcserver.na1.netsuite.com:1708;ServerDataSource=NetSuite.com;encrypted=1;CustomProperties=(AccountID=3650326;RoleID=3)
Exception in thread "main" java.lang.NoClassDefFoundError: sun/io/MalformedInputException
    at com.netsuite.oautil.UtilTransliterator.OptimizeNewTransliteratorUsingSunIO(Unknown Source)
    at com.netsuite.oautil.UtilTransliterator.OptimizeNewTransliteratorUsingVM(Unknown Source)
    at com.netsuite.oautil.UtilTransliterator.GetNewTransliterator(Unknown Source)
    at com.netsuite.oautil.UtilTransliterator.GetNewTransliterator(Unknown Source)
    at com.netsuite.openaccess.ssp.Ssp7.<init>(Unknown Source)
    at com.netsuite.openaccess.ssp.Ssp8.<init>(Unknown Source)
    at com.netsuite.openaccess.ssp.Ssp9.<init>(Unknown Source)
    at com.netsuite.openaccess.ssp.SspFactory.ProcessReply(Unknown Source)
    at com.netsuite.openaccess.ssp.SspFactory.GetSsp(Unknown Source)
    at com.netsuite.openaccess.ctxt.conn.ConnectionContext.doConnect(Unknown Source)
    at com.netsuite.openaccess.ctxt.conn.ConnectionContext.connect(Unknown Source)
    at com.netsuite.jdbc.openaccess.OpenAccessImplConnection.open(Unknown Source)
    at com.netsuite.jdbc.oabase.BaseConnection.connect(Unknown Source)
    at com.netsuite.jdbc.oabase.BaseConnection.setupImplConnection(Unknown Source)
    at com.netsuite.jdbc.oabase.BaseConnection.open(Unknown Source)
    at com.netsuite.jdbc.oabase.BaseDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at connection.DBNetSuite.<init>(DBNetSuite.java:59)
    at connection.DBNetSuite.getInstance(DBNetSuite.java:85)
    at connection.DBNetSuite.getTableName(DBNetSuite.java:110)
    at connection.Main.main(Main.java:12)
Caused by: java.lang.ClassNotFoundException: sun.io.MalformedInputException
    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)
    ... 22 more
Disconnected from the target VM, address: '127.0.0.1:54111', transport: 'socket'

Process finished with exit code 1

1 个答案:

答案 0 :(得分:1)

NetSuite库使用的异常不是Java API的一部分,但曾经是Sun / Oracle Java实现中内部类的一部分。由于该类不是API的一部分,Oracle(以及之前的Sun)可以自由删除它;他们做了什么。它不包含在Java 8 Update 25中;我不知道什么时候被删除了。

这是为什么不应该在应用程序中使用Java中包含的sun.*com.sun.*com.oracle.*个包中的类的原因之一,因为它们可能会发生变化,可以在任何时候删除。

如果他们有一个不使用此类的新驱动程序,你应该问NetSuite。