Unknown Server Error in Confluence from using Atlassian's Space Blueprint Tutorial
Asked by rashaveraka:

Hello,

I am working on developing a space blueprint, having done this successfully for a client using an older version of Confluence (6.7ish). However, I have noticed that, upon uninstalling or disabling the space blueprint plugin during testing, clicking on "Create Space" results in "Unknown Server Error". Examination of the logfiles reveals the following occurs each time the "Create Space" link is clicked:

```
[INFO] [talledLocalContainer] 2019-02-07 13:05:47,823 WARN [http-nio-1990-exec-3] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:
[INFO] [talledLocalContainer] ->[PluginReadWriteTx]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #1303486283)
[INFO] [talledLocalContainer] -- referer: http://desktop-3msduqn:1990/confluence/plugins/servlet/upm | url: /confluence/rest/create-dialog/1.0/space-blueprint/dialog/web-items | traceId: 6e82d9a1ee1790af | userName: admin
```

Steps to reproduce:

1. Install the latest Atlassian SDK as per <https://developer.atlassian.com/server/framework/atlassian-sdk/install-the-atlassian-sdk-on-a-windows-system/>
2. Navigate to the instruction set for creating a space blueprint: <https://developer.atlassian.com/server/confluence/write-a-simple-confluence-space-blueprint/>
3. Clone the repository located in those instructions that contains the completed space blueprint plugin to a folder on your local machine:  

   ```
   git clone git@bitbucket.org:atlassian_tutorial/confluence-space-blueprint.git
   ```

4. Open a command prompt (on windows) and navigate to the folder that you cloned the repository into.
5. Build and run the plugin by typing the following command into the command prompt:

   ```
   atlas-run
   ```

6. Open up a browser window and navigate to http://localhost:1990/confluence/ (or whichever link you use to access the local instance of confluence you just started).
7. Login using admin/admin as username/password.
8. Click on the Confluence Administration cog wheel in the upper right hand corner, and then click "Manage Apps."
9. Click on "Upload App."
10. Navigate to the directory you cloned the repository into, and click on the "target" folder (if this folder doesn't exist, you need to run atlas-run).
11. Select the space-blueprint-1.0-SNAPSHOT.jar file and click "Upload."
12. Refresh the page, and select "Create space" under the Spaces dropdown. Note that the Example Space Blueprint is listed as an option, and you can successfully create a space if you wish to test that.
13. Go back to Confluence Administration-\>Manage Apps, and uninstall the plugin you just installed.
14. Refresh the page, and select "Create space" under the Spaces dropdown. Note that no error occurs.
15. Select the command prompt, and hit Ctrl-C to kill the server instance currently running (you may have to navigate to Task Manager and kill a process named "Java SE Platform Binary" in order to completely kill the server).
16. After the server has stopped, type the following command into the command prompt:

    ```
    atlas-clean
    ```

17. Open pom.xml in your favorite text editor (or open as a project in IDEA or other IDE).
18. Change the confluence versions and data versions in the properties block from this (I also tried modifying my amps.version to 6.21, but it didn't fix anything):

    ```
    <properties>
        <confluence.version>6.7.1</confluence.version>
        <confluence.data.version>6.7.1</confluence.data.version>
        <amps.version>6.3.15</amps.version>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    ```

    to this:

    ```
    <properties>
        <confluence.version>6.14.0</confluence.version>
        <confluence.data.version>6.14.0</confluence.data.version>
        <amps.version>6.3.15</amps.version>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    ```

19. Repeat steps 4 through 13.
20. Refresh the page.
21. Click on "Create Space" under the Spaces tab, and note the "Unknown Server Error" message you receive.
22. In the command prompt, look at the log output. You should see an error like the following:

    ```
    [INFO] [talledLocalContainer] 2019-02-07 15:35:17,015 WARN [http-nio-1990-exec-8] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:
    [INFO] [talledLocalContainer] ->[PluginReadWriteTx]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #1567347778)
    [INFO] [talledLocalContainer] -- referer: http://localhost:1990/confluence/plugins/servlet/upm | url: /confluence/rest/create-dialog/1.0/space-blueprint/dialog/web-items | traceId: 04182b73ba117a25 | userName: admin
    ```

Effects:

At this point you cannot create spaces again, even after restarting confluence. Disabling the plugin will cause the error while the plugin is disabled, but after re-enabling the error disappears. Uninstalling the plugin entirely will make the error (and thus inability to create spaces) permanent, until you perform the workaround below.

Workaround:

Once you have received the "unknown server error", you have to drop some tables and clear the plugin cache in order to be able to create a space again. I followed the instructions located here:

<https://confluence.atlassian.com/confkb/creating-new-page-or-space-loads-forever-744329880.html?_ga=2.38467818.813391250.1549382204-1439335163.1544544516>

However, all this does is resolve the inability to create a space. Once you re-install the space blueprint plugin again and then disable or uninstall it (as happens frequently during testing!), you will once again be unable to create spaces until you perform the work-around again.  

This error does not occur if I'm using Confluence 6.7.1, but occurs in 6.12.2 and 6.14.0. I've tested this both with the built-in database created when you perform an atlas-run on the plugin, and also in my development PostgreSQL 9.6 DB.

Essentially, what this means for me is that I cannot create a space blueprint plugin and deliver it to my client, because if they ever need to remove the plugin, it will "corrupt" the database (specifically the tables listed in the workaround).  

Searching for issues related to the error I'm experiencing, I found the following:  

<https://community.atlassian.com/t5/Confluence-questions/Cannot-create-a-space-after-upgrade-to-6-12-0/qaq-p/930030>  
<https://confluence.atlassian.com/confkb/unable-to-create-pages-the-create-page-popup-loads-forever-after-confluence-upgrade-to-5-x-330793034.html?_ga=2.45412717.813391250.1549382204-1439335163.1544544516>  
<https://community.atlassian.com/t5/Confluence-questions/Cannot-create-a-space/qaq-p/903500>

I have not found a method that prevents this error from occurring.

Are there any changes I need to make to the space blueprint to allow it to work in 6.12+? Is there something I've missed here? I wasn't able to find any bugs that looked specifically like this one, but I'm not the best at searching for existing bugs.


Answers:
author: Don Willis
body: Hi [@rashaveraka](/t5/user/viewprofilepage/user-id/52045) , I think if you check your application logs you'll find a NullPointerException like the one in <https://jira.atlassian.com/browse/CONFSERVER-57943>.

It occurs when a spaceblueprint entry is found without a wizard entry, which I believe happens when a spaceblueprint gets used and then disabled. I'm looking into the bug at the moment and hope to have more insight and a better workaround soon.

comments: author: Petro Semeniuk
body: Hi Don, in my case no NPEs are present in the logs. Only output specified on line 22 is present.


author: Stephen Sifers
body: Hello Ross and welcome to the Community!

We have created a bug request from your notes. Thank you for providing extremely details notes on this issue as it helps when submitting a bug request. You may find your bug request at [CONFSERVER-58001](https://jira.atlassian.com/browse/CONFSERVER-58001). You may watch this request to receive future updates of its status.

Once again, thank you for providing details steps into the issue you're experiencing with the Blueprint tutorial.

Regards,  
Stephen Sifers


author: rashaveraka
body: After a suggestion from a colleague, I turned on diagnostic logging and looked for a "Caused by" entry. None appears in the logs - just the error above occurs each time the "Unknown server error" dialog box popped up.


Tags: bug

confluence-app

confluence-development

confluence-server

questions-for-confluence