WildFly jdbc connection with Oracle

混江龙づ霸主 提交于 2019-12-10 18:45:42

问题


I try to create jdbc connection. I use WildFly Application Server
9.0.0.CR1 and oracle 11g. I put ojdbc14 and created module.xml in the folder C:\wildfly-9.0.0.CR1\modules\com\oracle\ojdbc14\main:

<?xml version="1.0" encoding="UTF-8"?> 
<module xmlns=xm lns="urn:jboss:module:1.0"" name="com.oracle.ojdbc14"> 
<resources> 
<resource-root path="ojdbc14.jar"/> 
</resources> 
<dependencies> 
<module name="javax.api"/> 
</dependencies> 
</module>

and inserted to the standalone.xml:

<subsystem xmlns="urn:jboss:domain:datasources:1.0">     
            <datasources>
             <datasource jndi-name="java:jboss/datasources/accounting" pool-name="OracleDS" enabled="true" use-java-context="true"> 
                <connection-url>jdbc:oracle:thin:@cmx-itm-03:1521/COREJAVA</connection-url> 
                <driver-class>oracle.jdbc.OracleDriver</driver-class> 
                <driver>oracle</driver> 
                <security> 
                <user-name>Java_Learning</user-name> 
                <password>Qazxsw123</password> 
                </security> 
            </datasource> 
            <drivers>
                <driver name="oracle" module="com.oracle.ojdbc14"/> 
            </drivers>
            </datasources>
        </subsystem>

So, I got the error when try test connection from console:

Unexpected HTTP response: 500

Request
{
    "address" => [
        ("subsystem" => "datasources"),
        ("data-source" => "OracleDS")
    ],
    "operation" => "test-connection-in-pool"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName: java:jboss/datasources/accounting",
    "rolled-back" => true
}

I googled it and tried all that I found but still have this error. Please, help me.


回答1:


This kind of failures are sometimes difficult to fix, because are exceptions from the own server. However check this, check your invalid jndiName in your code.

https://issues.jboss.org/browse/AS7-2199




回答2:


  1. I changed ojdbc14.jar to ojdbc6.jar;
  2. Locate module.xml with ojdbc6.jar to wildfly-home\modules\com\oracle\ojdbc\main;
  3. Change max-pool-size from 0 to 70.

So, it works



来源:https://stackoverflow.com/questions/31113695/wildfly-jdbc-connection-with-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!