Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www
Asked by Diana Bianco:

Hi so I've been trying to write an admin space screen using the servlet method. the tutorial can be found here at this link <https://developer.atlassian.com/server/confluence/writing-a-space-admin-screen/>

I'm running spring scanner version 2.0.0 and confluence version 7.5.2

However my plugin won't enable.

in my atlassian-confluence.log it says the following:

```
2020-08-25 12:53:35,304 ERROR [ThreadPoolAsyncTaskExecutor::Thread 28] [internal.dependencies.startup.DependencyWaiterApplicationContextExecutor] fail Unable to create application context for [com.atlassian.yay5.servletonly5], unsatisfied dependencies: none
 -- referer: http://ud22:1990/confluence/plugins/servlet/upm | url: /confluence/rest/plugins/1.0/com.atlassian.yay5.servletonly5-key | traceId: 07208aa0fa616b23 | userName: admin
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.atlassian.com/schema/atlassian-scanner/2]
Offending resource: URL [bundle://301.0:0/META-INF/spring/plugin-context.xml]
```

below you will also find some other documents that might help.

pom.xml

```
<?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.atlassian.yay5</groupId>
    <artifactId>servletonly5</artifactId>
    <version>1.0.0-SNAPSHOT</version>

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

    <name>servletonly5</name>
    <description>This is the com.atlassian.yay5:servletonly5 plugin for Atlassian Confluence.</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>provided</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>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <version>4.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <version>4.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.1.8.RELEASE</version>
            <scope>provided</scope>
        </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.atlassian.yay5.api,
                        </Export-Package>

                        <!-- Add package import here -->
                        <Import-Package>
                            com.atlassian.confluence.plugin.descriptor.web.conditions,*;resolution:="optional",
                            com.atlassian.confluence.content.ui,*;resolution:="optional",
                            com.atlassian.confluence.themes,*;resolution:="optional",
                            com.atlassian.confluence.status.service,*;resolution:="optional",
                            com.atlassian.confluence.security.login,*;resolution:="optional",
                            com.atlassian.confluence.mail.notification,*;resolution:="optional",
                            com.atlassian.confluence.labels,*;resolution:="optional",
                            com.atlassian.confluence.setup.settings,*;resolution:="optional",
                            com.atlassian.confluence.content.service,*;resolution:="optional",
                            com.atlassian.confluence.license,*;resolution:="optional",
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;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>
                        <!-- process-classes seems to be skipped if you are using scala
                             so perhaps use prepare-package -->
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <!-- Enable this to get build-time logging of annotations atlassian-spring-scanner-maven-plugin has noticed -->
                    <verbose>false</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <confluence.version>7.5.2</confluence.version>
        <confluence.data.version>7.5.2</confluence.data.version>
        <amps.version>8.0.2</amps.version>
        <plugin.testrunner.version>2.0.1</plugin.testrunner.version>
        <atlassian.spring.scanner.version>2.0.0</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>
```

plugin-context.xml

```
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner/2"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.atlassian.com/schema/atlassian-scanner/2
        http://www.atlassian.com/schema/atlassian-scanner/2/atlassian-scanner.xsd">
    <atlassian-scanner:scan-indexes/>
</beans>
```

I've followed everything in the atlassian-spring-scanner 2.x read me. I am very confused any help would be greatly appreciated.


Answers:
author: Suresh Sakhare
body: Hi,

I updated plugin-context.xml file with spring scanner 2 dependencies and then after its working fine.

\<?xml version="1.0" encoding="UTF-8"?\>  
\<beans xmlns="<http://www.springframework.org/schema/beans>"  
xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"  
xmlns:atlassian-scanner="<http://www.atlassian.com/schema/atlassian-scanner/2>"  
xsi:schemaLocation="<http://www.springframework.org/schema/beans>  
<http://www.springframework.org/schema/beans/spring-beans-2.5.xsd>  
<http://www.atlassian.com/schema/atlassian-scanner/2>  
<http://www.atlassian.com/schema/atlassian-scanner/2/atlassian-scanner.xsd>"\>  
\<atlassian-scanner:scan-indexes/\>  
\</beans\>

Make sure i will clean the package.

Thanks,

Suresh


author: KC Integrations
body: Hi,

Did you resolve this. I was happily running and testing my plugin, then out of the blue I started to get the same error, I made no changes to the pom or the plugin-conext.xml file.

I have had this working for many years and today it just started to fail, I have no idea why???

Talk about frustrating....


Tags: confluence-server

server