Verify that the WSHOME and JAVA_HOME environment variables are set correctly.
Create an Identity Manager ServerRepository.xml file that points to the Tomcat data source:
lh setRepo -v -tDatastore -iorg.apache.naming.java.javaURLContextFactory -fjava:/comp/env/jdbc/IDM_database -n -o ServerRepository-datasource.xml
Change the -f location flag to the value you specified for the Resource name attribute, above. The prefix java:/com/env is specific to javaURLContextFactory and Tomcat. This is the JNDI prefix that the data source name is appended to.
Configure the Identity Manager webapp to use the data source by copying the new ServerRepository file in place. For example:
cp ServerRepository-datasource.xml $WSHOME/WEB-INF/ServerRepository.xml
When you copy the data-source-enabled ServerRepository.xml to $WSHOME/WEB-INF, the lh command will stop working. This is expected because lh uses ServerRepository.xml to connect to the Identity Manager repository. Since lh is not running in the Tomcat container, it cannot look up the data source in Tomcat's JNDI.
When a Tomcat data source is used by Identity Manager, the data source will typically be responsible for connection pooling. In this case Identity Manager connection pooling needs to be disabled. Edit the RepositoryConfiguration configuration object and set the disableConnectionPool attribute to true to allow the Tomcat data source to manage the connection pool.
The concurrent use of the lh utility and Tomcat data sources can be problematic because of the connection pool issue mentioned above. Tomcat data sources will want to control the connection pool, but the lh utility cannot use the Tomcat data source, so the value of the RepositoryConfiguration disableConnectionPool attribute will depend on the type of access, either JDBC or data source.