Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Active objects not working

Krisztian Kocsis July 31, 2015

Hi,

I getting started with plugin development and I would like to store some data in database. I created a rest resource which has a method what can save a simple entity.

Here is my atlassian-plugin.xml's snippet:

<ao key="ao-module">
    <entity>com.mycompany.jira.poc.entity.PocEntity</entity>
</ao>

<component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects">
	<decription>Active Objects service</decription>
</component-import>

<component key="tx-processor" name="Transactional Annotation Processor" class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor">
    <decription>Processes @Transactional annotations.</decription>
</component>

The rest method:

@POST
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response addPocEntity(@QueryParam("description") String description, @QueryParam("nick") String nick) {
   return Response.ok(pocAoService.add(description, nick)).build();
}

And there is a @Transactional PocAoService what is call the Active Objects:

@Override
public PocEntity add(final String description, final String nick) {
   final PocEntity entity = ao.create(PocEntity.class);
   entity.setDescription(description);
   entity.setNick(nick);
   entity.setTimestamp(new Date());
   entity.save();
   return entity;
}

The PocEntity is an interface extending the ao's Entity interface:

@Preload
public interface PocEntity extends Entity {
   String getDescription();
   void setDescription(String description);
   String getNick();
   void setNick(String nick);
   Date getTimestamp();
   void setTimestamp(Date timestamp);
}

However I got this exception when trying to save an entity:

[INFO] [talledLocalContainer] 2015-07-31 15:31:46,481 http-bio-2990-exec-3 ERROR anonymous 931x474x1 - 0:0:0:0:0:0:0:1 /rest/pocrest/1.0/poc.json [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: plugin [{com.mycompany.jira.poc}] invoking ActiveObjects before <ao> configuration module is enabled or plugin is missing an <ao> configuration module. Note that scanning of entities from the ao.model package is no longer supported.

[INFO] [talledLocalContainer] java.lang.IllegalStateException: plugin [{com.mycompany.jira.poc}] invoking ActiveObjects before <ao> configuration module is enabled or plugin is missing an <ao> configuration module. Note that scanning of entities from the ao.model package is no longer supported.

I am using activeobjects-plugin version 1.0.0, however I tried it with earlier versions with the same results.

Can somebody help me?

Thanks in advance,

Krisztian

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Krisztian Kocsis August 2, 2015

OK, I figured out. It seems the problem was the reserved word 'timestamp' in the PocEntity class. Unfortunately I haven't seen error log about this in the log files.

Thank you Volodymyr for the effort.

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 2, 2015

I remember I had something similar with interface named Settings :-(

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2015

Few things to check:

  • You apply @Transactional annotation for the "add" method of the interface
  • You have entrance for the TransactionalAnnotationProcessor in atlassian-plugin.xml:

    &lt;!-- support of @Transactional annotation --&gt;
      &lt;component key="work-calendar-tx" name="work-calendar-tx"
        class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor" /
  • Check version of the activeobjects-plugin in pom.xml. I have 0.29.3 but see that 1.0.0 is already in the repo:

    &lt;dependency&gt;
          &lt;groupId&gt;com.atlassian.activeobjects&lt;/groupId&gt;
          &lt;artifactId&gt;activeobjects-plugin&lt;/artifactId&gt;
          &lt;version&gt;${ao.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;
  • Last thing to try (if you have not try already) is atlas-clean
Krisztian Kocsis August 1, 2015

Checked all without success :(

0 votes
Krisztian Kocsis July 31, 2015

I updated the question with the code of PocEntity. Thanks

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2015

Please post PocEntity code.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events