Page not found error in writing a space admin screen tutorial :(

Hi,

I was wondering if someone could help me. I’ve been patiently working my way through the writing a space admin screen tutorial. When I go into confluence the plugin is there but it says it is disabled due to an error (see below)

2020-06-23 12:31:42,658 ERROR [main] [atlassian.plugin.manager.DefaultPluginManager] enableConfiguredPluginModule There was an error loading the descriptor 'Quick Link Manager in Space Admin' of plugin 'com.example.plugin.tutorial.confluence.tutorial-confluence-notification2'. Disabling.

Caused by: com.atlassian.plugin.PluginParseException: Unable to load the module's display conditions: java.lang.ClassNotFoundException: com.atlassian.confluence.plugin.descriptor.web.conditions.SpacePermissionCondition not found by com.example.plugin.tutorial.confluence.tutorial-confluence-notification2 [288]

When I go into my atlassian-plugin.xml and delete the line

<condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpaceSidebarCondition"/>

the plugin enables. However when I click on apps under spacetools it says page not found.

Ensure that you have both added a Maven Dependency as well as informed SpringScanner: SpringScanner would require you to state which packages you want to import under instructions.

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-confluence-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
    <configuration>
        <instanceId>confluence</instanceId>
        <productVersion>${confluence.version}</productVersion>
        <productDataVersion>${confluence.data.version}</productDataVersion>
        <!-- <productDataPath>${project.basedir}/src/test/resources/generated-test-resources.zip</productDataPath> -->
        <compressResources>true</compressResources>
        <enableFastdev>false</enableFastdev>
        <instructions>
            <!-- Add package to export here -->
            <Import-Package>
                org.springframework.osgi.*;resolution:="optional",
                org.eclipse.gemini.blueprint.*;resolution:="optional",
                com.atlassian.plugin.osgi.bridge.external,
                com.atlassian.confluence.plugin.descriptor.web.conditions.user;resolution:="optional",
                com.atlassian.confluence.plugin.descriptor.web.conditions;resolution:="optional",
                com.atlassian.confluence.mail.notification.actions;resolution:="optional",
                *;resolution:=optional
            </Import-Package>
        </instructions>
    </configuration>
</plugin>

Hi @sfbehnke

Thank you for your response however I am getting the same error after implementing this change. This is my pom.xml. And I’ve also posted my atlassian-plugin.xml, my space.admin.html decorator and MyAdminAction.java as I think this may be part of the issue.

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example.plugin.tutorial.confluence</groupId>
    <artifactId>tutorial-confluence-notification2</artifactId>
    <version>1.0-SNAPSHOT</version>
		

    <organization>
        <name>Example Company</name>
        <url>http://www.example.com/</url>
    </organization>

    <name>tutorial-confluence-notification2</name>
   <description>Allow administrators to send notifications to all wiki users.</description>
    <packaging>atlassian-plugin</packaging>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>

        <!-- WIRED TEST RUNNER DEPENDENCIES -->
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
            <version>${plugin.testrunner.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.2-atlassian-1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>confluence-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${confluence.version}</productVersion>
                    <productDataVersion>${confluence.data.version}</productDataVersion>
                    <enableQuickReload>true</enableQuickReload>
					
					<!--log output-->
					<output>${project.build.directory}/confluence/home/logs/atlassian-confluence.log</output>

                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

                        <!-- Add package to export here -->
                        <Export-Package>
                            com.example.plugins.tutorial.confluence.notification.api,
                        </Export-Package>

                        <!-- Add package import here -->
                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
							org.eclipse.gemini.blueprint.*;resolution:="optional",
							com.atlassian.plugin.osgi.bridge.external,
							com.atlassian.confluence.plugin.descriptor.web.conditions.user;resolution:="optional",
							com.atlassian.confluence.plugin.descriptor.web.conditions;resolution:="optional",
							com.atlassian.confluence.mail.notification.actions;resolution:="optional",
							*;resolution:=optional
                        </Import-Package>

                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian.spring.scanner.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.plugin</groupId>
                            <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                        </dependency>
                    </scannedDependencies>
                    <verbose>false</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <confluence.version>6.14.0</confluence.version>
        <confluence.data.version>6.14.0</confluence.data.version>
        <amps.version>8.0.2</amps.version>
        <plugin.testrunner.version>2.0.1</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
        <!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
        <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>

</project>

atlassian-plugin.xml

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>
    </plugin-info>

    <resource type="i18n" name="i18n" location="space-links"/>
	

	     <!-- Item in Space Tools -->
	<web-item key="space-admin-quick-link-manager" name="Quick Link Manager in Space Admin" section="system.space.tools/addons" weight="100">
		<label key="space.admin.quick.link.manager" />
		<link linkId="space-admin-quick-link-manager-id">/plugins/${project.artifactId}/add-link.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
	</web-item>
	
	<xwork name="Example Actions" key="example-actions">
		<description>Examples of actions</description>
		<package name="space-links-xwork-package" extends="default" namespace="/plugins/${project.artifactId}">
			<default-interceptor-ref name="validatingStack"/>
 
			<action name="add-link" class="com.atlassian.examples.MyAction" method="doCreate">
				<result name="input" type="velocity">/templates/add-link-action.vm</result>
				<result name="success" type="velocity">/templates/add-link-action.vm</result>
			</action>
 
			<action name="mixed" class="com.atlassian.examples.MixedAction" method="doDefault">
				<result name="input" type="velocity">/templates/mixed-space-screen.vm</result>
			</action>
		</package>
	</xwork>
	

    

</atlassian-plugin>

space.admin.html

<html>
    <head>
        <title>$action.getText("add.link.action")</title>
        <meta name="decorator" content="space.admin"/>
        <!-- Key of the web-item to highlight in Space Tools -->
        <content tag="space.admin.tools.selected">space-admin-quick-link-manager</content>
    </head>
    <body>
         <div class="pagecontent">
              <p>${message}</p>
         </div>
    </body>
</html>

MyAdminAction.java

package com.atlassian.examples;

import com.atlassian.confluence.spaces.actions.SpaceAdminAction;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MyAdminAction extends SpaceAdminAction
{
    @Override
    public String doDefault()
    {
        return INPUT;
    }
}

Hi @DianaBianco, have you found a solution to this? I’m now facing the same issue as you, I’m getting the error that says com.atlassian.confluence.plugin.descriptor.web.conditions.ConfluenceAdministratorCondition not found by my plugin.