Cannot call sendError() after the response has been committed
Asked by George Datseris:

Hello All,

I've been getting this error as I'm trying to install Confluence on my windows machine with SQL Server 2014 enterprise.

I've set the correct JAVA_HOME environment variable, I've installed the latest full JDK and I've installed confluence through the installation wizard with no issues at all.

However; when the confluence service runs and I get the first run on the browser 8090 port "http://localhost:8090/setup/setupdbtype.action" I'm inserting all the correct values and this is the error I get a few seconds after I start the installation.

Can anyone help ?

**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	org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:456)	javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:120)	com.atlassian.confluence.web.filter.DebugFilter$LoggingResponseWrapper.sendError(DebugFilter.java:132)	javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:120)	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter$1.sendError(FourOhFourErrorLoggingFilter.java:52)	javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:120)	com.atlassian.core.filters.HeaderSanitisingResponseWrapper.sendError(HeaderSanitisingResponseWrapper.java:103)	javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:120)	javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:120)	com.opensymphony.webwork.dispatcher.ServletDispatcher.sendError(ServletDispatcher.java:349)	com.atlassian.confluence.servlet.ConfluenceServletDispatcher.sendError(ConfluenceServletDispatcher.java:104)	com.atlassian.confluence.servlet.ConfluenceServletDispatcher.serviceAction(ConfluenceServletDispatcher.java:97)	com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:199)	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)	com.atlassian.confluence.util.profiling.ProfilingSiteMeshFilter.doFilter(ProfilingSiteMeshFilter.java:55)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:64)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:58)	com.atlassian.johnson.plugin.servlet.filter.JohnsonServletFilterModuleContainerFilter.doFilter(JohnsonServletFilterModuleContainerFilter.java:50)	com.atlassian.confluence.jmx.JmxFilter.doFilter(JmxFilter.java:98)	com.atlassian.confluence.cache.TransactionalCacheFactoryCleanupFilter.doFilter(TransactionalCacheFactoryCleanupFilter.java:22)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.ServletContextThreadLocalFilter.doFilter(ServletContextThreadLocalFilter.java:21)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.UserLoggingContextFilter.doFilter(UserLoggingContextFilter.java:32)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.UserNameHeaderFilter.doFilter(UserNameHeaderFilter.java:25)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.filter.MauEventFilter.doFilter(MauEventFilter.java:42)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.UserThreadLocalFilter.doFilter(UserThreadLocalFilter.java:39)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.filter.ConfluenceTimeoutFilter.doFilter(ConfluenceTimeoutFilter.java:57)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:88)	com.atlassian.confluence.web.filter.ConfluenceSecurityFilter.applyFilter(ConfluenceSecurityFilter.java:39)	com.atlassian.confluence.web.filter.ConfluenceSecurityFilter.doFilter(ConfluenceSecurityFilter.java:29)	com.atlassian.confluence.web.filter.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:25)	com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter$SwapOnBootstrapFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:45)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:35)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:148)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:64)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:58)	com.atlassian.johnson.plugin.servlet.filter.JohnsonServletFilterModuleContainerFilter.doFilter(JohnsonServletFilterModuleContainerFilter.java:50)	com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:56)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.filter.ConfluenceOpenSessionInViewFilter.doFilterInternal(ConfluenceOpenSessionInViewFilter.java:38)	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)	com.atlassian.confluence.util.ConfluenceErrorFilter.doFilter(ConfluenceErrorFilter.java:24)	com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:99)	com.atlassian.confluence.core.datetime.RequestTimeThreadLocalFilter.doFilter(RequestTimeThreadLocalFilter.java:37)	com.atlassian.core.filters.cache.AbstractCachingFilter.doFilter(AbstractCachingFilter.java:33)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:64)	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:58)	com.atlassian.johnson.plugin.servlet.filter.JohnsonServletFilterModuleContainerFilter.doFilter(JohnsonServletFilterModuleContainerFilter.java:50)	com.atlassian.confluence.tenant.TenantGateFilter.lambda$doFilter$0(TenantGateFilter.java:35)	com.atlassian.confluence.tenant.TenantGate$3.call(TenantGate.java:145)	com.atlassian.confluence.tenant.TenantGateFilter.doFilter(TenantGateFilter.java:37)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.MobileAppRequestFilter.doFilter(MobileAppRequestFilter.java:36)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.internal.web.filter.spring.IgnoreWebAsyncManagerFilter.doFilter(IgnoreWebAsyncManagerFilter.java:59)	com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter.doFilter(RequestParamValidationFilter.java:51)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.web.filter.TranslationModeFilter.doFilter(TranslationModeFilter.java:39)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.plugin.servlet.filter.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:72)	com.atlassian.confluence.web.filter.LanguageExtractionFilter.doFilter(LanguageExtractionFilter.java:39)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.impl.vcache.VCacheRequestContextFilter.doFilter(VCacheRequestContextFilter.java:58)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.LoggingContextFilter.doFilter(LoggingContextFilter.java:33)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.util.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:65)	com.atlassian.confluence.web.filter.ZipkinTracingFilter.doFilter(ZipkinTracingFilter.java:54)	com.atlassian.confluence.web.filter.ResponseOutputStreamFilter.doFilter(ResponseOutputStreamFilter.java:25)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:59)	com.atlassian.confluence.web.ConfluenceJohnsonFilter.doFilter(ConfluenceJohnsonFilter.java:32)	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.confluence.impl.servlet.HoldingUntilStartedFilter.doFilter(HoldingUntilStartedFilter.java:88)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:64)	com.atlassian.confluence.internal.diagnostics.HttpRequestMonitoringFilter.doFilter(HttpRequestMonitoringFilter.java:35)	com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:46)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
```


Answers:
author: George Datseris
body: Turns out that the SQL user was lacking the db_owner permission!

I gave the user rights and the installation was successful.

This is the script you will need :

CREATE DATABASE Your_DB_User_Here  
use Your_DB_Name_Here;  
CREATE LOGIN Your_DB_User_Here WITH PASSWORD=N'Your_DB_User_Here', DEFAULT_DATABASE=Your_DB_Name_Here CHECK_EXPIRATION=OFF, CHECK_POLICY=ON  
create user Your_DB_User_Here for login Your_DB_User_Here  
EXEC sp_addrolemember N'db_datareader', Your_DB_User_Here  
EXEC sp_addrolemember N'db_datawriter', Your_DB_User_Here  
EXEC sp_addrolemember N'db_owner', Your_DB_User_Here  
ALTER DATABASE Your_DB_Name_Here COLLATE SQL_Latin1_General_CP1_CS_AS  
ALTER DATABASE Your_DB_Name_Here SET READ_COMMITTED_SNAPSHOT ON WITH ROLLBACK IMMEDIATE;

comments: author: Shannon S
body: Thank you, George!

In particular, if anyone has any issues with this they can also review the steps from:

* [Database Setup for SQL Server \> Step 2 Create a database and database user](https://confluence.atlassian.com/doc/database-setup-for-sql-server-9258.html#DatabaseSetupforSQLServer-2.Createadatabaseanddatabaseuser)

This particular step is a bit tricky and has caused issues similar to this in the past.

Take care,

Shannon


author: George Datseris
body: Thanks for your reply Shannon,

I have found that the issue lies in the documentation at step number 5.

***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.***

The SQL Server permission management is somewhat dubious and users who do not get an explicit list with the permissions they need to assign in the documentation, will be lead to this error.

This is because they will only enable db_datareader and db_datawriter permissions (Refer to ***full create, read and write permissions*** ) whereas the "create table" permission is not granted.   
[Refer to Microsoft SQL server database roles](https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/database-level-roles?view=sql-server-2017)where it states that users with DataReader and Writer roles have access to modify the data but not create tables. I found that giving the user db_owner role, this issue is resolved.

|-------------------|----------------------------------------------------------------------------------------------------------|
| **db_datawriter** | Members of the **db_datawriter** fixed database role can add, delete, or change data in all user tables. |
| **db_datareader** | Members of the **db_datareader** fixed database role can read all data from all user tables.             |


author: Shannon S
body: Hi George,

Thank you for bringing that up. I've created a feature request to clarify the documentation in the future:

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

Please feel free to add a comment there with your findings and experience.

Thanks again, and take care.

Regards,

Shannon


author: George Datseris
body: Good work Shannon. Thanks for being proactive. I am impressed.


author: Shannon S
body: Hey George! No problem at all, just doing my job. :)

If you ever notice documentation issues in the future you can also raise a feature request from the same site, or let us know here on Community and we can help get that submitted to the documentation team.

Take care and have a pleasant rest of your week.

Shannon


author: Noumenon72
body: [@Shannon S](/t5/user/viewprofilepage/user-id/510046)I am having the same issue but doing the trial install with the H2 database. What might the issue be for me since I don't have to configure SQL Server?


author: Shannon S
body: Hello there,

Ideally, you shouldn't be running into any permissions issues with the H2 database since Confluence created it.

My recommendation would be to [raise this as a new question](https://community.atlassian.com/t5/forums/postpage/choose-node/true/interaction-style/qanda?add-tags=confluence) since it's not the same problem as George's question.

Make sure to include your Confluence version, and let us know if this is a new install, an upgrade, or migration, and what steps you have taken so far.

Thank you!

Regards,

Shannon


Tags: confluence-server

server