The package com.atlassian.plugins.rest.common.multipart isn’t exposed by Confluence 9.0. It is required for file upload using the REST API.
It was exposed up to Confluence 8.9 by REST API v1,
It is now marked “Atlassian internal” (com.atlassian.plugins.rest.common.multipart uses: javax.servlet.http,javax.ws.rs, atlassian-access: internal, version: 8.0.4 in OSGi),
It is necessary in Confluence 9.0, otherwise we must upgrade to REST API v2, and REST API v2 doesn’t work with Confluence 8.9 (or more precisely, the confluence-create-content-plugin conflicts with the presence of the <rest-migration> tag in C8.9). REST API v2 is the only hurdle that prevents from creating a plugin which works from 7.19 to 9.0, so it would be good if REST API v1 still works in C9.0.
There is no documentation on which versions of Confluence support REST API v2.
Long story short, how can I use keep using com.atlassian.plugins.rest.common.multipart in Confluence 9.0, like I use the rest of the com.atlassian.plugins.rest.common packages?
Yes.
We will make it global across all endpoints in confluence in 9.1 and then the ReadOnlyException would be automatically processed by ServiceExceptionMapper.
I’m not totally sure but I think that Confluence 9 works without the <rest-migration> tag if you have your rest endpoints ready to be working with rest v2, at least in the rc1.
After modification of Confluence app, it is working on Confluence 9.0.0 rc1 , but when trying to install it on Confluence 7.19.2, it do not, is it normal ? if yes, do we need to keep 2 versions of any app, one for customers having versions prior to Confluence 8, and another from Confluence 9 ? any workaround ?
2024-07-19 07:53:04,241 WARN [UpmAsynchronousTaskManager:thread-2] [atlassian.plugin.impl.AbstractPlugin] install Unable to install plugin 'com.company1.confluence.plugins.app1'.
-- url: /rest/plugins/1.0/ | referer: http://localhost:8090/plugins/servlet/upm | traceId: bfbfbfe50a79249e | userName: admin
com.atlassian.plugin.osgi.container.OsgiContainerException: Unable to install bundle
at com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager.installBundle(FelixOsgiContainerManager.java:474)
at com.atlassian.plugin.osgi.factory.OsgiPluginUninstalledHelper.install(OsgiPluginUninstalledHelper.java:43)
at com.atlassian.plugin.osgi.factory.OsgiPlugin.installInternal(OsgiPlugin.java:373)
at com.atlassian.plugin.impl.AbstractPlugin.install(AbstractPlugin.java:378)
at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$22(DefaultPluginManager.java:1177)
at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1114)
at com.atlassian.plugin.manager.DefaultPluginManager.lambda$scanForNewPlugins$14(DefaultPluginManager.java:921)
at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
at com.atlassian.plugin.manager.DefaultPluginManager.scanForNewPlugins(DefaultPluginManager.java:877)
at com.atlassian.plugin.manager.DefaultPluginManager.lambda$installPlugins$13(DefaultPluginManager.java:837)
at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
at com.atlassian.plugin.manager.DefaultPluginManager.installPlugins(DefaultPluginManager.java:823)
at com.atlassian.confluence.plugin.EventDispatchingPluginController.installPlugins(EventDispatchingPluginController.java:74)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy248.installPlugins(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
at com.sun.proxy.$Proxy526.installPlugins(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy1579.installPlugins(Unknown Source)
at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:133)
at com.atlassian.upm.core.install.AbstractPluginInstallHandler$1.doInTransaction(AbstractPluginInstallHandler.java:128)
at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
at com.atlassian.sal.spring.component.SpringHostContextAccessor.lambda$doInTransaction$0(SpringHostContextAccessor.java:70)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at com.atlassian.sal.spring.component.SpringHostContextAccessor.doInTransaction(SpringHostContextAccessor.java:68)
at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.access$001(ConfluenceSpringHostContextAccessor.java:21)
at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.lambda$doInTransaction$3(ConfluenceSpringHostContextAccessor.java:72)
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
at com.atlassian.confluence.spring.transaction.interceptor.ConfluenceSpringHostContextAccessor.doInTransaction(ConfluenceSpringHostContextAccessor.java:72)
at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
at jdk.internal.reflect.GeneratedMethodAccessor288.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
at com.sun.proxy.$Proxy278.execute(Unknown Source)
at jdk.internal.reflect.GeneratedMethodAccessor288.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy1619.execute(Unknown Source)
at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifacts(AbstractPluginInstallHandler.java:127)
at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installArtifact(AbstractPluginInstallHandler.java:113)
at com.atlassian.upm.core.install.JarPluginInstallHandler.installPluginInternal(JarPluginInstallHandler.java:52)
at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installPlugin(AbstractPluginInstallHandler.java:54)
at com.atlassian.upm.core.install.DefaultPluginInstallationService.execute(DefaultPluginInstallationService.java:130)
at com.atlassian.upm.core.install.DefaultPluginInstallationService.install(DefaultPluginInstallationService.java:98)
at com.atlassian.upm.install.UpmPluginInstallationService.install(UpmPluginInstallationService.java:114)
at com.atlassian.upm.core.rest.resources.install.InstallTask.installFromFile(InstallTask.java:153)
at com.atlassian.upm.core.rest.resources.install.InstallFromFileTask.executeTask(InstallFromFileTask.java:36)
at com.atlassian.upm.core.rest.resources.install.InstallTask.run(InstallTask.java:78)
at com.atlassian.upm.core.async.AsynchronousTaskManager.executeTask(AsynchronousTaskManager.java:121)
at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:99)
at com.atlassian.upm.core.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:96)
at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:38)
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$1(VCacheRequestContextOperations.java:59)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.osgi.framework.BundleException: Importing java.* packages not allowed: java.lang
at org.apache.felix.framework.util.manifestparser.ManifestParser.normalizeImportClauses(ManifestParser.java:349)
at org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:181)
at org.apache.felix.framework.BundleRevisionImpl.<init>(BundleRevisionImpl.java:117)
at org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1282)
at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:113)
at org.apache.felix.framework.Felix.installBundle(Felix.java:3042)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:167)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:140)
at com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager$BundleRegistration.install(FelixOsgiContainerManager.java:647)
at com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager.installBundle(FelixOsgiContainerManager.java:472)
... 111 more
We’ve been using a Confluence component com.atlassian.confluence.setup.settings.ConfluenceDirectories with a method getTempDirectory() to obtain the path to the temp directory on the instance. On Confluence 9 we can’t seem to use this component. We’re getting an error that the package com.atlassian.config.util is internal. The ConfluenceDirectories interface has an import on this package.
Has anyone faced this as well? Does anyone know of another way to read the path to the temp directory?
The problem with com.atlassian.plugins.rest.api.multipart is that it is not also compatible with Confluence 8.9 or 7.19.
However, Scott Dudley gave me a hint which led to the solution: If I avoid using the <rest-migration> module in atlassian-plugin.xml, then C8.9 uses the old REST and C9.0 uses the new REST, and no importation error happens. I’ve written up my implementation here.
I’m sorry it took so long. @scott.dudley and @jens you are right, Plugin System shouldn’t complain about plugins trying to import javax.ws.rs or subpackages.
I already prepared a fix for that issue and we are working on applying it.
Since you are talking about 9.1, can you provide any more details about what this implementation will look like? If this is not shipping in 9.0.x, apps will still need to implement their own solution prior to 9.1. The app-provided exception mappers are seemingly detected by classpath scanning on plugin load, so it would be difficult for apps to conditionally load their own exception mappers only for 9.0…meaning that we are somewhat dependent on Atlassian here.
With whatever solution you choose for 9.1, is it possible to test it to ensure that it works correctly even in the case where the app supplies its own exception mapper?
You should check your apps META-INF/MANIFEST.MF to see if you have a java.lang reference there. This is part of the JRE, and not an OSGi bundle, so it should never be imported. (Check your Import-Packages instructions in your POM, and also look out for any stray @ComponentImports.)
@Kusal@MarekTokarski (not sure who to tag about AUI / AJS stuff…)
I found a breaking-change in javascript-API AJS.I18n.get(pluginKey, ...) (not getText(), but really get()):
With this API we dynamically fetch I18n-texts for our app and use it in our front-end JS-code. This is still working with Confluence 8.9.4, but not with 9.0.0-rc1: AJS.I18n.get is not there, so the whole call fails.
It that intentional? Or should that API still be available in 9.x? If not, then what’s the suggested alternative?
I do not see any reference to this in Preparing for Confluence 9.0 or AUI’s changelog (not sure if this comes from AUI or from Confluence itself).
For reference here what is contained in AJS.I18n in 8.9.4 and 9.0.0-rc1:
8.9.4:
Hi,
In fact i do not use annotations, only java config file to instantiate the beans (managers).
And the pom xml file seem to be ok for me.
Yes in the compiled java file, MANIFEST.MF contain java.lang
This app works ok in Confluence 9 (betas and rc1) but not in 7.19.2 (can’t be installed)
Here the main files. https://drive.google.com/drive/folders/1t2aUrh3KYGvx9qNJCIPuWhZ2ekNfyNa2?usp=sharing
@anastoumi I didn’t look at your attachment, but the presence of java.lang as an import in MANIFEST.MF suggests that you have java.lang declared somewhere in your pom’s import instructions, or that your app (or one of its dependencies) is inadvertently using Spring Scanner and it has annotated @ComponentImport references to java.lang. Regardless, you’ll need to figure out why the java.lang is appearing in the manifest import list, and then make sure that it does not.
For the migration to Confluence 9, we replaced SettingsManager by GlobalSettingsManager as suggested, and it is working ok for Confluence 8 and 9, but in Confluence 7, there is an error. Any clue ?
Here the error :
We are currently in the process of migrating our plugin and are hitting a wall with this error, when trying to @ComponentImport the RequestFactory<?> from Atlassian SAL net package:
1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=RequestFactory<?>,parent=PluginPropertyRestApi,qualifiers={},position=2,optional=false,self=false,unqualified=null,1350226826)
2. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.yasoon.rest.PluginPropertyRestApi errors were found
3. java.lang.IllegalStateException: Unable to perform operation: resolve on com.yasoon.rest.PluginPropertyRestApi
Interestingly enough, we have a PluginEnabledHandler where it can be injected, it just does not seem to work in the REST APIs… The UserManager from the same SAL package does work though, so that’s extremely weird. We have a workaround by manually accessing it via ComponentLocator.getComponent(RequestFactory.class), but that feels like a hack - any idea what makes that class special? Is it the generic attribute?
—I’m getting the famous “Invocation blocked as method is not allowlisted”. The Velocity Allowlist seems to block calls which shouldn’t be blocked.— SOLVED: The first message of the list says the allowlist was disabled because a method declaration was wrong. Sorry for submitting a question.