Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Confluence throws exception during setting up database

Evren July 8, 2018

OS: debian 8
JDK: 1.8.0_171
Postgresql: 9.6
Confluence: 6.10

Exception:

Caused by: com.atlassian.confluence.tenant.VacantException: Confluence is vacant, a call to tenanted [public abstract org.hibernate.Session org.hibernate.SessionFactory.getCurrentSession() throws org.hibernate.HibernateException] is not allowed.

Any idea?

Thanks

1 answer

0 votes
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 9, 2018

Hi Evren,

Please have a look at the following article for information on how to get around this error:

Let us know if you have any trouble!

Shannon

Evren July 9, 2018

I get the same exception when i try trial installation as well. The hostname is already in "/etc/hosts"

Also, i am using nginx as proxy server. Here is my server.xml:

<Server port="8205" shutdown="SHUTDOWN" debug="0"> <Service name="Tomcat-Standalone"> <!-- ============================================================================================================== DEFAULT - Direct connector with no proxy, for unproxied HTTP access to Confluence.
If using a http/https proxy, comment out this connector. ============================================================================================================== -->    <!-- <Connector port="8291" connectionTimeout="20000" redirectPort="8443" maxThreads="48" minSpareThreads="10" enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8" protocol="org.apache.coyote.http11.Http11NioProtocol"/> -->    <!-- ============================================================================================================== HTTP - Proxying Confluence via Apache or Nginx over HTTP
If you're proxying traffic to Confluence over HTTP, uncomment the connector below and comment out the others. Make sure you provide the right information for proxyName and proxyPort.
For more information see: Apache - https://confluence.atlassian.com/x/4xQLM nginx - https://confluence.atlassian.com/x/TgSvEg
============================================================================================================== -->
<!-- <Connector port="8291" connectionTimeout="20000" redirectPort="8443" maxThreads="48" minSpareThreads="10" enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="http" proxyName="<subdomain>.<domain>.com" proxyPort="80"/> --> <!-- ============================================================================================================== HTTPS - Direct connector with no proxy, for unproxied HTTPS access to Confluence.
For more info see https://confluence.atlassian.com/x/s3UC ============================================================================================================== -->
<!-- <Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" protocol="org.apache.coyote.http11.Http11NioProtocol" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLSv1.2" sslEnabledProtocols="TLSv1.2" SSLEnabled="true" URIEncoding="UTF-8" keystorePass="<MY_CERTIFICATE_PASSWORD>"/> -->
<!-- ============================================================================================================== HTTPS - Proxying Confluence via Apache or Nginx over HTTPS
If you're proxying traffic to Confluence over HTTPS, uncomment the connector below and comment out the others. Make sure you provide the right information for proxyName and proxyPort.
For more information see: Apache - https://confluence.atlassian.com/x/PTT3MQ nginx - https://confluence.atlassian.com/x/cNIvMw ============================================================================================================== -->
<Connector port="8290" connectionTimeout="20000" redirectPort="8243" maxThreads="48" minSpareThreads="10" enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" proxyName="<the-hostname-in-hosts-file>" proxyPort="443"/>
<Engine name="Standalone" defaultHost="localhost" debug="0"> <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4"> <Context path="" docBase="../confluence" debug="0" reloadable="false"> <!-- Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties --> <Manager pathname=""/> <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/> </Context>
<Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0" reloadable="false"> <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/> </Context> </Host> </Engine> </Service></Server>

Also, note that i have JIRA running with similar configuration in the same server and i have no problem with JIRA.

 

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 10, 2018

Hi Evren,

Unless your proxy configuration prevents Confluence connecting to the database, I do not think NGINX is the issue. I was happy to see the proxy support was included in your server.xml.

On reviewing the article Shannon linked above, I noticed the error you are seeing and it indicates that Confluence cannot connect to the database:

2018-03-06 15:42:15,612 ERROR [http-nio-6641-exec-3] [[Standalone].[localhost].[/c641].[noop]] log Servlet.service() for servlet [noop] in context with path [/c641] threw exception
com.atlassian.confluence.tenant.VacantException: Confluence is vacant, a call to tenanted [public abstract org.hibernate.Session org.hibernate.SessionFactory.getCurrentSession() throws org.hibernate.HibernateException] is not allowed.

The article mentions:

Which just shows that Confluence is unable to connect to its database. Further analysis of the atlassian-confluence.log will highlight other reasons for this error.

Please examine the log at <Confluence Home>/logs/atlassian-confluence.log for database related errors that are more specific.

Please verify network connectivity between the Confluence server and the database server if they are on separate hosts.

Thanks,

Ann

Evren July 10, 2018

Hi Ann,

The database server runs on the same machine and there is no restriction. Also, i can see that confluence creates some tables and records some entries in the database.

Here is the errors from atlassian-confluence.log:

2018-07-10 11:22:09,901 ERROR [http-nio-8290-exec-8] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
 -- referer: https://<my-domain>/setup/setupdbtype-start.action | url: /setup/setupdbtype.action | traceId: 00611b7580a1cca4 | userName: anonymous
java.util.concurrent.CompletionException: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
    at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:824)
    at java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:834)
    at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2155)
    at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:110)
    at com.atlassian.confluence.impl.concurrency.CompletionStageUtils.foldResult(CompletionStageUtils.java:19)
    at com.atlassian.confluence.impl.vcache.SynchronousExternalCache.get(SynchronousExternalCache.java:236)
    at com.atlassian.confluence.setup.bandana.ConfluenceCachingBandanaPersister.retrieve(ConfluenceCachingBandanaPersister.java:78)
    at com.atlassian.confluence.setup.bandana.ConfluenceCachingBandanaPersister.retrieve(ConfluenceCachingBandanaPersister.java:71)
    at com.atlassian.bandana.DefaultBandanaManager.getValue(DefaultBandanaManager.java:32)
    at com.atlassian.bandana.DefaultBandanaManager.getValue(DefaultBandanaManager.java:24)
    at com.atlassian.confluence.setup.settings.DefaultDarkFeaturesManager.getSiteEnabledFeatures(DefaultDarkFeaturesManager.java:60)
    at com.atlassian.confluence.setup.settings.DefaultDarkFeaturesManager.getDarkFeaturesAllUsers(DefaultDarkFeaturesManager.java:81)
    ...
Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
    at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:224)
    at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:366)
    at org.springframework.orm.hibernate5.HibernateTemplate.execute(HibernateTemplate.java:313)
    at com.atlassian.confluence.setup.bandana.persistence.dao.hibernate.HibernateConfluenceBandanaRecordDao.getRecord(HibernateConfluenceBandanaRecordDao.java:42)
    at com.atlassian.confluence.setup.bandana.ConfluenceDaoBandanaPersister.retrieve(ConfluenceDaoBandanaPersister.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy153.retrieve(Unknown Source)
    at com.atlassian.confluence.setup.bandana.ConfluenceCachingBandanaPersister.lambda$retrieve$0(ConfluenceCachingBandanaPersister.java:80)
    at com.atlassian.confluence.impl.vcache.SynchronousExternalCache.lambda$get$11(SynchronousExternalCache.java:239)
    at com.atlassian.confluence.impl.concurrency.CompletionStageUtils.lambda$foldResult$0(CompletionStageUtils.java:19)
    at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:822)
    ... 321 more
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:80)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:2123)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1911)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)
    at org.hibernate.loader.Loader.doQuery(Loader.java:932)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)
    at org.hibernate.loader.Loader.doList(Loader.java:2615)
    at org.hibernate.loader.Loader.doList(Loader.java:2598)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430)
    at org.hibernate.loader.Loader.list(Loader.java:2425)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:370)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1481)
    at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1441)
    at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1410)
    at com.atlassian.confluence.setup.bandana.persistence.dao.hibernate.HibernateConfluenceBandanaRecordDao.lambda$getRecord$0(HibernateConfluenceBandanaRecordDao.java:46)
    at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:359)
    ... 341 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation "bandana" does not exist
  Position: 181
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2476)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2189)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
    at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:117)
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:379)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:71)
    ... 358 more
2018-07-10 11:22:09,916 ERROR [http-nio-8290-exec-8] [engine.jdbc.spi.SqlExceptionHelper] logExceptions ERROR: relation "bandana" does not exist
  Position: 181
 -- referer: https://<my-domain>/setup/setupdbtype-start.action | url: /setup/setupdbtype.action | traceId: 00611b7580a1cca4 | userName: anonymous
2018-07-10 11:22:09,918 WARN [http-nio-8290-exec-8] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:
  ->[com.atlassian.confluence.setup.bandana.ConfluenceDaoBandanaPersister.retrieve]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly (Session #2077414223)
 -- referer: https://<my-domain>/setup/setupdbtype-start.action | url: /setup/setupdbtype.action | traceId: 00611b7580a1cca4 | userName: anonymous

Here is the tables created in the confluence database:

                      List of relations
 Schema |            Name            | Type  |     Owner      
--------+----------------------------+-------+----------------
 public | EVENTS                     | table | confluenceuser
 public | SECRETS                    | table | confluenceuser
 public | SNAPSHOTS                  | table | confluenceuser
 public | attachmentdata             | table | confluenceuser
 public | audit_affected_object      | table | confluenceuser
 public | audit_changed_value        | table | confluenceuser
 public | auditrecord                | table | confluenceuser
 public | bandana                    | table | confluenceuser
 public | bodycontent                | table | confluenceuser
 public | clustersafety              | table | confluenceuser
 public | confancestors              | table | confluenceuser
 public | confversion                | table | confluenceuser
 public | content                    | table | confluenceuser
 public | content_label              | table | confluenceuser
 public | content_perm               | table | confluenceuser
 public | content_perm_set           | table | confluenceuser
 public | content_relation           | table | confluenceuser
 public | contentproperties          | table | confluenceuser
 public | cwd_app_dir_group_mapping  | table | confluenceuser
 public | cwd_app_dir_mapping        | table | confluenceuser
 public | cwd_app_dir_operation      | table | confluenceuser
 public | cwd_application            | table | confluenceuser
 public | cwd_application_address    | table | confluenceuser
 public | cwd_application_attribute  | table | confluenceuser
 public | cwd_directory              | table | confluenceuser
 public | cwd_directory_attribute    | table | confluenceuser
 public | cwd_directory_operation    | table | confluenceuser
 public | cwd_group                  | table | confluenceuser
 public | cwd_group_attribute        | table | confluenceuser
 public | cwd_membership             | table | confluenceuser
 public | cwd_user                   | table | confluenceuser
 public | cwd_user_attribute         | table | confluenceuser
 public | cwd_user_credential_record | table | confluenceuser
 public | decorator                  | table | confluenceuser
 public | diagnostics_alerts         | table | confluenceuser
 public | extrnlnks                  | table | confluenceuser
 public | follow_connections         | table | confluenceuser
 public | hibernate_unique_key       | table | confluenceuser
 public | imagedetails               | table | confluenceuser
 public | indexqueueentries          | table | confluenceuser
 public | journalentry               | table | confluenceuser
 public | keystore                   | table | confluenceuser
 public | label                      | table | confluenceuser
 public | likes                      | table | confluenceuser
 public | links                      | table | confluenceuser
 public | logininfo                  | table | confluenceuser
 public | notifications              | table | confluenceuser
 public | os_propertyentry           | table | confluenceuser
 public | pagetemplates              | table | confluenceuser
 public | plugindata                 | table | confluenceuser
 public | remembermetoken            | table | confluenceuser
 public | scheduler_clustered_jobs   | table | confluenceuser
 public | scheduler_run_details      | table | confluenceuser
 public | spacepermissions           | table | confluenceuser
 public | spaces                     | table | confluenceuser
 public | trackbacklinks             | table | confluenceuser
 public | trustedapp                 | table | confluenceuser
 public | trustedapprestriction      | table | confluenceuser
 public | user_mapping               | table | confluenceuser
 public | user_relation              | table | confluenceuser
 public | usercontent_relation       | table | confluenceuser
(61 rows)

Thanks,

Evren

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 10, 2018

Hi Evren,

The log snippet indicates the bandana table has not been created and the setup expects it to be there.

Please try these steps:

  1. Drop the current database
  2. Set up a database and database user exactly as documented in: Database Setup for PostgreSQL
  3. Delete <Confluence_Home>/confluence.cfg.xml
  4. Start Confluence
  5. Run through the setup wizard again

I look forward to hearing whether the setup works after verifying the database configuration.

Thanks,

Ann

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 10, 2018

Oops! Our posts crossed. Please make sure the user defined in the <Confluence_Home>/confluence.cfg.xml (confluenceuser?) is the owner of the database. My plain vanilla (no third party plugins) installation of Confluence 6.10 has 104 tables where your instance has 61. My guess is that your database user does not have the necessary permissions on the database to do everything needed to complete the setup.

Evren July 10, 2018

Hi Ann,

That is weird. "confluenceuser" is the owner of the database. Here is the commands i run to set it up in postgresql:

CREATE USER confluenceuser WITH PASSWORD 'XXXX';
CREATE DATABASE confluence WITH OWNER confluenceuser ENCODING 'UTF8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
GRANT ALL PRIVILEGES ON DATABASE confluence to confluenceuser;

Do i miss something here?

Thanks,

Evren

Evren July 10, 2018

Hi Ann,

I finally got it working. I think confluence has some issues with the setup wizard.

Here is what i did:

1. Delete <Confluence_Home>/confluence.cfg.xml on top of the broken setup.

2. Restart the setup wizard, but choose the evaluation license in the production setup. (i was entering my license before)

3. Use the same database configuration

4. Choose the option to overwrite the existing database

5. Everything works fine.

Thanks for your support,

Evren

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 10, 2018

I am so happy to hear that you resolved the issue. I am not sure why it worked with the evaluation license as that shouldn't make any difference, but I can't argue with success!

Admin David Tonhofer May 2, 2019

Semi-related, I had a similar problem with "ERROR: relation "bandana" does not exist" in the Confluence log (i.e. /var/atlassian/application-data/confluence/logs/atlassian-confluence.log).

In the end it was due to a problem with the PostgreSQL database restore operation (pg_restore) which for some reason erased the access rights to the public schema, making the "bandana" table invisible to the database role that wanted to read it:

# \dn+
List of schemas Name | Owner | Access privileges | Description
--------+----------+-------------------+------------------------ public | postgres | | standard public schema (1 row)

I had to fix the permissions in PostgreSQL:

GRANT USAGE,CREATE ON SCHEMA public TO postgres;
GRANT USAGE,CREATE ON SCHEMA public TO PUBLIC;
confluence=# \dn+
List of schemas Name | Owner | Access privileges | Description
--------+----------+----------------------+------------------------ public | postgres | postgres=UC/postgres+| standard public schema | | =UC/postgres | (1 row)

 See also https://www.postgresql.org/docs/10/sql-grant.html

The things one encounters!

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events