oracle 如何在Wildfly25中找到并安装缺少的类

qco9c6ql  于 2023-04-20  发布在  Oracle
关注(0)|答案(1)|浏览(111)

我尝试使用kerberos为oracle数据源(ojdbc 8)配置wildfly/jboss服务器。kerberos部分工作正常,但是,当到达oracle侦听器时,我在wildfly中获得异常:

2023-04-12 19:07:19,152 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.PoolBySubject] (management-handler-thread - 1) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection

(...)
Caused by: java.lang.ClassNotFoundException: com.sun.security.jgss.ExtendedGSSContext from [Module "oracle.driver" from local module loader @53f48368 (finder: local module finder @24d4d7c9 (roots: /opt/wildfly-25.0.1.Final/modules,/opt/wildfly-25.0.1.Final/modules/system/layers/base))]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)

我无法在wildfly文件夹树中找到该类,也不知道在哪里可以找到/下载该类。请注意,我对java知之甚少
根据我的理解,java自带了一些“原生”类,所以我尝试安装不同的java 11版本(oracle,amazon,openjdk)并执行“java -verbose”来识别该包/模块。但是我没有成功。我在jboss树中找到一个引用该包/模块的文件:
/opt/wildfly-25.0.1.Final/modules/system/layers/base/sun/jdk/main/module.xml

<module name="sun.jdk" xmlns="urn:jboss:module:1.6">
    <properties>
        <property name="jboss.api" value="deprecated"/>
    </properties>

    <resources>
        <!-- currently jboss modules has not way of importing services from
        classes.jar so we duplicate them here -->
        <resource-root path="service-loader-resources"/>
    </resources>
    <dependencies>
        <module name="sun.scripting" export="true"/>
        <system export="true">
            <paths>

                <!-- See below for replacement modules -->

                <!-- Internal to java.base -->

                <path name="com/sun/net/ssl/internal/ssl"/>
                <path name="com/sun/crypto/provider"/>
                <path name="sun/security/action"/>

(...)

                <!-- Module jdk.security.jgss -->

                <path name="com/sun/security/jgss"/>

(...)

有什么解决办法吗?
谢啦

x8goxv8g

x8goxv8g1#

最后我自己解决了问题
我编辑了jdbc module.xml文件,添加了“sun.jdk”模块作为依赖项:

cat /opt/wildfly-25.0.1.Final/modules/system/layers/base/com/oracle/main/module.xml

<module xmlns="urn:jboss:module:1.1" name="com.oracle">
  <resources>
    <resource-root path="ojdbc11.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
    <module name="sun.jdk"/>
  </dependencies>
</module>

我不知道为什么没有描述这个依赖关系。之后我能够成功连接

/opt/jboss/bin/jboss-cli.sh --connect '/subsystem=datasources/data-source=KerberosDS:test-connection-in-pool'
{
    "outcome" => "success",
    "result" => [true]
}

相关问题