Error setting up datasource
Asked by Jeremy Glick:

Hi,

I trying to get Confluence installed and am hitting some errors while setting up the external datasource. The errors aren't helping me much. Any suggestions would be appreciated.

Thank you in advance,

JD

Description of installation:  
-CentOS 6.5  
-confluence 5.5.2  
-mysql 5.6.19  
-mysql-connector-java-5.1.31-bin.jar  

Datasource setup steps and error:  
1. Select "MySQL External Database"  
2. Select "Connect via a Datasource"  
3. Enter datasource name (java:comp/env/jdbc/confluence) and click "Next"  
4. Receive the following error:  

<br />

Setup Datasource Database Failed  

The following error(s) occurred:  

Configuring the database failed. Couldn't create the database schema.  
Error creating bean with name 'cacheStatisticsManager' defined in class path resource \[services/cacheServiceContext.xml\]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehCacheStatisticsManager' defined in URL \[jar:file:/opt/atlassian/atlassian-confluence-5.5.2/confluence/WEB-INF/lib/confluence-cache-ehcache-5.5.2.jar!/cacheProviderContext.xml\]: Cannot resolve reference to bean 'userI18NBeanFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userI18NBeanFactory' defined in class path resource \[i18NContext.xml\]: Cannot resolve reference to bean 'localeManager' while setting bean property 'localeManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localeManager' defined in class path resource \[i18NContext.xml\]: Cannot resolve reference to bean 'settingsManager' while setting bean property 'settingsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'settingsManager' defined in class path resource \[applicationContext.xml\]: Cannot resolve reference to bean 'upgradeManager' while setting bean property 'upgradeManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'upgradeManager' defined in class path resource \[upgradeSubsystemContext.xml\]: Cannot resolve reference to bean 'personalSpaceCreatorCheckUpgradeTask' while setting bean property 'upgradeTasks' with key \[20\]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personalSpaceCreatorCheckUpgradeTask' defined in class path resource \[upgradeSubsystemContext.xml\]: Cannot resolve reference to bean 'userAccessor' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAccessor' defined in class path resource \[applicationContext.xml\]: Cannot resolve reference to bean 'userAccessorTarget' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAccessorTarget' defined in class path resource \[applicationContext.xml\]: Cannot resolve reference to bean 'repositoryAccessor' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repositoryAccessor' defined in class path resource \[atlassianUserContext.xml\]: Cannot resolve reference to bean 'userManager' while setting bean property 'userManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManager' defined in class path resource \[atlassianUserContext.xml\]: Cannot resolve reference to bean 'backingUserManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'backingUserManager' defined in class path resource \[atlassianUserContext.xml\]: Cannot resolve reference to bean 'crowdService' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdService' defined in class path resource \[importedEmbeddedCrowdContext.xml\]: Cannot resolve reference to bean 'crowdServiceTarget' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdServiceTarget': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'unfilteredCrowdServiceTarget' defined in class path resource \[importedEmbeddedCrowdContext.xml\]: Cannot resolve reference to bean 'crowdApplicationService' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdApplicationService' defined in class path resource \[importedEmbeddedCrowdContext.xml\]: Cannot resolve reference to bean 'crowdDirectoryManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdDirectoryManager' defined in class path resource \[importedEmbeddedCrowdContext.xml\]: Cannot resolve reference to bean 'directoryInstanceLoader' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'directoryInstanceLoader' defined in class path resource \[importedEmbeddedCrowdContext.xml\]: Cannot resolve reference to bean 'crowdInternalDirectoryLoader' while setting constructor argument with key \[0\]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdInternalDirectoryLoader' defined in class path resource \[importedEmbeddedCrowdContext.xml\]: Cannot resolve reference to bean 'instanceFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instanceFactory' defined in class path resource \[embeddedCrowdContext.xml\]: Invocation of init method failed; nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Class  

Setting up datasource database instance failed. You can either try it again or or go back to the database selection page:  
Setup Datasource Database Again Restart Database Setup  
Atlassian  


Answers:
author: Jeremy Glick
body: I reviewed the supported platforms page and relaized that JDK 1.8 wasn't supported. I downgraded to 1.7 and everything is now working.

comments: author: Lu Di
body: My JDK is 1.7,but I got the same error


author: Jeremy Glick
body: Thanks everyone for the suggestions. I still have not resolved this problem. If I purchase the license, will someone at Atlassian help me troubleshoot?

comments: author: Trupti Kamble
body: Hello Jeremy,

I am facing the same issue. Can you help me to sort out this.

Thanks,

Trupti


author: Sateesh Chandra
body: Can you check if the name of the database created and the name passed in the database settings are same. Did you receive any error when you click Test Settings on the database connection config page?

comments: author: Jeremy Glick
body: Yes, I confirmed that the database name was the same. In fact, I tried passing a wrong name and it gives a regular error message when that happens. It appears that the problem isn't related to anything on the MySQL server side.

Regarding the test settings, I don't recall seeing that. I entered the database settings in the config files according to the documentation. After that, I open up confluence on the appropriate port and start the database configuration. This is where I receive the posted error.


author: William Zanchet [Atlassian]
body: You need to make sure that the user that is running Confluence has the full permissions (Read\&Write) in the install and home folder.  

Cheers,  
WZ

comments: author: Jeremy Glick
body: Hi,

Confluence is running as the same user who owns the install and home folder. That user has full permissions.

Thanks,

JD


author: Sateesh Chandra
body: Stop Confluence

Login to database as root and give the below command

GRANT ALL ON \<DATABASE\>.\* TO \<USER\>@'localhost' identified by \<password\>

GRANT ALL ON \<DATABASE\>.\* TO \<USER\>@'%' identified by \<password\>

GRANT ALL ON \<DATABASE\>.\* TO \<USER\>@\<ipaddress_of_confluenceserver\> identified by \<password\>

Start the Confluence. Let me know how it goes

comments: author: Jeremy Glick
body: Hi,

I do have proper users/grants setup. Without the correct user, I can't even get to the Java error message. Thanks.


author: Sabine Winkler
body: Hi,

there can be some issues happend here. How did you create the database, are the priviliges given for Confluence in a proper manner? Maybe this document will help to try it manually if you want to have MySQL running as DataSource \[1\]

HTH, Sabine

\[1\] <https://confluence.atlassian.com/display/DOC/Configuring+a+MySQL+Datasource+in+Apache+Tomcat>

comments: author: Jeremy Glick
body: On a side note, if I don't have the database created beforehand, I get a simple message that reads:

----------

Setup Datasource Database Failed  

The following error(s) occurred:  

Could not lookup datasource successfully: com.atlassian.config.bootstrap.BootstrapException: Couldn't open a connection on Datasource (java:comp/env/jdbc/confluence):  

Setting up datasource database instance failed. You can either try it again or or go back to the database selection page:  
Setup Datasource Database Again Restart Database Setup  
Atlassian

----------

If I have the database created (as posted in my above comment), it takes longer to run and gives me that Java error. To me, this shows that it's in fact connecting to MySQL, but failing somewhere during the schema creation. Inspecting the database, I see no tables created.

Thanks,

JD


author: Jeremy Glick
body: Hi, I created the database as instructed in the manual (CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;). That's the document I followed to get things setup.