我在jboss / modules / company / jdbc / other中使用第三方jdbc jar(drill-jdbc-all-1.13.jar),其中包含module.xml:
<module xmlns="urn:jboss:module:1.3" name="vermilion.jdbc.others" slot="main">
<resources>
<resource-root path="drill-jdbc-all-1.13.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="sun.jdk"/>
<module name="org.apache.commons.collections"/>
</dependencies>
</module>
但是,当我使用连接字符串调用驱动程序时,它似乎给我一个冲突,出现以下错误:
WARN 2018-05-02 12:09:57,467(com.vermilionsoftware.vrs.common.biz.db.DGSFactory:109)无法获得数据库连接:java.lang.ClassCastException:__redirected .__ DocumentBuilderFactory无法转换为javax.xml.parsers.DocumentBuilderFactory中
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2516)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2492)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2405)
at org.apache.hadoop.conf.Configuration.set(Configuration.java:1143)
at org.apache.hadoop.conf.Configuration.set(Configuration.java:1115)
at oadd.org.apache.drill.exec.rpc.security.kerberos.KerberosFactory.createAndLoginUser(KerberosFactory.java:59)
at oadd.org.apache.drill.exec.rpc.user.UserClient.authenticate(UserClient.java:219)
at oadd.org.apache.drill.exec.rpc.user.UserClient.connect(UserClient.java:155)
at oadd.org.apache.drill.exec.client.DrillClient.connect(DrillClient.java:432)
at oadd.org.apache.drill.exec.client.DrillClient.connect(DrillClient.java:379)
at org.apache.drill.jdbc.impl.DrillConnectionImpl.<init>(DrillConnectionImpl.java:158)
at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:72)
at org.apache.drill.jdbc.impl.DrillFactory.newConnection(DrillFactory.java:69)
at oadd.org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:143)
at org.apache.drill.jdbc.Driver.connect(Driver.java:72)
Hadoop中的Configuration.java调用DocumentBuilderFactory.newInstance()而不指定任何jaxp实现,因此它使用应用程序类加载器创建实例,而不是加载Configutaion.java类的类加载器。
有人可以帮助我如何解决这个错误?
由于
答案 0 :(得分:1)
我认为问题不在于您的JAXP实施没有被使用,而是您包含了JAXP API,这是不允许的。您应该确保drill-jdbc-all-*.jar
不包含javax.xml
类。
通常这样的ClassCastException
表示重复的API JAR。