Package Xyz is internal and is not available for export on Confluence 9.0.x

Hi there,

I am trying to get my app running on Confluence 9 (version 9.0.2), but encounter the following issue when accessing the rendering service from the com.atlassian.confluence.plugins:confluence-create-content-plugin / com.atlassian.confluence.plugins:confluence-create-content-api.

I got it working basically (see Preparing for Confluence 9.0 - EAP out now - #581 by rr1), but when I need to access classes in the blueprint oder rendering package, I get the following error message:

Package com.atlassian.confluence.plugins.createcontent.api.rendering is internal and is not available for export to plugin ...

I read a similar issue Platform 7 upgrade in progress: Learn about the first highlights and changes - #45 by ashraf.teleb85 and the solution was that the package would be made public again in a later version (see Platform 7 upgrade in progress: Learn about the first highlights and changes - #48 by mahesh).

Could this be the case for the blueprint and rendering packages, too? Or is the error somewhere in my configuration?

I have declared the following dependencies:

    <dependency>
      <groupId>com.atlassian.confluence.plugins</groupId>
      <artifactId>confluence-create-content-plugin</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.confluence.plugins</groupId>
      <artifactId>confluence-create-content-api</artifactId>
    </dependency>

based on the managed dependencies for the Atlassian POMs. And I try to import the packages like this:

...
  com.atlassian.confluence.plugins.createcontent.api.contextproviders;version="0.0.0",
  com.atlassian.confluence.plugins.createcontent.api.rendering;version="0.0.0",
...
                *

which seems to work for the package contextproviders, but not for rendering.

What I am trying to achieve is injecting com.atlassian.confluence.plugins.createcontent.api.services.CreateButtonService. I tried to inject com.atlassian.confluence.plugins.createcontent.api.rendering.CreateButtonRenderingService due to:

@PublicApi
@Deprecated(forRemoval = true)
public interface CreateButtonService extends CreateButtonRenderingService {
}

But this seems not to work. Now I am trying to do, what com.atlassian.confluence.plugins.createcontent.CreateFromTemplateMacro does. But everything is fine when the Confluence macro access the service, but the way I inject it simply fails. I got a proxy that I cannot look into / call its service methods.

I have imported the package of the service, but I do not get any error message (besides stuck threads).

com.atlassian.confluence.plugins.createcontent.api.services;version="0.0.0",

I suppose there is something missing so that the service can successfully load, but nothing in the logs points to the root cause of this issue.

Has anybody successfully injected and used com.atlassian.confluence.plugins.createcontent.api.services.CreateButtonService in their services?

I created a small project that shows the code which fails to inject the CreateButtonService successfully. There is an instance, but it cannot be used.

https://bitbucket.org/smartics/confluence-eventlistener-blueprint/src/external-service_createcontent-createBlueprintService/

confluence-1  | 02-Sep-2024 17:30:04.123 WARNING [Catalina-utility-4] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadDetected Thread [http-nio-8090-exec-9 url: /rest/tinymce/1/macro/preview; user: admin] (id=[271]) has been active for [65,163] milliseconds (since [9/2/24, 5:28 PM]) to serve the same request for [http://localhost:8080/rest/tinymce/1/macro/preview] and may be stuck (configured threshold for this StuckThreadDetectionValve is [60] seconds). There is/are [5] thread(s) in total that are monitored by this Valve and may be stuck.
confluence-1  |         java.lang.Throwable
confluence-1  |                 at java.base@17.0.12/java.lang.Object.wait(Native Method)                                                                                                                                                                                                                                                                                                                                                                                        
confluence-1  |                 at org.eclipse.gemini.blueprint.service.importer.support.internal.support.RetryTemplate.execute(RetryTemplate.java:104)
confluence-1  |                 at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceDynamicInterceptor.lookupService(ServiceDynamicInterceptor.java:427)                                                                                                                                                                                                                                                                                                
confluence-1  |                 at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceDynamicInterceptor.getTarget(ServiceDynamicInterceptor.java:400)
confluence-1  |                 at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)                                                                                                                                                                                                                                                                                                                              
confluence-1  |                 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
confluence-1  |                 at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)                                                                                                                                                                                                                                                                                                                       
confluence-1  |                 at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
confluence-1  |                 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
confluence-1  |                 at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)                                                                                                                                                                                                                                                                                                              
confluence-1  |                 at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)                                                                                                                                                                                                                                                                                                                          
confluence-1  |                 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
confluence-1  |                 at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)                                                                                                                                                                                                                                                                                                                       
confluence-1  |                 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)                                                                                                                                                                                                                                                                                                                                     
confluence-1  |                 at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
confluence-1  |                 at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)                                                                                                                                                                                                                                                                                                                          
confluence-1  |                 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
confluence-1  |                 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241)                                                                                                                                                                                                                                                                                                                                                      
confluence-1  |                 at jdk.proxy219/jdk.proxy219.$Proxy3315.renderBlueprintButton(Unknown Source)                                                                                                                                                                                                                                                                                                                                                                    
confluence-1  |                 at com.example.plugins.tutorial.confluence.simplebp.macro.MacroTest.execute(MacroTest.java:55)

After the thread is detected to be stuck, the following exception is rendered:

org.eclipse.gemini.blueprint.service.ServiceUnavailableException: 
service matching filter=
[(objectClass=com.atlassian.confluence.plugins.createcontent.api.services.CreateButtonService)] 
unavailable