Datasource and Configuration Issues
    • 16 Oct 2024
    • 4 Minutes to read
    • Contributors
    • PDF

    Datasource and Configuration Issues

    • PDF

    Article summary

    If there is an issue with the database connection configuration in DM or a problem connecting to the configured database, Autoform DM will fail on startup with an exception ending in the line:

    Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set.

    The database configuration itself can be found in standalone.xml and looks like this:

    <datasource jndi-name="java:/PDM" pool-name="PDM" enabled="true" use-java-context="true" use-ccm="true">
        <connection-url>jdbc:jtds:sqlserver://localhost:1433/MYDB</connection-url>
        <driver>jtds</driver>
        <pool>
          <min-pool-size>10</min-pool-size>     
          <max-pool-size>20</max-pool-size>
          <prefill>false</prefill>
          <use-strict-min>false</use-strict-min>
          <flush-strategy>FailingConnectionOnly</flush-strategy>
        </pool>
        <security>
          <user-name>pdm</user-name>
          <password>pdm</password>
        </security>
        <validation>
          <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
          <validate-on-match>true</validate-on-match>
        </validation>
      </datasource>

    The connection-url and security sections are the important lines as they hold the database location and authentication.

    This article documents the failure behavior in order to help diagnose the actual underlying problem.

    General Symptoms

    A database configuration error will cause DM to fail to deploy correctly at startup and cause large amounts of error logging. Look for the following symptoms:

    • DM fails to deploy on startup - navigating to the web frontend results in a 404 - Not Found error message.

    • Checking the server logs shows a large number of log lines, such as the following:

    service jboss.deployment.subunit."pdm_app_module.ear"."applicationservice-8.0.0-SNAPSHOT.jar".component.ClientApplicationServiceEJB.VIEW."com.efstech.pdm.applicationservice.ejb.se
    ssion.ClientApplicationService".LOCAL (missing) dependents: [service jboss.deployment.subunit."pdm_app_module.ear"."applicationservice-8.0.0-SNAPSHOT.jar".component.ClientApplicationSer
    viceEJB.START]
    • Just before the deployment failure errors (as above), there is a stackstrace ending with the line:

    Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

    Identify the Root Cause

    Should the above symptoms be apparent, then first search for a log line containing the text:

    IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection

    SQL Server

    If the following error logs are displayed, there is usually a cause and a way to fix the error, as follows:

    ...
    Caused by: java.sql.SQLException: Unknown server host name '<hostname>'
    ...
    Caused by: java.net.UnknownHostException: <hostname>

    Cause

    Unable to resolve the hostname of the database server.

    Fix

    Check the hostname is correct and verify that you can ping it and resolve its DNS entry without issue. Depending on the network setup, you may need the FQDN (fully qualified domain name), for instance, databasehost.some.domain.com, rather than just databasehost.


    ...
    Caused by: java.sql.SQLException: Network error IOException: Connection refused
    ...
    Caused by: java.net.ConnectException: Connection refused

    Cause

    Unable to connect to database server - most likely an issue with the port.

    Fix

    Verify the database server is running and available on the configured port.


    ...
    Caused by: java.sql.SQLException: Cannot open database "AFPDM8DPP" requested by the login. The login failed.

    Cause

    The connection to the database server was successful, and the login credentials were valid, but the user was not able to access the configured database.

    Fix

    Check the database name is correct and that the user has the correct permissions to access and read the tables.


    ...
    Caused by: java.sql.SQLException: Login failed for user 'pdm'.

    Cause

    The specified credentials for connecting to the database server are invalid.

    Fix

    Verify the username and password are correct, and the user has the correct permissions to connect to the database server and read the configured database.


    Oracle

    ...
    Caused by: java.sql.SQLRecoverableException: IO Error: Unknown host specified
    ...
    Caused by: oracle.net.ns.NetException: Unknown host specified

    Cause

    Unable to resolve the hostname of the database server.

    Fix

    Check the hostname is correct and verify that you can ping it and resolve its DNS entry without issue. Depending on the network setup you may need the FQDN (fully qualified domain name), for instance databasehost.some.domain.com rather than just databasehost.


    ...
    Caused by: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    ...
    Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
    ...
    Caused by: java.net.ConnectException: Connection refused

    Cause

    Unable to connect to database server - most likely an issue with the port.

    Fix

    Verify the database server is running and available on the configured port.


    ...
    Caused by: java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
    ...
    Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
    ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

    Cause

    Unable to locate Oracle database service - the connection to the Oracle database server has been established, but the specified Oracle database service is not valid.

    Fix

    Check the service name specified and verify that you are able to use another tool, such as SQL Developer, to connect.


    ...
    Caused by: java.sql.SQLException: ORA-01017: invalid username/password; logon denied

    Cause

    The specified credentials for connecting to the database are invalid.

    Fix

    Verify the username and password are correct and the user has the correct permissions to be able to read and use the database service.


    ...
    WARN  [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (ServerService Thread Pool -- 65) IJ030027: Destroying connection that is not valid, due to the following exception: oracle.jdbc.driver.T4CConnection@351298af: java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
       at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
    ...

    Cause

    The SQL statement used to validate the connections in the connection pool is invalid. This will be because DM has been installed with a database type other than Oracle, so the wrong SQL has been configured.

    Fix

    1. Edit the Wildfly configuration file (standalone.xml or domain.xml) or edit the database datasource connection via the management console.

    2. Find the check-valid-connection-sql property and ensure it is:

       SELECT 1 FROM DUAL

      For example:

    <datasources>
        <datasource jndi-name="java:/PDM" pool-name="PDM" enabled="true" use-java-context="true" use-ccm="true" statistics-enabled="true">
          ...
          <validation>
            <check-valid-connection-sql>SELECT 1 FROM DUAL</check-valid-connection-sql>
            <validate-on-match>true</validate-on-match>
          </validation>
        </datasource>
      </datasources>


    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.