Resolving a DSRA8040I from the data source test connection due to a NullPointerException
 Technote (troubleshooting)
 
Problem(Abstract)
When testing the connection to a configured data source, the test fails with a DSRA8040I message logged in the SystemOut.log.
 
Cause
Excerpt of error message when using Oracle® JDBC™ Driver:
[9/12/03 18:19:17:875 CEST] 6f21a83c DataSourceCon E DSRA8040I:
Failed to connect to the DataSource.  Encountered:
java.lang.NullPointerException
at oracle.jdbc.dbaccess.DBError.addSqlWarning(DBError.java:801)

Excerpt of error message when using DB2® JDBC Driver:

[7/18/04 11:45:29:992 EDT]  11d75b9 DataSourceCon E DSRA8040I:
Failed to connect to the DataSource.  Encountered :
java.lang.NullPointerException
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:173)
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:438)
at
COM.ibm.db2.jdbc.app.DB2Connection.connect(DB2Connection.java:502)
at
COM.ibm.db2.jdbc.app.DB2Connection.<init>(DB2Connection.java:407)
at
COM.ibm.db2.jdbc.app.DB2ReusableConnection.<init>(DB2ReusableConnection.java:74)
at
COM.ibm.db2.jdbc.DB2PooledConnection.getConnection(DB2PooledConnection.java:188)
at
com.ibm.ws.rsadapter.DSConfigurationHelper.testConnectionForGUI(DSConfigurationHelper.java:1917)

Note: This problem might also have an associated java.lang.UnsatisfiedLinkError that identifies a JDBC library in the SystemErr.log file.

Some causes for the problem are:
  • The required Native Library Path is not defined or is incorrectly defined.
  • Custom Properties defining the data source are incorrect.
  • There is a mismatch between the JDBC driver and database levels.
 
Resolving the problem
Solutions to the preceding causes:

  • The required Native Library Path is not defined or incorrectly defined
    The type 2 JDBC Driver (for example: DB2 JDBC Driver, Oracle OCI Driver) requires the native library path. If the native library path is not defined or is incorrectly defined, the NullPointerException might occur when testing the connection to the data source. This problem occurs mostly on UNIX® platforms.

    To fix the problem:
    1. Check the classpath variable for the JDBC provider. From the JDBC Providers panel, review the classpath setting. If an IBM® WebSphere® Managed variable is referenced, as in the following,

      ${DB2_JDBC_DRIVER_PATH}/db2java.zip

      confirm that the variable is set correctly. If the classpath name is hard-coded, then confirm that the path specified is correct.




    2. Check that the WebSphere Managed Variable is set correctly. From the administrative console, click Environment, then click Manage WebSphere Variables. Confirm that the managed variable is set to the location that contains the driver.

      Note: DB2_JDBC_DRIVER_PATH is used for Legacy Type 2 drivers. DB2UNIVERSAL_JDBC_DRIVER_PATH is used for Type 4 JCC (Universal) drivers




    3. Check the operating system environment for the WebSphere Application Server user to ensure that the user has access to the libraries needed for the DB driver. The easiest way to do this is to source the db2profile in your setupCmdLine.sh or startserver.sh script. This is done by adding a line to invoke the db2profile in the startServer or, for a UNIX system, add the following line:

      ./home/db2inst1/sqllib/db2profile

      For additional reference, see Configuring WebSphere Application Server for DB2 access and the technote Configuring WebSphere to use DB2 remote database.

  • Custom Properties defined for the data source are incorrect
    Make sure you provide only the values for the required custom properties. For example, when using DB2 JDBC Provider, the only required custom property for the data source is databaseName. So providing the value for the databaseName is sufficient to connect to the database. If you provide a value for custom property portNumber (which is not required), the NullPointerException might occur.

  • Mismatch between the JDBC driver and database levels
    For WebSphere Application Server V5.1 using DB2, there is a mismatch between the XA drivers of DB2 8.1 UDB and DB2 7.2 z/OS®. The resulting error is a java.lang.NullPointerException. This limitation is documented in the WebSphere Application Server V5.1 Information Center article Configuring WebSphere Application Server for DB2 access.
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > DB Connections/Connection Pooling
Operating system(s): Windows
Software version: 5.1
Software edition:
Reference #: 1177990
IBM Group: Software Group
Modified date: Aug 26, 2004