[JBoss] Upgrading Java application to use ojdbc8 with JBoss EAP 7.0

Discussão em 'StackOverflow' iniciado por Stack, Setembro 9, 2024.

  1. Stack

    Stack Membro Participativo

    I'm in the process of upgrading my Java application to use the ojdbc8 driver with JBoss EAP 7.0. My current standalone.xml file is configured as follows:

    <datasources>
    <datasource jndi-name="java:/test1" pool-name="test1">
    <connection-url>jdbc:eek:racle:thin:mad:test.com:1521/ABC</connection-url>
    <driver>oracle</driver>
    <pool>
    <min-pool-size>0</min-pool-size>
    <max-pool-size>20</max-pool-size>
    </pool>
    <security>
    <user-name>username</user-name>
    <password>password</password>
    </security>
    <validation>
    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
    <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
    </validation>
    </datasource>
    <drivers>
    <driver name="oracle" module="oracle.jdbc">
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
    </driver>
    </drivers>
    </datasources>


    When I run standalone.bat with this configuration, everything works fine.

    However, after changing the driver configuration to use ojdbc8 like this:

    <datasources>
    <datasource jndi-name="java:/test1" pool-name="test1">
    <connection-url>jdbc:eek:racle:thin:mad:test.com:1521/ABC</connection-url>
    <driver>ojdbc8</driver>
    <pool>
    <min-pool-size>0</min-pool-size>
    <max-pool-size>20</max-pool-size>
    </pool>
    <security>
    <user-name>username</user-name>
    <password>password</password>
    </security>
    <validation>
    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
    <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
    </validation>
    </datasource>
    <drivers>
    <driver name="ojdbc8" module="com.oracle.ojdbc8">
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
    </driver>
    </drivers>
    </datasources>


    I encountered the following error messages:

    ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "test-app.war")]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./eb/policyservices" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./eb/policyservices: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'java:/test1'; nested exception is javax.naming.NameNotFoundException: test1 [Root exception is java.lang.IllegalStateException]
    Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'java:/test1'; nested exception is javax.naming.NameNotFoundException: test1 [Root exception is java.lang.IllegalStateException]
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'java:/test1'; nested exception is javax.naming.NameNotFoundException: test1 [Root exception is java.lang.IllegalStateException]
    Caused by: org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'java:/test1'; nested exception is javax.naming.NameNotFoundException: test1 [Root exception is java.lang.IllegalStateException]
    Caused by: javax.naming.NameNotFoundException: test1 [Root exception is java.lang.IllegalStateException]
    Caused by: java.lang.IllegalStateException"},
    "WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available." => {
    "Services that were unable to start:" => ["jboss.deployment.unit.\"test-app.war\".deploymentCompleteService"],
    "Services that may be the cause:" => ["jboss.jdbc-driver.ojdbc8"]

    ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "test1")
    ]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "org.wildfly.data-source.test1 is missing [jboss.jdbc-driver.ojdbc8]",
    "jboss.driver-demander.java:/test1 is missing [jboss.jdbc-driver.ojdbc8]"
    ]}


    I also checked that the directory $JBOSS_HOME/modules/com/oracle/ojdbc8/main/ contains ojdbc8.jar and module.xml.

    What might be going wrong and how do I resolve this issue?

    Continue reading...

Compartilhe esta Página