OsgiPlugin - the plugin did not resolve a service error

I started developing jira addon, but I get errors.

My last one I can't fix

[INFO] [talledLocalContainer] QuickReload - ERROR plugin installer [caposgi.factory.OsgiPlugin] The plugin "xy" never allowed the service '& classname' with filter '(& (objectclass = xy.classname) (objectclass = xy.classname))

What's going on here?

+5
source share
2 answers

This happens when you try to insert another object of your plugin on the object of your plugin, and you do it as if the other object was another plugin and was exported as a public OSGi service.

In JIRA, you can declare your Java plugin classes as components. This means that instantiation and nesting of dependencies (for example, through the constructor) will be automatically delegated to the Spring Framework, which is part of the JIRA. Usually we do this to lose concern for the assets and dependencies of classes. There are two types of components: open and closed. Public components will be available for import for different plugins than yours. Other plugins can import them and then use them through dependency injection. Private components will work just like regular components, but other plugins will not be able to import or see them.

If you have one component, say A , which depends on another component, B , both of them are part of your plugin, you should not import component B , which will be available for A , because it is already part of your plugin. Before JIRA 7, to import the component that you placed in the atlassian-plugin.xml a <component-import> element. JIRA 7, you add @ComponentImport in front of the constructor parameter when you do dependency injection through the constructor.

So, I think that you were mistaken, it is to put <component-import> on the component that comes directly from your plugin, and not <component> . Or, if you have JIRA 7 or later, which you did wrong, you had to put @ComponentImport in front of the component of your own plugin, and the solution would be to remove this annotation. At least this last one was my business and by removing these annotations from the dependencies of the component injections coming from the same plugin, I made it work.

+7
source

I had a similar problem when I was developing a plugin for Confluence v6.1.3. I migrated from Atlassian Spring Scanner v1 to v2. After the following instructions in the Atlassian Spring Scanner v2 guide , I thought it was good to go, but there was this error:

[INFO] [talledLocalContainer] 2017-08-24 22: 54: 52602 ERROR [local-start-stop-1] [plugin.osgi.factory.OsgiPlugin] logAndClearOustandingDependencies plug-in "com.confluenceservice.confluence.plugin.page is never viewed unsolved '& pageViewedService' services with filter '(& (object = com.confluenceservice.confluence.plugin.PageViewedService) (object = com.confluenceservice.confluence.plugin.PageViewedService))'

The reason for this error was @ComponentImport PageViewedService service :

 @Autowired public AlertUserMacro(@ComponentImport PageViewedService service, @ComponentImport PageManager pageManager) { //constructor... } 

This was normal in Spring Scanner v1, but not in Spring Scanner v2. Import is not needed because PageViewedService is part of my plugin. I needed to import PageManager because its area is outside my plugin. Decision:

 @Autowired public AlertUserMacro(PageViewedService service, @ComponentImport PageManager pageManager) { //constructor } 

Hope this helps.

+4
source

All Articles