Fresh server install and get java error when setting up the database
Asked by Adam_Loghides:

I am just attempting to setup a confluence install on a linux server and I get the same error no matter which type of database I am trying to connect to (built-in, mysql, MSSQL). I've followed the setup instructions for each type of DB when trying to install. Not sure what I am doing wrong.

*** ** * ** ***

**Type** Exception Report

**Message** Cannot call sendError() after the response has been committed

**Description** The server encountered an unexpected condition that prevented it from fulfilling the request.

**Exception**

```
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
```


Answers:
author: Shannon S
body: Hi Adam,

This error is usually indicative of another issue. The best way to check that is for you to review the [Confluence server logs](https://confluence.atlassian.com/doc/working-with-confluence-logs-108364721.html) and see what other error message is being served with that error.

Please also confirm your Confluence version as well as the database versions you tried.

Regards,

Shannon

comments: author: Adam_Loghides
body: Hi Shannon,

I am trying to use the latest version of confluence (6.10 I think) and a fresh install. I get this error when attempting to use the built-in database just to evaluate the product; however, I went ahead and tried using a MSSQL and local MySQL databse with no luck.

Here is what I see in the logs when trying to setup the server with the built-in database:

2018-08-23 20:27:09,330 INFO \[localhost-startStop-1\] \[com.atlassian.confluence.lifecycle\] init Confluence is ready to serve  
2018-08-23 20:30:12,103 INFO \[http-nio-8090-exec-1\] \[springframework.web.context.ContextLoader\] initWebApplicationContext Root WebApplicationContext: initialization started  
2018-08-23 20:30:21,199 INFO \[http-nio-8090-exec-1\] \[com.atlassian.confluence.lifecycle\] \<init\> Loading EhCache cache manager  
2018-08-23 20:30:42,547 INFO \[http-nio-8090-exec-1\] \[springframework.web.context.ContextLoader\] initWebApplicationContext Root WebApplicationContext: initialization completed in 30443 ms  
2018-08-23 20:30:45,379 INFO \[http-nio-8090-exec-1\] \[atlassian.plugin.manager.DefaultPluginManager\] shutdown Preparing to shut down the plugin system  
2018-08-23 20:30:45,382 INFO \[http-nio-8090-exec-1\] \[atlassian.plugin.manager.DefaultPluginManager\] shutdown Shutting down the plugin system  
2018-08-23 20:30:45,435 INFO \[http-nio-8090-exec-1\] \[atlassian.plugin.manager.DefaultPluginManager\] earlyStartup Plugin system earlyStartup begun  
2018-08-23 20:30:45,649 WARN \[http-nio-8090-exec-1\] \[osgi.container.felix.ExportsBuilder\] getUrlClassPath Cannot deep scan non file '<http://felix.extensions:9/>'  
-- referer: http://\[IP ADDRESS\]:8090/setup/setupdbchoice-start.action \| url: /setup/setupembeddeddb-default.action \| traceId: 0066d94f620e3bdd \| userName: anonymous \| action: setupembeddeddb-default  
2018-08-23 20:31:18,041 WARN \[ThreadPoolAsyncTaskExecutor::Thread 7\] \[spring.scanner.util.ProductFilterUtil\] detectProduct Couldn't detect product, will use ProductFilter.ALL  
-- referer: http://\[IP ADDRESS\]:8090/setup/setupdbchoice-start.action \| url: /setup/setupembeddeddb-default.action \| traceId: 0066d94f620e3bdd \| userName: anonymous \| action: setupembeddeddb-default  
2018-08-23 20:31:19,228 WARN \[ThreadPoolAsyncTaskExecutor::Thread 11\] \[spring.scanner.util.ProductFilterUtil\] detectProduct Couldn't detect product, will use ProductFilter.ALL  
-- referer: http://\[IP ADDRESS\]:8090/setup/setupdbchoice-start.action \| url: /setup/setupembeddeddb-default.action \| traceId: 0066d94f620e3bdd \| userName: anonymous \| action: setupembeddeddb-default  
2018-08-23 20:31:50,210 INFO \[http-nio-8090-exec-1\] \[atlassian.plugin.manager.DefaultPluginManager\] logTime Plugin system earlyStartup ended  
2018-08-23 20:32:04,082 WARN \[Navlink Plugin Executor:thread-1\] \[confluence.impl.vcache.SynchronousExternalCache\] lambda$get$11 Failed to read entry from cache 'com.atlassian.bandana.BandanaPersister': Failed due to UNCLASSIFIED_FAILURE  
-- url: /setup/setupembeddeddb-default.action \| referer: http://\[IP ADDRESS\]:8090/setup/setupdbchoice-start.action \| traceId: 0066d94f620e3bdd \| userName: anonymous \| action: setupembeddeddb-default  
2018-08-23 20:32:13,923 WARN \[Navlink Plugin Executor:thread-1\] \[confluence.impl.vcache.SynchronousExternalCache\] lambda$get$11 Failed to read entry from cache 'com.atlassian.bandana.BandanaPersister': Failed due to UNCLASSIFIED_FAILURE  
-- url: /setup/setupembeddeddb-default.action \| referer: http://\[IP ADDRESS\]:8090/setup/setupdbchoice-start.action \| traceId: 0066d94f620e3bdd \| userName: anonymous \| action: setupembeddeddb-default  
2018-08-23 20:32:23,923 WARN \[Navlink Plugin Executor:thread-2\] \[confluence.impl.vcache.SynchronousExternalCache\] lambda$get$11 Failed to read entry from cache 'com.atlassian.bandana.BandanaPersister': Failed due to UNCLASSIFIED_FAILURE  
-- url: /setup/setupembeddeddb-default.action \| referer: http://\[IP ADDRESS\]:8090/setup/setupdbchoice-start.action \| traceId: 0066d94f620e3bdd \| userName: anonymous \| action: setupembeddeddb-default  
2018-08-23 20:32:27,241 WARN \[C3P0PooledConnectionPoolManager\[identityToken-\>2s9zl19xszn4s1r57135\|26165205\]-HelperThread-#0\] \[mchange.v2.resourcepool.BasicResourcePool\] log com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1606a562 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:  
-- referer: http://\[IP ADDRESS\]:8090/setup/setupdbchoice-start.action \| url: /setup/setupembeddeddb-default.action \| traceId: 0066d94f620e3bdd \| userName: anonymous \| action: setupembeddeddb-default  
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'. ClientConnectionId:dcad6b47-e0b5-4d22-a5e5-53cfb9aa9783  
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:260)  
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:256)  
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:108)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4507)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3374)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:85)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3338)  
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7342)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2688)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2236)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1897)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1738)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1062)  
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:572)  
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)  
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)  
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)  
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)  
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)  
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)  
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)  
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)  
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

Thank you,

Adam


author: Shannon S
body: Adam,

It appears we're missing a few things from these logs (note that there are WARN and INFO lines, but no ERROR lines). However, I see a message about the SQL database (not the built-in database) and the user 'sa'.

To resolve that, try the following:

1. Create a new database according to [Database Setup for SQL Server](https://confluence.atlassian.com/doc/database-setup-for-sql-server-9258.html). Pay special attention to steps 4 and 5 under section 2:
   1. *Using your SQL administrator permissions, create a new SQL user account for Confluence (for example, `confluenceuser`).*
   2. *Give this user full create, read and write permissions for the database tables. Confluence must be able to create its own schema. Refer to the SQL Server documentation for how to do this.*
   3. **Note:** It appears that right now the 'sa' database account is used to access the database.
2. Stop the current Confluence service.
3. Uninstall existing Confluence installation, and remove existing Confluence installation directories (both Confluence and Application Data).
4. Re-install Confluence from the installer. Provide database credentials, and click on **Test Connection** to ensure it passes.

Regards,  
Shannon


author: Adam_Loghides
body: Hi Shannon,

Thank you - I thought I had created a confluenceuser sql account with the appropriate permissions, but after doubling back and confirming the permissions... I found that I did not apply them to the correct database.

Thank you so much - I am up and running now!

Thank you,

Adam


author: Shannon S
body: Adam,

Happy to help! Glad you were able to resolve the issue.

Take care, and have a pleasant week.

Regards,

Shannon


author: Ayman Lee
body: Hey [@Adam_Loghides](/t5/user/viewprofilepage/user-id/1820982) and [@Shannon S](/t5/user/viewprofilepage/user-id/510046),

Can you please advise on how to create this confluenceuser for SQL server? My knowledge on SQL Server is very basic, so a detailed step-by-step is very much needed.

From what I've accomplished so far is that I've created a "User" via the Databases\>confluence\>Security\>Users. I then select the "SQL user without login", and set the User name: as "confluenceuser" and Default schema: as blank. After that i simply right-click on the confluence database, and hit Properties. Then under the Permissions tab, i chose "confluenceuser" and simply grant (check) all the permissions one by one, and i hit OK. So this DID NOT work.

Please help!

Thank you in advance.


author: Shannon S
body: Ayman,

If you follow [Database Setup for SQL Server](https://confluence.atlassian.com/doc/database-setup-for-sql-server-9258.html?_ga=2.36432352.1563262255.1542271878-927667114.1531430462) exactly, it should work. Make sure you're not using the Express version, and that you use the terminal and not the UI.

Here are the exact steps you can take:
> Once you've installed SQL Server, create a database user and database for Confluence as follows:
>
> 1. Using your SQL administrator permissions, create a new database (for example `confluence`)
> 2. Set the default collation for the database to **SQL_Latin1_General_CP1_CS_AS** (case sensitive).
>
>        ALTER DATABASE <database-name> COLLATE SQL_Latin1_General_CP1_CS_AS
>
>    If you see a 'database could not be exclusively locked to perform the operation' error, you may need to prevent other connections by setting the mode to single user for the transaction  
>
>        ALTER DATABASE <database-name> SET SINGLE_USER WITH ROLLBACK IMMEDIATE;<your ALTER DATABASE query>ALTER DATABASE <database-name> SET MULTI_USER;
>
> 3. Check the database isolation level of READ_COMMITTED_SNAPSHOT is ON.
>
>        SELECT is_read_committed_snapshot_on FROMsys.databases WHERE name= 'database-name' 
>
>    If this query returns **1** , thenREAD_COMMITTED_SNAPSHOT is ON, and you're good to go.   
>
>    If this query returns **0**, READ_COMMITTED_SNAPSHOT option is OFF and you will need to turn it on as follows:  
>
>        ALTER DATABASE <database-name>   SET READ_COMMITTED_SNAPSHOT ON   WITH ROLLBACK IMMEDIATE;
>
> 4. Using your SQL administrator permissions, create a new SQL user account for Confluence (for example, `confluenceuser`).
>
> 5. Give this user full create, read and write permissions for the database tables. Confluence must be able to create its own schema. Refer to the SQL Server documentation for how to do this.

In addition, that user in #5 is generally referring to the db_owner role. It's not clear for a lot of users, so I created a feature request here to clarify the documentation:

* [CONFSERVER-57487](https://jira.atlassian.com/browse/CONFSERVER-57487)

Let me know if you have any questions about that!

Regards,

Shannon


author: Ayman Lee
body: Hi [@Shannon S](/t5/user/viewprofilepage/user-id/510046)

Wait, Confluence won't work with any of MS SQL Server Express versions?


author: Adam_Loghides
body: I created SQL user **with login** under the confluence database and granted db_owner in the membership page.

Not sure if that will make a difference for you.


author: Ayman Lee
body: Thanks [@Adam_Loghides](/t5/user/viewprofilepage/user-id/1820982), I'll try that now.


author: Shannon S
body: [@Ayman Lee](/t5/user/viewprofilepage/user-id/962624),

The SQL Server Express versions aren't among the [supported database platforms](https://confluence.atlassian.com/doc/supported-platforms-207488198.html#SupportedPlatforms-Databases) for Confluence, meaning we cannot guarantee proper functionality with it. It's possible that there are Confluence admins who have successfully setup Confluence using SQL Server Express, but it is not supported.

I hope that clarifies things for you!

Regards,

Shannon


author: Adam_Loghides
body: removed this - I meant to reply above


Tags: confluence-server

server