It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Birgit Matuolis Dec 02, 2015

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

2 votes
TtheB Sep 19, 2016 • edited Aug 13, 2017

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>
1 vote
Birgit Matuolis Feb 29, 2016

Unfortunately not sad

0 votes
Andrei Cocari Feb 28, 2016

Hi,

Did you find an answer to this yet?

0 votes
Panagiotis Karampis Jul 14, 2016

bump. I am also stuck on this one. 

0 votes
Panagiotis Karampis Jul 14, 2016

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"
0 votes
TtheB Aug 13, 2017

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>
0 votes
TtheB Aug 13, 2017

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>
Birgit Matuolis Aug 16, 2017

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in United States

Topic Tuesday: Agile

Another week, another Topic Tuesday!  Agile has been on my mind a lot lately because I've seen good implementations and bad implementations, but now as a Jira admin it matters more to me whether...

39 views 0 0
View post

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you