JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver despite the driver in its place
Symptoms
Unable to start Confluence with driver not found error, despite SQL Server (jtds-1.2.2.jar) driver can be found at <confluence-install>/confluence/WEB-INF/lib
and the following appears in the atlassian-confluence.log
:
FATAL [main] [sf.hibernate.connection.C3P0ConnectionProvider] configure JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
ERROR [main] [springframework.web.context.ContextLoader] initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'pluginStateStore' while setting constructor argument with index 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginStateStore' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'bandanaManager' while setting bean property 'bandanaManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaManager' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'bandanaPersister' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'dbBandanaPersister' while setting bean property 'persister'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbBandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [databaseSubsystemContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginStateStore' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'bandanaManager' while setting bean property 'bandanaManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaManager' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'bandanaPersister' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'dbBandanaPersister' while setting bean property 'persister'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbBandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [databaseSubsystemContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaManager' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'bandanaPersister' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'dbBandanaPersister' while setting bean property 'persister'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbBandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [databaseSubsystemContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'dbBandanaPersister' while setting bean property 'persister'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbBandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [databaseSubsystemContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbBandanaPersister' defined in class path resource [services/bandanaServiceContext.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [databaseSubsystemContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [databaseSubsystemContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [productionDatabaseContext.xml]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
Caused by: net.sf.hibernate.HibernateException: JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver
at net.sf.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:61)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
...
Diagnosis
Open confluence.cfg.xml
from Confluence Home directory and check if the the database class is like the following.
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://<server>:<port>/<database></property>
Cause
The class and database url are wrongly declared, the parameters need to be changed from confluence.cfg.xml
in Confluence home directory.
Resolution
The database class and url string need to be declared like the following (See: Database Setup for SQL Server)
Please change <server>, <port>, and <database> accordingly
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://<server>:<port>/<database></property>