Updating Plugin Compatibility for JIRA 7.4.x

Hi There! I’ve been developing a plugin that targets 7.3.3, and I’m now trying to make it compatible with 7.4 & 7.5. I have a class that extends AbstractWebCondition and use this in atlassian-plugin.xml for a web item condition. This is the only reference to com.atlassian.plugin.web.Condition.class in my plugin.

I’m getting the following error after installed my plugin on a 7.4.4 instance:

java.io.FileNotFoundException: class path resource [com/atlassian/plugin/web/Condition.class] cannot be opened because it does not exist
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:182)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:261)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:444)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:414)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:362)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:254)
	at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:220)
	at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:224)
	at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:177)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:157)
	at org.eclipse.gemini.blueprint.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:207)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: class path resource [com/atlassian/plugin/web/Condition.class] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
	at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getInterfaces(ConfigurationClassParser.java:797)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:298)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:232)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:191)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:174)
	... 15 more

After doing a little research I tried adding this class to my pom as an imported package like this:
> <Import-Package>*, com.atlassian.plugin.web.*;version="0";resolution:=optional</Import-Package>

But then got this error:

Unable to resolve 254.0: missing requirement [254.0] osgi.wiring.package; (osgi.wiring.package=com.sun.msv.grammar)
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
	at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:399)

I thought there may be a dependency issue with my POM, so I updated some packages. Here are some snippets of what my POM currently looks like:
JIRA 7.4.4
Spring 4.2.6.RELEASE

<groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>6.3.3</version>

<groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.4.2</version>

<groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.2.4.Final</version>
            <scope>compile</scope>

 <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>2.0.1</version>
            <scope>provided</scope>

Before I updated (and everything was peachy) the versions in my POM were:
JIRA: 7.3.3
Spring: 4.2.4.RELEASE
Maven-Jira-Plugin: 6.2.11
Maven-release-plugin: 2.4.2

Any guidance on how to get this working would be greatly appreciated! Thanks!

1 Like

Bump :smiley: Any help would be VERY appreciated! I still haven’t solved this issue. I should add that the 7.4.4 instance I installed this on is a Data Center instance.

Hi kara,

I basically went through the same steps as you in order to update our plugin from JIRA 7.3.2 to JIRA 7.5.0.
Then I though about something which might seem weird, but what if the spring scanner just doesn’t see the interface because it is declared in a dependency (where the class AbstractWebCondition comes from).
So I just added implements interface Condition (com.atlassian.plugin.web.Condition) in my class and surprise! It works!
What I recommend to you is that you create a base class, lets call it BaseCustomCondition, for your custom conditions and declare that it extends AbstractWebCondition and that it implements the interface Condition.
Then, you can simply extends BaseCustomCondition instead of AbstractWebCondition and be sure that the scanner will see it.

Hope this helps.

4 Likes

Thank you SOOO much! This worked perfectly. :slight_smile:

Thanks a lot for the solution . I was stuck with this issue for a week … and moreover I was using scala which made the solution even tricky since the above solution didn’t work for me using scala code.

Finally I had to use a java file and your solution worked.

public class UserLoggedInCondition extends AbstractWebCondition implements Condition{