Preparing for Confluence 9.0 - EAP out now

Hi,
I have our plugin working well on confluence 9.0m16, and 8.5, but when installing it on 7.19.2, i have the error below.

com.atlassian.plugin.osgi.container.OsgiContainerException: Unable to install bundle
...
Caused by: org.osgi.framework.BundleException: Importing java.* packages not allowed: java.lang

I suspect java 17 to cause this, any clues ? thanks

1 Like

Hi @clouless,
Please use
com.atlassian.confluence.api.service.backuprestore.BackupRestoreService for any xml backup/restore operations. It should be available for plugins.

For adding/removal of space permissions you could use com.atlassian.confluence.security.SpacePermissionManager. Even though methods removePermission and savePermission are deprecated, we don’t remove them yet. DefaultPermissionManager (which implements this interface) will call corresponding internal functions. The idea was that we will eventually introduce java api for space permission management, but unfortunately it wasn’t added yet.

Hi @IrinaTiapchenko ,

Thanks for the clarification. I have already found another solution, but will keep it in mind.

The PermissionManager methods seem deprecated for over 10 years. Maybe you want to fix that with Confluence 9.0.0 because we are all very focused on removing deprecated API stuff because of the big Grey-API-Removal :smiley: And all deprecated messages IntelliJ displays is now very frightening :sweat:

Cheers,

Bernhard

We’re having the same problem since Confluence 8.9 .

It keeps asking for a dependency (com.opensymphony.module.propertyset) that we don’t use in our project. Even though we’ve made sure our MANIFEST.MF file doesn’t list this dependency, Confluence still acts like we need it.
As our MANIFEST.MF does not include the dependency on purpose so that’s why we did not see using debug on maven build the like you suggested @scott.dudley

Even a simple piece of code that uses com.atlassian.confluence.user.UserAccessor runs into this problem. Here’s an example:

import com.atlassian.confluence.user.UserAccessor; 

public class TestErrorClass { 

protected UserAccessor userAccessor; 

public UserAccessor getUserAccessor() { return userAccessor; } 
}

We’re stuck because it seems like Confluence forces this dependency no matter what, but we don’t know why. Has anyone else dealt with this? How did you fix it?

Thanks for any help you can give!

1 Like

Hi @RomainBarlo

This comment in the jira issue may help you.

I didn’t have time to try it.

Hi Gorka,

I managed to get our app working on Confluence 9.0.0m15 by migrating from the old and tags on atlassian-plugin.xml to Spring Java Config: https://developer.atlassian.com/server/framework/atlassian-sdk/spring-java-config-plugin-xml/.
However, we’re still getting warning messages like this from packages we do not use on our plugin:

2024-03-26 12:19:36,225 WARN [UpmAsynchronousTaskManager:thread-2] [osgi.hook.dmz.DmzResolverHook] filterMatches Package org.apache.batik.anim.dom is deprecated and is not available for export to plugin com.valiantys.spreadsheets

Any help on this?

Hi,

I want to confirm that Spring Java Config is the way to go.

Now, we’re facing many warnings like:

[jersey.internal.Errors] logErrors The following warnings have been detected: WARNING: HK2 service reification failed for [one of our REST api classes] with an exception:\nMultiException stack 1 of 2\njava.lang.NoSuchMethodException: Could not find a suitable constructor in [one of our REST api classes] class.\n\tat org.glassfish.jersey.inject.hk2.JerseyClassAnalyzer.getConstructor...

although it works!

Also, the following internal packages warnings:
com.atlassian.confluence.util.io but it is part of AttachmentTextExtractor as in @Override public Optional<InputStreamSource> extract(Attachment att)

org.apache.commons.io, org.apache.commons.io.output which we don’t user in our code

Any ideas how to fix these issues.
Thanks

It can help somebody.

We solved this problem, when migrated from <component-import> and <component> to Spring java configuration. Details can be found here and here.

Hi,

Anyone knows how to implement Attachment Text Extractor in Confluence 9

The steps in this tutorial
https://developer.atlassian.com/server/confluence/attachment-text-extractor-module-tutorial/
uses InputStreamSource from package com.atlassian.confluence.util.io

This package is showing a warning that package com.atlassian.confluence.util.io is not available.

WARN [main] [hook.dmz.DmzResolverHook] filterMatches Package com.atlassian.confluence.util.io is internal and is not available for export to plugin 

Note: Regarding the errors I shared before, it is due to REST v2 which is not yet ready in Confluence 9.

Thanks

Hi,
EDIT: Figured out that I messed up my postgres db setup at some point. Working fine again now.

I checked out the last milestones. I can start m11 (and older milestones) just fine with my docker setup, but any milestone after that, the cachemanager crashes. Any pointers about something that changed which I have to change somewhere in my setup?

02-Apr-2024 10:07:58.817 SEVERE [https-jsse-nio-8015-exec-2] org.apache.catalina.core.StandardHostValve.custom Exception Processing [ErrorPage[errorCode=500, location=/500page.jsp]]
confluence-confluenceServer-p7   | 	java.lang.IllegalStateException: The CacheManager has been shut down. It can no longer be used.
confluence-confluenceServer-p7   | 		at net.sf.ehcache.CacheManager.checkStatus(CacheManager.java:1626)
confluence-confluenceServer-p7   | 		at net.sf.ehcache.CacheManager.getEhcache(CacheManager.java:1161)
confluence-confluenceServer-p7   | 		at com.atlassian.confluence.cache.ehcache.EhCacheManager.wrapCache(EhCacheManager.java:162)
confluence-confluenceServer-p7   | 		at com.atlassian.confluence.cache.ehcache.EhCacheManager.getCache(EhCacheManager.java:257)
confluence-confluenceServer-p7   | 		at com.atlassian.confluence.cache.ehcache.EhCacheManager.getCache(EhCacheManager.java:42)
confluence-confluenceServer-p7   | 		at com.atlassian.confluence.impl.cache.DelegatingCacheManager.getCache(DelegatingCacheManager.java:101)
confluence-confluenceServer-p7   | 		at jdk.internal.reflect.GeneratedMethodAccessor192.invoke(Unknown Source)
confluence-confluenceServer-p7   | 		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
confluence-confluenceServer-p7   | 		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
confluence-confluenceServer-p7   | 		at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
confluence-confluenceServer-p7   | 		at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
confluence-confluenceServer-p7   | 		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
confluence-confluenceServer-p7   | 		at com.atlassian.confluence.impl.cache.AbstractConfluenceCacheAspect.invoke(AbstractConfluenceCacheAspect.java:25)
confluence-confluenceServer-p7   | 		at jdk.internal.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
confluence-confluenceServer-p7   | 		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
confluence-confluenceServer-p7   | 		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
confluence-confluenceServer-p7   | 		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
confluence-confluenceServer-p7   | 		at com.atlassian.confluence.impl.cache.AbstractConfluenceCacheAspect.invoke(AbstractConfluenceCacheAspect.java:25)
confluence-confluenceServer-p7   | 		at jdk.internal.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
confluence-confluenceServer-p7   | 		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
confluence-confluenceServer-p7   | 		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
confluence-confluenceServer-p7   | 		at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
confluence-confluenceServer-p7   | 		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
confluence-confluenceServer-p7   | 		at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
confluence-confluenceServer-p7   | 		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
confluence-confluenceServer-p7   | 		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241)
confluence-confluenceServer-p7   | 		at jdk.proxy4/jdk.proxy4.$Proxy308.getCache(Unknown Source)

Hi,

getAttachmentDao from AttachmentManager is deprecated as per the docs

[@Deprecated]
[AttachmentDao] getAttachmentDao()

Deprecated. since 7.5.0, no replacement, use dependency injection where possible

Any idea how can I inject AttachmentDao. Using @ComponentImport AttachmentDao doesn’t work. The plugin timeout and is not enabled.

Thanks

Hi @ashraf.teleb85

If you use java-config then you can try to use method importOsgiService.
See examples and explanations in the docs .

Hi Fábio,

That’s odd. Is this preventing your app from working? Any stack trace? There must be something about the app that’s resolving as a transitive dependency on batik somewhere.

Hi Ashraf,

The AttachmentDao is an internal interface that should never have been exposed to plugins, and we’ve closed that loophole with 9.0. What are you trying to achieve?

Hi @kmacleod,

Thanks for your reply.

We use it to set the creator and last modifier. Our app do bulk operations on attachments and users complained from losing the creator and last modifier info after that (all modified attachments are now created and modified by the user who run the bulk operation)

Is there another way to do so?

Note: Setting the creator and last modifier in the new version of the attachment is ignored by the AttachmentManager.

Thanks

Hi @ashraf.teleb85 ,

When the AttachmentManager persists an attachment to the database, it uses the user in AuthenticatedUserThreadLocal as the creator and last modifier in the new version.
As a work round, you might start a new thread, where setting a desired user in AuthenticatedUserThreadLocal, and then do your saving logic.

A simple example:

Executors.newSingleThreadExecutor.submit(() -> {
            AuthenticatedUserThreadLocal.set(desiredUser);
            doInTransaction(status -> {
                try {
                    attachmentManager.saveAttachment(attachment, attachment,   attachmentManager.getAttachmentData(attachment));
                    return null;
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            });
        });
1 Like

Hi @TomRijnbeek

Thanks for all of your team’s work for upgrading atlasisan-pocketknife-dynamic-modules to work with 8.9.

It seems, unfortunately, that Confluence 9.0.0-m41 no longer works with v1.1.1 due to a banned dependency on com.atlassian.annotations.tenancy from within the pocketknife code.

Is it possible to fix either Confluence or atlasisan-pocketknife-dynamic-modules?

Thanks,
Scott

I’ll investigate whether we can remove the tenancy dependency from pocketknife altogether, remove the dependency ban in Confluence, or whether we’re hitting a brick wall here. I’ll report back when I know more.

Hi @TomRijnbeek

Thanks for the quick response. Further testing shows that the above is not the only problem either: even after trying to patch out the banned annotation classes, I am getting java.lang.NoClassDefFoundError: com/atlassian/plugin/module/Dom4jDelegatingElement on plugin load.

If there is any opportunity to do a full test of functionality of the pocketknife on the latest 9.0 milestone, that would be greatly appreciated!

Scott

Hey @scott.dudley,

We’re working on this PR which should solve the problem with Dom4jDelegatingElement. It doesn’t deserve a beauty prize, but hopefully it’ll keep pocketknife in a state where it’s compatible across versions.

1 Like