在Idea J

时间:2017-11-15 21:06:41

标签: java sql-server intellij-idea intellij-14

我正在使用Microsoft SQL Server IDE中的Data Source and Drivers对话框创建新的Intelli J Idea Ultimate 2017.2数据源

点击Test Connection按钮后输入所有必需值后,会显示Failed消息,错误如下所示。

  

java.lang.ClassNotFoundException:javax.xml.bind.DatatypeConverter         在jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)         在jdk.internal.loader.ClassLoaders $ AppClassLoader.loadClass(ClassLoaders.java:185)         at java.lang.ClassLoader.loadClass(ClassLoader.java:496)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4098)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3160)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.access $ 100(SQLServerConnection.java:43)         在com.microsoft.sqlserver.jdbc.SQLServerConnection $ LogonCommand.doExecute(SQLServerConnection.java:3123)         在com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1981)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)         在com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)         在com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168)         在com.intellij.database.remote.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:27)         at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)         at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         在java.lang.reflect.Method.invoke(Method.java:564)         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:355)         at sun.rmi.transport.Transport $ 1.run(Transport.java:200)         at sun.rmi.transport.Transport $ 1.run(Transport.java:197)         at java.security.AccessController.doPrivileged(Native Method)         at sun.rmi.transport.Transport.serviceCall(Transport.java:196)         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)         at sun.rmi.transport.tcp.TCPTransport $ ConnectionHandler.run0(TCPTransport.java:800)         at sun.rmi.transport.tcp.TCPTransport $ ConnectionHandler.lambda $ run $ 0(TCPTransport.java:682)         at java.security.AccessController.doPrivileged(Native Method)         at sun.rmi.transport.tcp.TCPTransport $ ConnectionHandler.run(TCPTransport.java:681)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)         at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:641)         在java.lang.Thread.run(Thread.java:844)(没有堆栈跟踪)。       java.lang.NoClassDefFoundError:javax / xml / bind / DatatypeConverter

我使用sqljdbc42驱动程序进行连接。我还将CLASSPATH环境变量设置为sqljdbc42-4.2.jar文件的位置。

enter image description here

知道什么可能是错的?

1 个答案:

答案 0 :(得分:1)

Microsoft JDBC Driver需要额外的依赖关系,即javax.xml.bind.api

这是您需要添加到pom.xml的maven依赖项:

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>

您可以从here下载必要的jar文件,并将其添加到IntelliJ类路径。