Confluence NoSuchBeanDefinitionException com.atlassian.sal.api.*

Ok so the documentation around this seems off but this got it to work for me:

  1. Ignore this page which says it’s deprecated:
    Component Import module (atlassian.com)

  2. Follow this:
    UnsatisfiedDependencyException - error creating bean with name (atlassian.com)
    Where it says to import component in atlassian-pugin.xml

<atlassian-plugin ... >
    ...
    <component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
    <component-import key="contentPropertyService" interface="com.atlassian.confluence.api.service.content.ContentPropertyService"/>
    <component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider"/>
    <component-import key="templateRenderer" interface="com.atlassian.templaterenderer.TemplateRenderer"/>
  1. Comment out or remove below from the pom.xml file:
<instructions>
    <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

    <!-- Add package to export here -->
    <Export-Package>
        se.ltu.confluence.plugin.api,
    </Export-Package>

    <!-- Add package import here -->
    <Import-Package>
         org.springframework.osgi.*;resolution:="optional",
         org.eclipse.gemini.blueprint.*;resolution:="optional",
         com.atlassian.sal.api.*;resolution:="optional",
        *
    </Import-Package>

    <!-- Ensure plugin is spring powered -->
    <Spring-Context>*</Spring-Context>
</instructions>

1 Like