JS Syntax and Reference errors after Confluence upgrade to 5.0.2
Asked by Nicholas Sideras:

I upgraded from 4.3 to 5.02 this morning, and in the process it looks like some javascript broke. When I load Confluence, it looks like CSS isn't loading, and I see the following line on top of the page in my browser
> $soyTemplateRendererHelper.getRenderedTemplateHtml("com.atlassian.auiplugin:aui-experimental-soy-templates", "aui.page.header.soy", $templateParameters)

Additionally, I see the following errors in my browser

```
Uncaught SyntaxError: Unexpected identifier batch.js:1871Uncaught ReferenceError: AJS is not defined confluence.web.resources:login.js:1Uncaught ReferenceError: placeFocus is not defined login.action:88
```

I've tried restarting the server and re-running the upgrade, but neither helped.

Here's my stderr log:

```
2013-03-11 11:45:02 Commons Daemon procrun stderr initializedMar 11, 2013 11:45:02 AM org.apache.tomcat.util.digester.SetPropertiesRule beginWARNING: [SetPropertiesRule]{Server} Setting property 'debug' to '0' did not find a matching property.Mar 11, 2013 11:45:02 AM org.apache.tomcat.util.digester.SetPropertiesRule beginWARNING: [SetPropertiesRule]{Server/Service/Engine} Setting property 'debug' to '0' did not find a matching property.Mar 11, 2013 11:45:02 AM org.apache.tomcat.util.digester.SetPropertiesRule beginWARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'debug' to '0' did not find a matching property.Mar 11, 2013 11:45:02 AM org.apache.tomcat.util.digester.SetPropertiesRule beginWARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.Mar 11, 2013 11:45:03 AM org.apache.coyote.http11.Http11Protocol initINFO: Initializing Coyote HTTP/1.1 on http-80Mar 11, 2013 11:45:03 AM org.apache.coyote.http11.Http11Protocol initINFO: Initializing Coyote HTTP/1.1 on http-443Mar 11, 2013 11:45:03 AM org.apache.catalina.startup.Catalina loadINFO: Initialization processed in 966 msMar 11, 2013 11:45:03 AM org.apache.catalina.core.StandardService startINFO: Starting service Tomcat-StandaloneMar 11, 2013 11:45:03 AM org.apache.catalina.core.StandardEngine startINFO: Starting Servlet Engine: Apache Tomcat/6.0.35Mar 11, 2013 11:45:54 AM org.apache.coyote.http11.Http11Protocol startINFO: Starting Coyote HTTP/1.1 on http-80Mar 11, 2013 11:45:54 AM org.apache.coyote.http11.Http11Protocol startINFO: Starting Coyote HTTP/1.1 on http-443Mar 11, 2013 11:45:54 AM org.apache.catalina.startup.Catalina startINFO: Server startup in 50976 ms
```

And my stdout log:

```
2013-03-11 11:45:02 Commons Daemon procrun stdout initialized2013-03-11 11:45:05,510 INFO [main] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 5.0.2 [build 4108 based on commit hash b47156ace146e4f759b49ef98258cb637bdd5af8]2013-03-11 11:45:08,646 WARN [main] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml7274199780793782864tmp to C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml. Falling back to non-atomic overwrite.
```

Obviously there's a few warnings in there, but from what I could tell in my searching, they probably don't mean much. Feel free to correct me if I'm wrong!


Answers:
author: Nicholas Sideras
body: After contacting support, I found out that this can happen when the upgrade tasks don't run. I reverted to my database and home directory backups and re-ran the upgrade, and now everything is working correctly.

I suspect this happened because I stopped the server to re-enable SSL in the server config files, but I must have stoppped it too soon. During the second upgrade I made to sure to let the installer open Confluence in a local browser, and then I waited for that page to fully load. Once I new the upgrade was working, then I stopped the server to make my changes.


author: Ruchi Tandon
body: I just figured out that the problem could also be caused due to the fact that not all modules of the Soy plugin are enabled. Please refer to this KB article : [Comment Box Disappears: $soyTemplateRendererHelper.getRenderedTemplateHtml](https://confluence.atlassian.com/display/CONFKB/Comment+Box+Disappears%3A+$soyTemplateRendererHelper.getRenderedTemplateHtml) and verify that all modules are enabled and then restart the instance. Hopefully that should resolve the problem.


author: Martin Savard
body: Do you mean computer/server restart or the confluence tomcat restart ?

comments: author: luki puki
body: to be honest, i already forgot. i'm running confluence within a virtual machine in my desktop, so either it was tomcat, or virtual server, or at last, the desktop pc restart.


author: luki puki
body: i have the same exact problem, except i did a fresh installation, not an upgrade.

i ran confluence via the \*.bin installation file in a fresh virtualized virtualbox ubuntu 12.04LTS 64bit OS.

after installation i restarted the whole server, the license key page appeard and i continued with the setup installation. later on, right after the key page (took a lot of time to load the second page while some java process eat 100% cpu, but it loaded and i did not kill anything), the folowing pages remain broken, like there was none css (in fact css files loaded OK but some javascript is broken).

how should i proceed? try to install it all over again?

comments: author: luki puki
body: problem solved after system restart


author: stuartu
body: I upgraded a test Confluence 4.3.7 system this morning to 5.0.2, and on browsing the URL for the first time, I also had a similar error message, along with the main page looking rather wonky.

"Error formatting macro: recently-updated-dashboard: com.atlassian.confluence.renderer.template.TemplateRenderingException: Unable to compile Soy template in plugin module: confluence.macros.dashboard:dashboard-macros-resources"

It came right after I bounced Confluence. I presume yours did too?

comments: author: Nicholas Sideras
body: Stuartu,

Check out the answer I left. You may have restarted the server before the upgrade tasks completed.


author: Nicholas Sideras
body: I had to look up the URL for the admin/viewplugins.action page since the admin page seems to be missing a link to it, but it looks like the bulk of the plugins are disabled. It could be that the Plugin Manager is just showing more stuff since the formatting is missing, so I'm not sure if this is relevant or not.


Tags: javascript