postgres pgjdbc-ng-0.5-complete.jar 驱动程序异常 java.lang.ClassNotFoundException: javax.xml.bind.annotation.adapters.HexBinaryAdapter

postgres pgjdbc-ng-0.5-complete.jar driver exception java.lang.ClassNotFoundException: javax.xml.bind.annotation.adapters.HexBinaryAdapter

我正在尝试使用非官方驱动程序 pgjdbc-ng-0.5-complete.jar 使用 postgres9.4 EDB 在 JBOSS 上创建数据源,但遇到异常。

Caused by: java.sql.SQLException: Connection Error: java.lang.ClassNotFoundException: javax.xml.bind.annotation.adapters.HexBinaryAdapter from [Module "com.pgng.jdbc:main" from local module loader @83914b (finder: local module finder @1b80053 (roots: D:\jboss-eap-6.1\modules,D:\jboss-eap-6.1\modules\system\layers\base))]
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:189)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:77)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:52)
    at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254) [ironjacamar-jdbc-1.0.17.Final-redhat-1.jar:1.0.17.Final-redhat-1]
    ... 34 more
Caused by: java.io.IOException: java.lang.ClassNotFoundException: javax.xml.bind.annotation.adapters.HexBinaryAdapter from [Module "com.pgng.jdbc:main" from local module loader @83914b (finder: local module finder @1b80053 (roots: D:\jboss-eap-6.1\modules,D:\jboss-eap-6.1\modules\system\layers\base))]
    at com.impossibl.postgres.protocol.v30.ProtocolImpl.execute(ProtocolImpl.java:381)
    at com.impossibl.postgres.protocol.v30.ProtocolFactoryImpl.startup(ProtocolFactoryImpl.java:215)
    at com.impossibl.postgres.protocol.v30.ProtocolFactoryImpl.connect(ProtocolFactoryImpl.java:155)
    at com.impossibl.postgres.protocol.v30.ProtocolFactoryImpl.connect(ProtocolFactoryImpl.java:90)
    at com.impossibl.postgres.system.BasicContext.<init>(BasicContext.java:130)
    at com.impossibl.postgres.jdbc.PGConnectionImpl.<init>(PGConnectionImpl.java:185)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:180)
    ... 37 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.adapters.HexBinaryAdapter from [Module "com.pgng.jdbc:main" from local module loader @83914b (finder: local module finder @1b80053 (roots: D:\jboss-eap-6.1\modules,D:\jboss-eap-6.1\modules\system\layers\base))]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.0.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.0.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.0.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.0.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.0.Final-redhat-1]
    at com.impossibl.postgres.utils.MD5Authentication.encode(MD5Authentication.java:51)
    at com.impossibl.postgres.protocol.v30.StartupCommandImpl.authenticateMD5(StartupCommandImpl.java:126)
    at com.impossibl.postgres.protocol.v30.ProtocolImpl.receiveAuthentication(ProtocolImpl.java:891)
    at com.impossibl.postgres.protocol.v30.ProtocolImpl.dispatch(ProtocolImpl.java:774)
    at com.impossibl.postgres.protocol.v30.MessageHandler.channelRead(MessageHandler.java:46)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
    at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:111)
    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

请帮帮我。 需要使用 pgjdbc-ng-0.5-complete.jar driver

在 JBOSS EAP7 创建数据源

您似乎错过了 class 路径中的 javax.xml.bind.jar。 此文件包含 class javax.xml.bind.annotation.adapters.HexBinaryAdapter

将它添加到您的class路径,错误应该消失了。