how to use same active object tables in two different plugin?

I have created a table through active object in one plugin. And i want to access the same active object table in another plugin.

What should i have in my plugin descriptor and classes ?

3 answers

1 accepted

Rephrasing Daniel:

  • AO Tables are sandboxed and can't be seen from other plugins;
  • The component that manages the table (the DAO) can be made visible to other plugins.

However, making the component public requires good programming skills. There probably are a thousand questions about that, but here's a summary:

  • In atlassian-plugin.xml,
    • Declare your <component/> as public=true (It's Spring technology),
    • Declare an <interface> tag inside your component.
  • In pom.xml
    • Declare an <Export-Package> tag to export the java class (It's OSGi technology),
    • The other plugin must declare the first one in <dependencies>, with <scope>provided</scope>
  • Good luck. There should be a "I've mastered an Export-Package declaration" badge on Answers ;)

Can you give me a simple example? Atlassian Spring Scanner compliant.

Daniel Wester Community Champion Sep 21, 2017

I would suggest moving this question over to (lot's more developers there :) ).

But the basic gist is that you'll need to create another maven artifact that holds all of your interfaces.

Then in the add-on that has the service that you want to expose, implement that interface.

Then you'll need to annotate the class with


Then in your pom.xml where you have the <Import-Package/> area - add:

<Export-Package>your package to the interface here</Export-Package>


Then in your add-on that imports the service, just do an @ComponentImport and you'll be in business.

These are not real plugins. Written just briefly so that I can understand it. Maybe someone can add to that or at least comment on it.


Plugin Test with AO



import java.util.Date;

public interface TestAoTable extends Entity {

public String getFieldValue();
public void setFieldValue(String fieldValue);

public String getFieldName();
public void setFieldName(String fieldName);




import java.util.List;

public interface TestAo {

FieldModel get(String field);
FieldListModel getList();
Boolean add(FieldModel model);
Boolean update(FieldModel model);
Boolean delete(FieldModel model);


 TestAo Interface



public class TestAoImpl implements TestAo {

private final ActiveObjects ao;
private final TransactionTemplate transactionTemplate;

public TestAoImpl(@ComponentImport final ActiveObjects ao,
@ComponentImport final TransactionTemplate transactionTemplate) { = ao;
this.transactionTemplate = transactionTemplate;

public FieldModel get(String field) {
// ...

public FieldModel getList() {
// ...

public Boolean add(FieldModel model) {
// ...

public Boolean update(FieldModel model) {
// ...

public Boolean delete(FieldModel model) {
// ...

TestAo Implemantation




Part of Test Plugin pom.xml 



Plugin Lorem

package com.lorem.confluence.plugins.macro;

public class LoremMacro implements Macro {

private final TestAo testAo;

public LoremMacro(@ComponentImport final TestAo testAo) {
this.testAo = testAo;

public BodyType getBodyType() {
return BodyType.NONE;

public OutputType getOutputType() {
return OutputType.INLINE;

public String execute(Map<String, String> parameters, String bodyContent, ConversionContext conversionContext)
throws MacroExecutionException {

Map<String, Object> data = MacroUtils.defaultVelocityContext();
FieldModel model = this.testAo.get("lorem");
data.put("lorem", model);

return VelocityUtils.getRenderedTemplate(MACRO_BODY_TEMPLATE, data);

LoremMacro with TestAoImpl

My Result :-)

Error rendering macro 'lorem-macro' : AOP configuration seems to be invalid: tried calling method [public abstract[]] on target []; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class

1 vote
Daniel Wester Community Champion Aug 06, 2013
Since the ao tables are sandboxed so that they're isolated on a per plugin basis - you'll need to make sure the <component/> declarations declare them as public="true" and then in the second plugin you'd need to use <component-import/> to pull them in.


how the ao tables are exposed to other plugins?

Should i expose each table entity interface separately as component.

@Dipti Ranjan Behera

Add in the <component-import/> interface which is implemented by you <component/>

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 13, 2019 in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

633 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you