Good Day Fellas!
I am building a Jira plugin and getting familiar with the platform. The moment I thought I had mastered it, I started getting a strange error after Quick Reload whenever I execute
atlas-mvn package
to update the JAR file.
Error Logs:
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [bundle://3a20f3ef-c74d-403e-ab58-ca9d1f222d58_187.0:0/META-INF/spring/plugin-context.xml]; nested exception is java.lang.IllegalArgumentException: Could not find class [com.atlassian.plugins.osgi.javaconfig.configs.beans.ModuleFactoryBean]
...
2025-01-09 23:35:55,544+0500 ThreadPoolAsyncTaskExecutor::Thread 28 ERROR [o.e.g.b.e.internal.support.ExtenderConfiguration] Application context refresh failed (NonValidatingOsgiBundleXmlApplicationContext(bundle=com.i2c.jira.timesheet, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [bundle://3a20f3ef-c74d-403e-ab58-ca9d1f222d58_187.0:0/META-INF/spring/plugin-context.xml]; nested exception is java.lang.IllegalArgumentException: Could not find class [com.atlassian.plugins.osgi.javaconfig.configs.beans.ModuleFactoryBean]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:417)
Earlier, I started getting this error only on the atlas-mvn package but now I am getting it even after I delete the target directory and re-build the whole project using
atlas-run
I highly appreciate any help in this as I have tried everything I could but nothing seems to be working. It's like some issue with the SDK as it compiles everything successfully but application fails on the server.
Config Class:
package com.i2c.jira.timesheet.config;
import com.i2c.jira.timesheet.api.MyPluginComponent;
import com.i2c.jira.timesheet.impl.MyPluginComponentImpl;
import com.atlassian.plugins.osgi.javaconfig.configs.beans.ModuleFactoryBean;
import com.atlassian.plugins.osgi.javaconfig.configs.beans.PluginAccessorBean;
import com.atlassian.sal.api.ApplicationProperties;
import org.osgi.framework.ServiceRegistration;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import static com.atlassian.plugins.osgi.javaconfig.OsgiServices.exportOsgiService;
import static com.atlassian.plugins.osgi.javaconfig.OsgiServices.importOsgiService;
@Configuration
@Import({
ModuleFactoryBean.class,
PluginAccessorBean.class
})
public class MyPluginJavaConfig {
@Bean
public ApplicationProperties applicationProperties() {
return importOsgiService(ApplicationProperties.class);
}
@Bean
public MyPluginComponent myPluginComponent(ApplicationProperties applicationProperties) {
return new MyPluginComponentImpl(applicationProperties);
}
@SuppressWarnings("rawtypes")
@Bean
public FactoryBean<ServiceRegistration> registerMyDelegatingService(
final MyPluginComponent mypluginComponent) {
return exportOsgiService(mypluginComponent, null, MyPluginComponent.class);
}
}
plugin-context.xml file in /resources/META-INF/spring/
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="com.i2c.jira.timesheet.config" />
</beans>
SDK Version: 8.2.7
Maven Version: 3.5.4
AMPS Version: 8.1.2
Spring Version: 5.3.39
Moreover, I have verified the osgi dependency and also verified that is contains all the classes I imported from it.
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
<version>${osgi.javaconfig.version}</version>
<scope>provided</scope>
</dependency>
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.