I am trying to configure WebSphere Liberty 17.0.0.2 with a DataSource resource that can be injected using JNDI. No matter what I seem to do, I end up with the following error:
com.ibm.wsspi.injectionengine.InjectionException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/jdbc/db2 reference. The exception message was: CWNEN1006E: The server was unable to obtain an object for the jdbc/db2 binding with the javax.sql.DataSource type. The exception message was: java.sql.SQLNonTransientException: DSRA4000E: A valid JDBC driver implementation class was not found for the jdbcDriver dataSource[db2]/jdbcDriver[default-0] using the library jdbc-library. [d:\libraries\jtopen_9_3\lib\jt400.jar]
Java Code:
@Resource(name = "jdbc/db2")
private DataSource dataSource;
Configuration (server.xml):
<library id="jdbc-library">
<fileset dir="d:/libraries/jtopen_9_3/lib" includes="jt400.jar" />
</library>
<dataSource id="db2" jndiName="jdbc/db2">
<jdbcDriver libraryRef="jdbc-library" />
<properties.db2.jcc serverName="..." user="..." password="..." />
</dataSource>
I have no idea why it cannot find com.ibm.as400.access.AS400JDBCDriver
, or com.ibm.as400.access.AS400JDBCDataSource
since they are both readily available in the jt400.jar
archive. What am I missing?
Since you are using the IBM i Toolbox JDBC driver instead of the DB2 Universal JDBC driver, try changing properties.db2.jcc
to properties.db2.i.toolbox
.