1

Goal

Add the Attunity Driver to the JBoss server so that the datasource can be created.

I assume that the error below is due to the driver not being loaded properly. The initialization of the datasource might fall due to network issues. I want to make sure that the driver is loaded properly and can be used by JBoss.

As seen in the Update-section at the end of this questions, plain JDBC connection attempts receive a Connection refused error. Should this lead to the error in the following Problem-section?

What is Attunity? - Attunity is a commercial driver which we use to create JDBC connections to COBOL systems. We do only use plain SQL on the created connections, not more. Attunity does not have support for hibernate ORM, but we don't use that anyway.

Problem

The following error occurs upon startup:

13:21:11,535|ERROR|Controller Boot Thread|org.jboss.as.controller.management-operation|JBAS014612: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "attunity-ds")
]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
    "jboss.driver-demander.java:jboss/datasources/attunity-ds [jboss.jdbc-driver.com_attunity_jdbc] is missing",
    "jboss.data-source.java:jboss/datasources/attunity-ds [jboss.jdbc-driver.com_attunity_jdbc] is missing"
]}

Configuration Files

persistence.xml

<persistence-unit name="attunity-unit" >
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>java:jboss/datasources/attunity-ds</jta-data-source>

    <properties>
        <!-- parameters for oracle -->
        <property name="hibernate.connection.url" value="URL" />
        <property name="hibernate.connection.driver_class" value="com.attunity.jdbc" />
        <property name="hibernate.connection.username" value="USER" />
        <property name="hibernate.connection.password" value="PASS" />
        <property name="jboss.entity.manager.factory.jndi.name"
                  value="java:/entityManagerFactory/attunity" />
    </properties>
</persistence-unit>

my-ds.xml

I have no clue how this is transformed into jboss configuration files and I don't know where to find the result of that (not in any standalone.xml files). However we proved that the datasource defined here can be mocked with other drivers. We used regular Oracle drivers to test that the datasource itself can be accessed.

<datasource jndi-name="java:jboss/datasources/attunity-ds" pool-name="attunity-ds" enabled="true">
    <connection-url>URL</connection-url>
    <driver>com.attunity.jdbc</driver>
    <pool>
        <min-pool-size>1</min-pool-size>
        <max-pool-size>2</max-pool-size>
        <prefill>true</prefill>
    </pool>
    <security>
        <user-name>USER</user-name>
        <password>PASS</password>
    </security>
</datasource>

module.xml (with the driver in EAP_HOME/modules/com/attunity/main)

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.attunity.jdbc">
    <resources>
        <resource-root path="nvjdbc-2.0.jar"/>  
    </resources>
    <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
    </dependencies>
</module>

Attempts

  • Followed a bunch of stackoverflow questions (1, 2, 3, 4) and tried many many configuration and driver-location permutations.
  • Edited all the above listed and the standalone configuration files according to the information found in the above questions and on other forums.
  • Read the JDBC sections in the JBoss guide, but those require one to access the management console, what I am not capable of.

Environment Information

  • Windows 7 64bit
  • JBoss 6.x.x EAP
  • Java 1.8 64bit
  • Attunity Driver 2.0

Update

I can confirm, that plain JDBC Connection attempts are refused. The driver is loaded properly.

Code

private Connection createAttunityConnection() {
    Connection connect = null;
    try {
        Class.forName(ATTUNITY_DATABASE_DRIVER);

        String url = ATTUNITY_URL + ATTUNITYE_IP_ADDRESS + ":"
                + ATTUNITY_PORT + ":" + ATTUNITY_ENCRYPTION_PROTOCOL + ";"
                + ATTUNITY_ENCRYPTION_KEY;
        connect = DriverManager.getConnection(url, ATTUNITY_USERNAME,
                ATTUNITY_PASSWORD);
    } catch (ClassNotFoundException | SQLException e) {
        e.printStackTrace();
    }
    return connect;
}

Output

28.07.2016 10:37:37 ERROR AttunityConnector:56 - Method createAttunityConnection() - SQLException  : java.sql.SQLException: Connection refused

Should this lead to the error message in the Problem-section above?

Community
  • 1
  • 1
michaelbahr
  • 4,837
  • 2
  • 39
  • 75

0 Answers0