Oleksandr H
Oleksandr H

Reputation: 3015

Use Spring Integration in Jira Plugin Development

I'm trying to use Spring Integration module in my Jira plugin. When I'm starting it I see following error:

[INFO] [talledLocalContainer]     
[INFO] [talledLocalContainer]     1 plugin failed to load during JIRA startup.
[INFO] [talledLocalContainer]     
[INFO] [talledLocalContainer]           abcbcbabqbasbsad  failed to load.
[INFO] [talledLocalContainer]                   Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.atlassian.com/schema/atlassian-scanner/2]
[INFO] [talledLocalContainer]     Offending resource: URL [bundle://189.0:0/META-INF/spring/plugin-context.xml]

Content of META-INF/spring/plugin-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:int="http://www.springframework.org/schema/integration"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner/2"
       xmlns:beans="http://www.springframework.org/schema/c"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/integration
        https://www.springframework.org/schema/integration/spring-integration.xsd
        http://www.atlassian.com/schema/atlassian-scanner/2
        http://www.atlassian.com/schema/atlassian-scanner/2/atlassian-scanner.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd">
    <atlassian-scanner:scan-indexes/>
    <context:component-scan base-package="com.my.plugin"/>
    <beans:bean id="myMessageGroupStore" class="com.my.plugin.service.MyMessageGroupStore"/>
</beans>

pom.xml content:

<dependency>
     <groupId>org.springframework.integration</groupId>
     <artifactId>spring-integration-core</artifactId>
     <version>5.2.11.RELEASE</version>
</dependency>
<dependency>
    <groupId>com.atlassian.plugin</groupId>
    <artifactId>atlassian-spring-scanner-annotation</artifactId>
    <version>${atlassian.spring.scanner.version}</version>
    <scope>provided</scope>
</dependency>

In my bean AbstractMessageGroupStore is abstract class from spring-integration module:

@Service
@NoArgsConstructor
@AllArgsConstructor
public class ServerMessageGroupStore extends AbstractMessageGroupStore {

    @Autowired
    private ActiveObjects ao;
...
}

How to fix this? Is it possible to use spring-integration in jira plugin?

Upvotes: 0

Views: 309

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

The error has nothing to do with Spring Integration. It complains that cannot find http://www.atlassian.com/schema/atlassian-scanner/2 XSD for those Atlassian custom tags.

You need to be sure that you have this dependency or so:

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

See more info in their documentation: https://bitbucket.org/atlassian/atlassian-spring-scanner/src/master/

UPDATE

OK. Looking to the error one more time:

Unable to locate Spring NamespaceHandler for XML schema namespace

The problem is that that atlassian-spring-scanner-annotation doesn't have a spring.handlers file in the /META-INF alongside with that spring.schemas: https://bitbucket.org/atlassian/atlassian-spring-scanner/src/master/atlassian-spring-scanner-annotation/src/main/resources/META-INF/

So, this is a bug in that Atlassian Scanner project. But at the same time they suggest to move to annotation model from now on: https://developer.atlassian.com/server/framework/atlassian-sdk/spring-java-config-spring-scanner/

Upvotes: 0

Related Questions