How to build a Rest plugin along with Confluence API?

Can someone please help?!
I’m trying to develop a plugin which makes use of regular Confluence java API like PageManager, SpaceManager etc. along with the ability to get CRUD working using REST calls.
I followed and got the Rest plugin working.
But, it doesn’t get me the Confluence Java API. So, I added :


This breaks the Rest calls:
ERROR in logs:

[atlassian.plugin.servlet.DefaultServletModuleManager] getInstance Unable to create new reference LazyLoadedFilterReference{descriptor={}:my-rest-resource1-filter (Rest Resource Plugin), filterConfig=com.atlassian.plugin.servlet.filter.PluginFilterConfig@4d0b29c5}
com.atlassian.util.concurrent.LazyReference$InitializationException: com.sun.jersey.spi.inject.Errors$ErrorMessagesException
        at com.atlassian.util.concurrent.LazyReference.getInterruptibly(
        at com.atlassian.util.concurrent.LazyReference.get(
        at com.atlassian.plugin.servlet.DefaultServletModuleManager.getInstance(
        at com.atlassian.plugin.servlet.DefaultServletModuleManager.getFilter(
        at com.atlassian.plugin.servlet.DefaultServletModuleManager.getFilters(
        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(
        at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(
        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(
        at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(
        at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(

My guess is that the plugin skeleton you’re using is configured only with the maven-amps-plugin. You need to change that yo the maven-confluence-plugin, so that when you run atlas-debug or atlas-run, it will automatically launch Confluence instead of Refapp.

1 Like

Thanks for the response @richatkins!
I’m building this plugin using “atlas-mvn {clean} package”.
I have a confluence sand-box instance where I’m deploying this plugin.
The issue is that, something in the “com.atlassian.confluence.confluence” dependency which I’m adding on top of template pom.xml from that tutorial, is causing an exception while the Rest service is being run.
I need that dependency for a logic I’m trying to build in the plugin (to be able to use Page and Space Managers).
I need help in finding a way where both co-exist.

Hello, @sameer.v.

Checking the tutorial link you’ve provided, that’s for the refapp. To answer your initial question as to how to build a REST plugin along with Confluence API, here are the steps:

  1. Call atlas-create-confluence-plugin (instead of atlas-create-refapp-plugin)
  2. Once the project is created, go to the newly created directory
  3. Call atlas-create-confluence-plugin-module and select REST Plugin Module

If you haven’t done much with the refapp template you have yet, it might be worthwhile (or faster) starting with a Confluence template.


1 Like

Hi @iragudo,
Thanks for the hint. I used your steps to work it up from scratch. Finally got to the cause of the issue I was facing while comparing. And it’s rather lame :frowning:
I had a method in one of the classes with just '@Path(“something”) ’ and no @GET/@POST. I deleted that “@Path” in my old project and it started working.
Thanks for the helpful tips! Appreciate it!

1 Like