I'm using wso2ei and created a scheduled job from a carbon application. The issue I'm facing is that after wso2 restart that job fails to connect to a local postgresql db with the following error:
TID: [-1] [] [2018-07-04 22:09:17,319] ERROR {org.wso2.carbon.ntask.core.impl.TaskQuartzJobAdapter} - Error in executing task: null {org.wso2.carbon.ntask.core.impl.TaskQuartzJobAdapter}
java.lang.ExceptionInInitializerError
...
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
...
Caused by: org.hibernate.exception.JDBCConnectionException: Error calling DriverManager#getConnection
...
Caused by: java.sql.SQLException: No suitable driver found for jdbc:postgresql://127.0.0.1:5432/dbanme
I have copied the postgresql jar file in all the following dirs (first and last one copied automatically on restart).
# find ./* -name 'postgresql*.jar'
./dropins/postgresql_42.1.4_1.0.0.jar
./lib/endorsed/postgresql-42.1.4.jar
./lib/postgresql-42.1.4.jar
./repository/axis2/client/lib/postgresql-42.1.4.jar
./repository/components/lib/postgresql-42.1.4.jar
./samples/axis2Client/lib/postgresql-42.1.4.jar
./wso2/broker/repository/lib/postgresql-42.1.4.jar
./wso2/components/plugins/postgresql-42.1.4.jar
./wso2/components/default/configuration/org.eclipse.osgi/bundles/619/1/.cp/postgresql-42.1.4.jar
One thing that fixes the issue is when going in Home > Configure > Datasources, edit a custom datasource, hit Test connection and everything goes back to normality and there are no errors anymore, connections work from everywhere.
Is there a specific place where the jar file should be placed?