Synchrony Fails to Start due to a NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only. This article only applies to Atlassian products on the server and data center platforms.

Problem

When starting Confluence, Synchrony fails to start due to a NullPointerException, thus the Collaborative Editing feature does not work.

The following appears in the atlassian-confluence.log

2016-12-12 12:02:23,680 INFO [synchrony-interop-executor:thread-1] [plugins.synchrony.utils.TomcatConfigHelper] getProxyPort Checking if Tomcat is running behind a reverse proxy in /opt/atlassian/confluence/conf/server.xml...
2016-12-12 12:02:23,700 INFO [synchrony-interop-executor:thread-1] [plugins.synchrony.bootstrap.DefaultSynchronyProcessManager] isSynchronyProxyEnabled proxy port present: true
2016-12-12 12:02:23,819 INFO [Long running task: EnableTask] [plugins.synchrony.tasks.AbstractConfigLongRunningTask] execute Removed 0 stale shared drafts.
2016-12-12 12:02:23,820 ERROR [Long running task: EnableTask] [plugins.synchrony.tasks.AbstractConfigLongRunningTask] runInternal An error occurred when running a Synchrony ConfigLongRunningTask
 -- url: /rest/synchrony-interop/enable | referer: https://baseurl/admin/confluence-collaborative-editor-plugin/configure.action | traceId: 94da089dbd790dfc | userName: admin
java.lang.NullPointerException
	at java.util.Hashtable.put(Hashtable.java:459)
	at java.util.Properties.setProperty(Properties.java:166)
	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.setupEnvironment(DefaultSynchronyProcessManager.java:297)
	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.trySetup(DefaultSynchronyProcessManager.java:502)
	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.lambda$startProcess$1(DefaultSynchronyProcessManager.java:420)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Diagnosis

Diagnostic Steps

  • The database user and password are specified in the connection url, so the following properties are not present in the confluence.cfg.xml file:

     

    <property name="hibernate.connection.password">YOUR_DATABASE_PASS</property>
    <property name="hibernate.connection.username">YOUR_DATABASE_USER</property>

Cause

The problem is on this part of the code: DefaultSynchronyProcessManager.java:297

DefaultSynchronyProcessManager.java
        env.setProperty(SynchronyEnv.JdbcUrl.getEnvName(), connectionUrl);
        env.setProperty(SynchronyEnv.JdbcUser.getEnvName(), credentials.getLeft());
        env.setProperty(SynchronyEnv.JdbcPassword.getEnvName(), credentials.getRight());
        env.setProperty(SynchronyEnv.JwtPublicKey.getEnvName(), (String) config.getProperty(JWT_PUBLIC_KEY));
        env.setProperty(SynchronyEnv.JwtPrivateKey.getEnvName(), (String) config.getProperty(JWT_PRIVATE_KEY));
        String internalBaseUrl = computeInternalBaseUrl();
        if (!serviceUrl.equalsIgnoreCase(internalBaseUrl)) {
            serviceUrl = Joiner.on(",").join(serviceUrl, internalBaseUrl);
        }
        env.setProperty(SynchronyEnv.ServiceUrl.getEnvName(), serviceUrl);
        return ImmutableMap.<String, String>builder()
                .putAll((Map) env)
                .build();
  • On line 297, Synchrony is trying to retrieve the database user, which was not specified in the confluence.cfg.xml file, so the NPE occurs.

Resolution

To fix this problem, make sure to specify both the database username and password in the confluence.cfg.xml file, located under the <confluence-home> directory. These lines should be added there:

<property name="hibernate.connection.password">YOUR_DATABASE_PASS</property>
<property name="hibernate.connection.username">YOUR_DATABASE_USER</property>
Last modified on Dec 14, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.