and Confluence recognizes neither of them. It displays:
[INFO] ... [plugin.osgi.factory.OsgiPlugin] logAndClearOustandingDependencies Plugin 'com.playsql.requirementyogi' never resolved service '&autowireCapableBeanFactory' with filter '(&(objectClass=org.springframework.beans.factory.config.AutowireCapableBeanFactory)(objectClass=org.springframework.beans.factory.config.AutowireCapableBeanFactory))'
[INFO] ... [plugin.osgi.factory.OsgiPlugin] logAndClearOustandingDependencies Plugin 'com.playsql.requirementyogi' never resolved service '&servletActionContextCompatManager' with filter '(&(objectClass=com.atlassian.confluence.compat.struts2.servletactioncontext.ServletActionContextCompatManager)(objectClass=com.atlassian.confluence.compat.struts2.servletactioncontext.ServletActionContextCompatManager))'
@aragot It works for me on 8.9 (at least for AutowireCapableBeanFactory, dunno about the other one).
The ACBF is part of Spring itself, so I believe you aren’t supposed to @ComponentImport it…you’ll also get the same type of error if you try to accidentally @ComponentImport one of your own plugin’s components.
For example, it gets injected correctly with the following defined within the class (with the class itself annotated with @Component, if needed):
@scott.dudley Correct, and you are being of tremendous help. You are right, AutowireCapableBeanFactory must be injected without@ComponentImport.
Other tidbit, pluginAccessor.getEnabledModulesByClass(Class<?>) does not work anymore in Confluence 8.9, because it doesn’t return the Spring-instantiated modules, so I had to use org.springframework.beans.factory.ListableBeanFactory#getBeansOfType() when I want to have all components that implement a given interface. Thank you very much, Scott. Tremendously helpful over my week-end.
In confluence-compat-lib 1.6.1 (a jar that Atlassian recommends), there is a @Component DefaultAccessModeCompatService which uses a class that is not exported by Confluence 8.9 anymore:
Error creating bean with name 'defaultAccessModeCompatService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.atlassian.confluence.compat.api.service.accessmode.impl.DefaultAccessModeCompatService] from ClassLoader [com.playsql.requirementyogi [302]]
...
Failed to introspect Class [com.atlassian.confluence.compat.api.service.accessmode.impl.DefaultAccessModeCompatService]
...
java.lang.NoClassDefFoundError: com/atlassian/util/concurrent/Supplier
Indeed, Confluence also says com.atlassian.util.concurrent is not exposed anymore. I don’t directly need this DefaultAccessModeCompatService, since we can access the AccessMode by other means, …
…but how do you prevent Confluence from trying to instantiate DefaultAccessModeCompatService, which calls com.atlassian.util.concurrent ?
Thank you extremely much, @Kusal ! That was a fast answer + deployment of a new version, thank you very much! I’m sorry that I can’t ask all questions in one go, but it’s hard to discover the next problem until after we resolve the first.
It seems the dependency on blueprints fails in Confluence 8.9, according to my observations.
Symptom: When starting with C8.9.0, it refuses to start because we use the package javax.ws.rs.core, which is (errorneously?) exposed by both Confluence and the confluence-create-content-plugin. Here is the error message:
Caused by: org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource com.playsql.requirementyogi [com.playsql.requirementyogi [301](R 301.0)] because it is exposed to package 'javax.ws.rs.core' from resources com.atlassian.plugins.rest.atlassian-rest-v2-plugin [com.atlassian.plugins.rest.atlassian-rest-v2-plugin [172](R 172.0)] and org.apache.felix.framework [org.apache.felix.framework [0](R 0)] via two dependency chains.
Chain 1:
com.playsql.requirementyogi [com.playsql.requirementyogi [301](R 301.0)]
import: (&(osgi.wiring.package=javax.ws.rs.core)(version>=0.0.0))
|
export: osgi.wiring.package: javax.ws.rs.core
com.atlassian.plugins.rest.atlassian-rest-v2-plugin [com.atlassian.plugins.rest.atlassian-rest-v2-plugin [172](R 172.0)]
Chain 2:
com.playsql.requirementyogi [com.playsql.requirementyogi [301](R 301.0)]
import: (&(osgi.wiring.package=com.atlassian.confluence.plugins.createcontent)(version>=0.0.0))
|
export: osgi.wiring.package=com.atlassian.confluence.plugins.createcontent; uses:=com.atlassian.plugins.rest.common.security
com.atlassian.confluence.plugins.confluence-create-content-plugin [com.atlassian.confluence.plugins.confluence-create-content-plugin [35](R 35.0)]
import: (osgi.wiring.package=com.atlassian.plugins.rest.common.security)
|
export: osgi.wiring.package=com.atlassian.plugins.rest.common.security; uses:=javax.ws.rs.core
com.atlassian.plugins.rest.atlassian-rest-module [com.atlassian.plugins.rest.atlassian-rest-module [171](R 171.0)]
import: (&(osgi.wiring.package=javax.ws.rs.core)(version>=1.1.1))
|
export: osgi.wiring.package: javax.ws.rs.core
org.apache.felix.framework [org.apache.felix.framework [0](R 0)] Unresolved requirements: [[com.playsql.requirementyogi [301](R 301.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.confluence.plugins.createcontent)(version>=0.0.0))]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4398)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2308)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:992)
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:404)
... 106 more
We need javax.ws.rs.core because it exposes javax.ws.rs.core.MediaType and javax.ws.rs.core.Response, which are necessary when building answers of REST calls. We also need the following packages, because ContentBlueprintManager#getPluginBackedContentBlueprint() returns a class that is in an impl package. Here is our current Import-Package in MANIFEST.MF:
Using version=“1.1.1” didn’t solve the issue for us (still the same error message). Note that create-content also uses 1.1.1, so it doesn’t filter. The problem seems to be that JAX-RS is exposed publicly by create-content-plugin.
(Note to others, until we solve this issue: Our temporary solution is to use REST API v1 in our plugin, since Confluence 8.9 still supports it - so the issue with confluence-create-content-plugin remains unresolved for C-9.0)
(Note to Atlassian developers: If you update the plugin create-content, can you please make it so that the exposed API doesn’t return objects from the com.atlassian.confluence.plugins.createcontent.impl package, since it’s impl ? It could be part of the problem).