Preparing for Confluence 9.0 - EAP out now

There’s a RESTv2 bug on Confluence 9.0.0-m48:

Apparently some OSGi-imported components are not available for injection into REST endpoints, but they are available for injection into @Component spring beans.

My REST endpoint is defined like this:

@Path("/admin")
public class ImageMapAdminResource {

    @Inject private PermissionManager permissionManager;
    @Inject private ContentEntityManager contentEntityManager;
    ...

A spring bean is defined like this:

@Component
public class ImageDownloader {

    @Autowired AttachmentManager attachmentManager;
    @Autowired ContentEntityManager contentEntityManager;
    ...

When sending a request to the endpoint I get the ‘system error’ page in the browser and the following exception is logged:

Caused by: A MultiException has 3 exceptions.  They are:
1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=ContentEntityManager,parent=ImageMapAdminResource,qualifiers={},position=-1,optional=false,self=false,unqualified=null,1992828686)
2. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.k15t.scroll.imagemap.rest.ImageMapAdminResource errors were found
3. java.lang.IllegalStateException: Unable to perform operation: resolve on com.k15t.scroll.imagemap.rest.ImageMapAdminResource

	at org.jvnet.hk2.internal.Collector.throwIfErrors(Collector.java:65)
	at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:226)
	at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:334)
	at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
	at org.glassfish.jersey.inject.hk2.RequestContext.findOrCreate(RequestContext.java:59)
	at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:758)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:721)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:691)
	at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getInstance(AbstractHk2InjectionManager.java:161)
	at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getInstance(ImmediateHk2InjectionManager.java:30)
	at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:122)
	at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:260)
	at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:51)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:86)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
	at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:69)
	at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:38)
	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:173)
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:248)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:235)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
	... 379 more
Caused by: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=ContentEntityManager,parent=ImageMapAdminResource,qualifiers={},position=-1,optional=false,self=false,unqualified=null,1992828686)
	at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:51)
	at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:188)
	at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:211)
	... 409 more

When attaching a debugger to some other endpoint using the spring bean I can see that it got the ContentEntityManager injected, so it only seems to affect jersey dependency injection.

So far I could only identify this specific ContentEntityManager being affected, which seems to be declared in the same way as PageManager in confluence.jar’s contentServiceContext.xml. Yet PageManager is properly injected into REST endpoints.

    <bean id="contentEntityManager" class="com.atlassian.confluence.impl.content.DefaultContentEntityManager"
          plugin:available="true">
        <plugin:interface>com.atlassian.confluence.core.ContentEntityManager</plugin:interface>
        ...
    </bean>

    <bean id="pageManager" class="com.atlassian.confluence.impl.content.DefaultPageManager" plugin:available="true">
        <plugin:interface>com.atlassian.confluence.pages.PageManager</plugin:interface>
        ...
    </bean>

@ShahrimanMohammad
I don’t have idea how to solve this problem in the same version.

I have only one solution for now:

  • you can create new major-release of your plugin
  • now you have version 5.0 (for example) for Confluence 8 and version 6.0 for Confluence 9.

You can set different compatibility versions for these versions on marketplace.
For example:

  • version 5.0 [Confluence 7; Confluence 8]
  • version 6.0 [Confluence 9+].

I know, it is not the perfect solution and your should backport your changes, but if you don’t have any alternatives it can be your case.

Kind regards.

@AtlassianStaff

:question: Will there be a confluence m51 docker image?

I am currently on atlassian/confluence:9.0.0-m48-ubi9-jdk17 and no m51 is published yet.

thanks

Main problem:
In Confluence 9.0.0-m48 my config page in Global Settings stopped to work.

I see

I have this error message in logs:

There is no Action mapped for namespace [/admin/plugins/myplugin] and action name [viewconfig] associated with context path []. - [unknown location]
	at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:183)
	at org.apache.struts2.factory.StrutsActionProxy.prepare(StrutsActionProxy.java:57)
	at org.apache.struts2.factory.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:32)
	at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:60)
	at org.apache.struts2.dispatcher.Dispatcher.createActionProxy(Dispatcher.java:745)
	at org.apache.struts2.dispatcher.Dispatcher.prepareActionProxy(Dispatcher.java:731)
	at com.atlassian.confluence.impl.struts.ConfluenceStrutsDispatcher.prepareActionProxy(ConfluenceStrutsDispatcher.java:83)

But I have this actions in atlassian-plugin.xml and I have method ConfigAction.doView. I use annotation @ReadOnlyAccessBlocked for action:

<xwork name="MY Actions" key="myplugin.actions">
        <package name="MY config and license" extends="default" namespace="/admin/plugins/myplugin">
            <default-interceptor-ref name="defaultStack"/>
            <action name="viewconfig"
                    class="com.myplugin.ConfigAction"
                    method="doView">
                <result name="success" type="velocity">/templates/vm/config-pane.vm</result>
            </action>
....

Is it about decomposition or I missed something?

### Decomposition of ConfluenceActionSupport

Status: DONE

In Confluence 9.0, `ConfluenceActionSupport` has been stripped down to its essentials. Any missing methods or fields that your Action classes relied on should now be implemented directly in your Action class instead.

The second problem:
And my different REST endpoints started to return 403 code .

I ran into the same a few days ago. You must either use the com.atlassian.xwork.PermittedMethods annotation or the permittedMethods parameter in your action definition:

<action name="viewconfig" class="com.myplugin.ConfigAction" method="doView">
    <param name="permittedMethods">GET</param>
    <result name="success" type="velocity">/templates/vm/config-pane.vm</result>
</action>                
2 Likes

There’s something fishy going on with this specific component (not directly related to REST) because of the exact same interface being exported by two different components. This was throwing errors until I qualified the import. Maybe the same error is occurring here but the REST wrapper is eating it or something.

I’m not using it with REST, but I see that it’s being successfully imported as follows (with constructor injection):

@ComponentImport @Qualifier("contentEntityManager") ContentEntityManager contentEntityManager

and elsewhere using setter injection:

public void setContentEntityManager(@Named("contentEntityManager") ContentEntityManager contentEntityManager)

1 Like

Thank you @jens !

It works now. Did you find any docs or it was in the source code?

Kind regards

I also noticed this.

Because PageManager implements ContentEntityManager and we have two beans. I tried inject ContentEntityManager, but have two implementations and can’t inject. Only Qualifier helps. Very sad :frowning:

No, @scott.dudley told me :laughing:

2 Likes

Thanks @scott.dudley, apparently jersey DI needs an extra hint here compared to spring DI.
This worked for me in my REST class:

@Inject @Named("contentEntityManager") private ContentEntityManager contentEntityManager;

Still needs proper OSGi-importing of course, in our case with spring-scanner (we collect the annotations in a dedicated ComponentImporter class):

@ComponentImport private ContentEntityManager contentEntityManager;

You have some info in the Preparing for Confluence 9.0 page (Struts Actions XSRF protection enabled by default section) and in Enable XSRF protection in your app

1 Like

@NikhilJain @JamesWhitehead, any comment on org.ietf.jgss from the Atlassian staff? This package is exposing the GSS-API from the jvm and essential for Kerberos authentication, and without it SSO will break for hundreds of customers. Requiring workarounds like having the customer adding it to the extra osgi bootdelegation properties is will not be well received.

1 Like

Hi @jens. I’m the tech writer for the Confluence team, and just wanted to clarify that the ‘decomposition’ phrasing is about refactoring. I’ll change the heading so it sounds less composty.

3 Likes

@ShahrimanMohammad and @aorlov

Thank you for sharing your insights. Keeping two branches active is of course and option but also causes discomfort.

Hi Guys,

a new version of EAP m57 has been released, but unfortunately something is not working

atlas-package -U
[INFO] Project POM found
[INFO] Resolving plugin info, may take a while on the first run.
[INFO] Project defined AMPS version detected: 8.15.4
Executing: /Applications/Atlassian/atlassian-plugin-sdk/apache-maven-3.9.5/bin/mvn package -gs /Applications/Atlassian/atlassian-plugin-sdk/apache-maven-3.9.5/conf/settings.xml -U
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------< com.itlab.confluence.plugins:test-plugin >------------
[INFO] Building TestPlugin 4.3.2
[INFO]   from pom.xml
[INFO] --------------------------[ atlassian-plugin ]--------------------------
Downloading from atlassian-plugin-sdk: file:///Applications/Atlassian/atlassian-plugin-sdk/repository/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml
Downloading from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml (936 B at 4.0 kB/s)
Downloaded from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml (936 B at 2.0 kB/s)
Downloading from atlassian-plugin-sdk: file:///Applications/Atlassian/atlassian-plugin-sdk/repository/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
Downloading from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml (1.3 kB at 35 kB/s)
Downloaded from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml (1.3 kB at 5.5 kB/s)
Downloading from atlassian-plugin-sdk: file:///Applications/Atlassian/atlassian-plugin-sdk/repository/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
Downloading from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml (812 B at 21 kB/s)
Downloaded from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml (781 B at 1.9 kB/s)
Downloading from atlassian-plugin-sdk: file:///Applications/Atlassian/atlassian-plugin-sdk/repository/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
Downloading from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml (901 B at 24 kB/s)
Downloaded from atlassian-public: https://maven.atlassian.com/repository/public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml (870 B at 3.8 kB/s)
Downloading from atlassian-public: https://maven.atlassian.com/repository/public/com/atlassian/confluence/confluence-plugins-platform-pom/9.0.0-m53/confluence-plugins-platform-pom-9.0.0-m53.pom
Downloading from atlassian-plugin-sdk: file:///Applications/Atlassian/atlassian-plugin-sdk/repository/com/atlassian/confluence/confluence-plugins-platform-pom/9.0.0-m53/confluence-plugins-platform-pom-9.0.0-m53.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/atlassian/confluence/confluence-plugins-platform-pom/9.0.0-m53/confluence-plugins-platform-pom-9.0.0-m53.pom
Downloading from atlassian-public: https://maven.atlassian.com/repository/public/com/atlassian/confluence/confluence-plugins-platform-test-pom/9.0.0-m53/confluence-plugins-platform-test-pom-9.0.0-m53.pom
Downloading from atlassian-plugin-sdk: file:///Applications/Atlassian/atlassian-plugin-sdk/repository/com/atlassian/confluence/confluence-plugins-platform-test-pom/9.0.0-m53/confluence-plugins-platform-test-pom-9.0.0-m53.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/atlassian/confluence/confluence-plugins-platform-test-pom/9.0.0-m53/confluence-plugins-platform-test-pom-9.0.0-m53.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.991 s
[INFO] Finished at: 2024-04-29T09:51:27+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project test-plugin: Could not resolve dependencies for project com.itlab.confluence.plugins:test-plugin:atlassian-plugin:4.3.2: Failed to collect dependencies at com.atlassian.confluence.plugins:confluence-space-ia:jar:19.0.42: Failed to read artifact descriptor for com.atlassian.confluence.plugins:confluence-space-ia:jar:19.0.42: The following artifacts could not be resolved: com.atlassian.confluence:confluence-plugins-platform-pom:pom:9.0.0-m53 (absent): Could not find artifact com.atlassian.confluence:confluence-plugins-platform-pom:pom:9.0.0-m53 in atlassian-public (https://maven.atlassian.com/repository/public) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

pom.xml


		<!-- Atlassian -->
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-v2-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-space-ia</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>licensing-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>upm-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.mail</groupId>
            <artifactId>atlassian-mail</artifactId>
            <scope>provided</scope>
        </dependency>

...
<confluence.version>9.0.0-m57</confluence.version>
<platform.version>7.0.0-m59</platform.version>

Cheers
Adam

Hi there,
We implemented a tab that uses the profile layout and extends AbstractUserProfileAction.
From 8.8.0 and on, the site is not found anymore. If i make it extending ConfluenceActionSupport it works, but of course the layout is destroyed, because all the important things from AbstractUserProfileAction are missing. What is wrong there?
At the moment I use -Dconfluence.osgi.treatDeprecatedPackagesAsPublic=true to make everything work, without changes on the dependencies.
Any clue what is the problem with that?

Hi @EliasBrattliSorensen ,

This was an oversight on our part, apologies. This package will be restored to the public API in the next EAP.

Cheers
Kenny

2 Likes

Hi @kmacleod ,

Thank you for getting back to us and for your update. Appreciate it!

In EAP m57, quickreload plugin is causing a lot of JS errors and break our app and many parts of Confluence. For example, it breaks underscore-js _ global variable

<pluginArtifacts>
	<pluginArtifact>
		<groupId>com.atlassian.labs.plugins</groupId>
		<artifactId>quickreload</artifactId>
		<version>5.0.4</version>
	</pluginArtifact>
</pluginArtifacts>

We need quickreload while developing as it is a waste of time to restart confluence each time we do a change.

Any idea how to fix that.
Thanks

1 Like

Hi Guys,

the problem with the missing artifact (Preparing for Confluence 9.0 - EAP coming soon - #179 by adam.labus) has been fixed, but unfortunately the error “Caused by: java.lang.NoClassDefFoundError: com/atlassian/confluence/plugins/ia/service/SidebarLinkService” still occurs in the m57 version (Preparing for Confluence 9.0 - EAP coming soon - #146 by adam.labus and Preparing for Confluence 9.0 - EAP coming soon - #154 by adam.labus)

@kmacleod - do you have any news when this problem will be resolved?

Cheers
Adam