Hi.
I try add ActiveObjects storage service to plugin but get on runtime
Error autowiring Action 'com.avvd.jira.plugin.defaulter.WebWork'.
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'com.avvd.jira.plugin.defaulter.WebWork':
Unsatisfied dependency expressed through constructor argument with index 0
of type [com.atlassian.activeobjects.external.ActiveObjects]:
No qualifying bean of type [com.atlassian.activeobjects.external.ActiveObjects]
found for dependency: expected at least 1 bean which qualifies as autowire candidate
for this dependency. Dependency annotations: {@com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport(value=)};
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.activeobjects.external.ActiveObjects]
found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport(value=)}
Plugin access point is
@Scanned
public class WebWork extends JiraWebActionSupport {
private ConfigurationStorageService configurationStorageService;
@Inject
public WebWork(@ComponentImport ActiveObjects ao)
{
this.configurationStorageService = new ConfigurationStorageService(ao);
}
@Override
public String doExecute()
{
Storage service
public class ConfigurationStorageService implements ConfigurationStorage {
private ActiveObjects ao;
public ConfigurationStorageService(ActiveObjects ao){this.ao = ao;}
pom.xml
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.activeobjects</groupId>
<artifactId>activeobjects-plugin</artifactId>
<version>${ao.version}</version>
</pluginArtifact>
</pluginArtifacts>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>
com.avvd.jira.plugin.defaulter
</Export-Package>
<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*;version="0";resolution:=optional
</Import-Package>
<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>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
</build>
Also don't miss create entity in atlassian-plugin.xml
What i miss?
Thank for advice.
I found that IDEA highlights
<atlassian-scanner:scan-indexes/>
With warning: This custom Spring bean has not yet been parsed.
This is repository. In case i will resolve this issue, i place solution there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am working with AO in some of my projects...
But I didn't understand what you did here, what do you mean by "Plugin access point"?
You should use AO to create a table inside your Jira database.
So you need first to create an interface which represent the table and it's columns like:
import net.java.ao.Accessor;
import net.java.ao.Entity;
import net.java.ao.Preload;
import net.java.ao.schema.Table;
import java.util.Date;
@Table("Table_Name")
@Preload
public interface MyInterface extends Entity {
@Accessor("Column_Name_1")
public String getXXX();
public void setXXX(String XXX);
@Accessor("Column_Name_2")
public Date getYYY();
public void setYYY(Date YYY);
}
Than create the service interface like:
import java.util.Date;
import java.util.List;
@Transactional
public interface MyInterfaceService {
MyInterface add(String XXX, Date YYY);
/*other methods like update, delete and so on... */
List<MyInterface> all();
}
Eventually your service is like:
import com.atlassian.activeobjects.external.ActiveObjects;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import net.java.ao.Query;
@Scanned
@Named
public class MyInterfaceServiceImpl implements MyInterfaceService {
@ComponentImport
private final ActiveObjects ao;
@Inject
public MyInterfaceServiceImpl(ActiveObjects ao) {
this.ao = ao;
}
@Override
public MyInterface add(String XXX, Date YYY) {
final MyInterface record = ao.create(MyInterface.class);
record.setXXX(XXX);
record.setYYY(YYY);
record.save();
return record;
}
@Override
any other method you created
@Override
public List<MyInterface> all() {
return newArrayList(ao.find(MyInterface.class));
}
}
everything you want to do with you table, any method regarding it should be done in the service class.
Than if you want to use it in other classes you should do like:
@Component
public class Program {
private static final Logger log = LoggerFactory.getLogger(Program.class);
private final MyInterfaceServiceImpl myInterfaceServiceImpl
@Autowired
public Program(MyInterfaceServiceImpl myInterfaceServiceImpl) {
this.myInterfaceServiceImpl = myInterfaceServiceImpl;
}
public void main() {
myInterfaceServiceImpl.add(XXX, YYY)
}
}
in plugin.xml
<ao key="ao-module">
<description>The AO module for this plugin.</description>
<entity>${atlassian.plugin.key}.active_objects.MyInterface</entity>
</ao>
If you do everything as I said I promise you it will work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if there are no errors in your ide, then your probably fine...
Try to clean your project and re-run again
mvn-clean
atlas-run
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am creating packages and run them on test instance. Yes. I doing this.
I download latest SDK(i have 6.x version) Simplify pom.xml and will try to check it up now.
....
but no changes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you give me your pom.xml file. I think that i declare maven plugin in the wrong way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you got below in you atlassian-plugin.xml file?
<
component-import
key
=
"ao"
name
=
"Active Objects service"
interface
=
"com.atlassian.activeobjects.external.ActiveObjects"
>
<
description
>Component to access Active Objects functionality from the plugin</
description
>
</
component-import
>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not component-import. Just
<ao key="Defaulter helper table">
<entity>com.avvd.jira.plugin.defaulter.storage.ConfigurationEntity</entity>
</ao>
This is spring-scanner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Add component-import and remove all annotations
clean->package
cause 0 beans of AO on runtime
it's fun and expectdly but when declairing service
@Component
public class ConfigurationStorageService implements ConfigurationStorage {
private ActiveObjects ao;
public ConfigurationStorageService(@ComponentImport ActiveObjects ao){this.ao = ao;}
cause 2 AO beans
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.