0

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?

Oleksandr H
  • 2,965
  • 10
  • 40
  • 58

1 Answers1

0

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/

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Yes, I have this dependency in `pom.xml` – Oleksandr H Jun 08 '23 at 15:04
  • See an UPDATE in my answer. – Artem Bilan Jun 08 '23 at 16:53
  • After adding `spring.schemas` and `spring.handlers` from spring-integration I see `Failed to parse configuration class [com.my.plugin.service.MyChannel]; nested exception is java.io.FileNotFoundException: OSGi resource[classpath:org/springframework/integration/channel/DirectChannel.class|bnd.id=189|bnd.sym=com.my.plugin] cannot be resolved to URL because it does not exist [INFO] [talledLocalContainer] OSGi resource[classpath:org/springframework/integration/channel/DirectChannel.class|bnd.id=189|bnd.sym=com.my.plugin] cannot be resolved to URL because it does not exist` – Oleksandr H Jun 09 '23 at 09:01
  • 1
    I'm not familiar with OSGi and AFAIK we don't support it in Spring for years, like 10 or so. – Artem Bilan Jun 09 '23 at 13:50