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
Community moderators have prevented the ability to post new answers.
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.
I remember I had something similar with interface named Settings :-(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Few things to check:
You have entrance for the TransactionalAnnotationProcessor in atlassian-plugin.xml:
<!-- support of @Transactional annotation --> <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:
<dependency> <groupId>com.atlassian.activeobjects</groupId> <artifactId>activeobjects-plugin</artifactId> <version>${ao.version}</version> <scope>provided</scope> </dependency>
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.
I updated the question with the code of PocEntity. Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please post PocEntity code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.