Theme Tutorial - Theme Plugin cannot be enabled due to error during startup

Hi,

I am following the SDK tutorial "Writing a Confluence Theme" (https://developer.atlassian.com/confdev/tutorials/writing-a-confluence-theme) and am stuck in step 3, because when I start Confluence via atlas-run, I get an error in the log that the class "com.atlassian.confluence.themes.BasicTheme" cannot be loaded:

com.atlassian.plugin.module.ModuleClassNotFoundException: Couldn't load the class 'com.atlassian.confluence.themes.BasicTheme'. This could mean that you misspelled the name of the class (double check) or that you're using a class in your plugin that you haven't provided bundle instructions for. See https://developer.atlassian.com/x/mQAN for more details on how to fix this.

I am trying to get the custom theme to run out of Eclipse, Confluence itself does start up, but I don't see the theme listed in Configuration -> Look and Feel -> Themes.

Do I need to declare the BasicTheme class somewhere? it shows up in my Eclipse project under Referenced LIbraries > confluence-5.9.1.jar and is correctly referenced in my proiect's atlassian-plugin.xml file.

There is no note in the documentation that I need to do anything to make this class visible.

Can somebody who has successfully gone through this tutorial help me?

 

My system:

Confluence Version: 5.9.1

Atlassian SDK Version 6.1.0

 

7 answers

You need to add com.atlassian.confluence.themes to the <Import-Package> definition in your pom.

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-confluence-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
    <configuration>
        <productVersion>${confluence.version}</productVersion>
        <productDataVersion>${confluence.data.version}</productDataVersion>
        <instructions>
            <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
            <Spring-Context>*</Spring-Context>
            <Export-Package />
            <Import-Package>
                com.atlassian.confluence.themes,
                com.atlassian.confluence.plugin.descriptor,
                org.springframework.osgi.*;resolution:="optional",
                org.eclipse.gemini.blueprint.*;resolution:="optional",
                com.atlassian.plugin.osgi.bridge.external,
                *;resolution:=optional
            </Import-Package>
        </instructions>
    </configuration>
</plugin>

Unfortunately not sad

Hi,

Did you find an answer to this yet?

bump. I am also stuck on this one. 

I made this work by doing the follow workaround: Create an empty class that just extends the above BasicTheme. (I didn't have need for overriding methods). In the atlassian-plugin.xml declare as class newly created class and in the pom import the 

com.atlassian.confluence.*;resolution:="optional"

You need to add com.atlassian.confluence.themes to the <Import-Package> definition in your pom.

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-confluence-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
    <configuration>
        <productVersion>${confluence.version}</productVersion>
        <productDataVersion>${confluence.data.version}</productDataVersion>
        <instructions>
            <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
            <Spring-Context>*</Spring-Context>
            <Export-Package />
            <Import-Package>
                com.atlassian.confluence.themes,
                com.atlassian.confluence.plugin.descriptor,
                org.springframework.osgi.*;resolution:="optional",
                org.eclipse.gemini.blueprint.*;resolution:="optional",
                com.atlassian.plugin.osgi.bridge.external,
                *;resolution:=optional
            </Import-Package>
        </instructions>
    </configuration>
</plugin>

You need to add com.atlassian.confluence.themes to the <Import-Package> definition in your pom.

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-confluence-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
    <configuration>
        <productVersion>${confluence.version}</productVersion>
        <productDataVersion>${confluence.data.version}</productDataVersion>
        <instructions>
            <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
            <Spring-Context>*</Spring-Context>
            <Export-Package />
            <Import-Package>
                com.atlassian.confluence.themes,
                com.atlassian.confluence.plugin.descriptor,
                org.springframework.osgi.*;resolution:="optional",
                org.eclipse.gemini.blueprint.*;resolution:="optional",
                com.atlassian.plugin.osgi.bridge.external,
                *;resolution:=optional
            </Import-Package>
        </instructions>
    </configuration>
</plugin>

Thanks, I'll try this out when I have time :)

(Sorry, I forgot to reply to your initial answer)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in United States

Confluence Security Advisory

Good morning Members, Not sure if you are aware. Please read the following: https://www.icloud.com/keynote/0RyJ4VEdNUpjDpGfMhfZx9fEg#Confluence_Security_Advisor More details: https://co...

61 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you