Websphere - Java application using spring framework fails to connect using Application Server Password Provider
Symptom
When using the Cyber-Ark Application Server Credential Provider for WebSphere 6, in an application that is based on the Spring framework, we fail in creating a database connection and the Cyber-Ark ASCP is never asked for the credentials.
The following error can be seen in the log file:
Caused by: java.sql.SQLException: invalid arguments in callDSRA0010E: SQL State = null, Error Code = 17,433
When using an application which is not based on the Spring framework, the password is retrieved successfully from the Vault and is used successfully to create the database connection.
Environment
10.10;11.4;12.0;12.1;12.4;12.6;13.0 Privileged Access Manager (PAM, self-hosted) Application Server Credential Provider (ASCP)
Cause
The jndi resource for the data source is configured in Spring with the resource-ref parameter missing or set to false.
Resolution
The jndi resource for the data source is configured in Spring by the following line:
<jee:jndi-lookup id="dataSource" jndi-name="DataSource" resource-ref="true"/>
The data source is then passed to the Java objects that require it.
When the property resource-ref="true" is missing or set to false, the application does not use the authentication provided by Cyber-Ark. In this case, the application is still able to retrieve the data source when normal authentication is used, but not when using Cyber-Ark ASCP.
Adding resource-ref="true" to Spring configuration resolves the issue.
Additional Information
Details
SYMPTOM:
When using the Cyber-Ark Application Server Credential Provider for WebSphere 6, in an application that is based on the Spring framework, we fail in creating a database connection and the Cyber-Ark ASCP is never asked for the credentials.
The following error can be seen in the log file:
Caused by: java.sql.SQLException: invalid arguments in callDSRA0010E: SQL State = null, Error Code = 17,433
When using an application which is not based on the Spring framework, the password is retrieved successfully from the Vault and is used successfully to create the database connection.
PROBLEM:
The jndi resource for the data source is configured in Spring with the resource-ref parameter missing or set to false.
SOLUTION:
The jndi resource for the data source is configured in Spring by the following line:
<jee:jndi-lookup id="dataSource" jndi-name="DataSource" resource-ref="true"/>
The data source is then passed to the Java objects that require it.
When the property resource-ref="true" is missing or set to false, the application does not use the authentication provided by Cyber-Ark. In this case, the application is still able to retrieve the data source when normal authentication is used, but not when using Cyber-Ark ASCP.
Adding resource-ref="true" to Spring configuration resolves the issue.