-
Bug
-
Resolution: Fixed
-
High (View bug fix roadmap)
-
4.0
-
4
-
JIRA's serviceManager allows adding services by name. This is an example usage from the SAL JiraPluginScheduler service:
serviceManager.addService(name,
"com.atlassian.sal.jira.scheduling.JiraPluginSchedulerService",
repeatInterval,
serviceDataMap);
The class that is the actual service is supplied as a string, and the service in JIRA then tries to load this class. With plugins2 this no longer works if the service class is provided in a plugins2 bundle, since it's in a different classloader.
Here's an example of an error caused by this, when running the SAL CTK test suite, which tests this functionality:
2009-01-30 14:42:43,659 http-8090-Processor1 ERROR [sal.jira.scheduling.JiraPluginScheduler] Error adding service to jira java.lang.ClassNotFoundException: com.atlassian.sal.jira.scheduling.JiraPluginSchedulerService at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at com.atlassian.jira.configurableobjects.ConfigurableObjectUtil.createPropertySet(ConfigurableObjectUtil.java:28) at com.atlassian.jira.service.OfBizServiceConfigStore.addServiceConfig(OfBizServiceConfigStore.java:54) at com.atlassian.jira.service.DefaultServiceManager.addService(DefaultServiceManager.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$1.invoke(DefaultComponentRegistrar.java:76) at $Proxy185.addService(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:64) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:78) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:36) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy249.addService(Unknown Source) at com.atlassian.sal.jira.scheduling.JiraPluginScheduler.scheduleJob(JiraPluginScheduler.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:64) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:78) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:36) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy262.scheduleJob(Unknown Source) at com.atlassian.sal.ctk.test.PluginSchedulerTest.execute(PluginSchedulerTest.java:29) at com.atlassian.sal.ctk.CtkTestSuite.execute(CtkTestSuite.java:28) at com.atlassian.sal.ctk.CtkServlet.doGet(CtkServlet.java:27) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) ....
- is related to
-
JRASERVER-23543 Plugins2 plugins throw UnsatisfiableDependenciesException when using ServiceManager
-
- Closed
-
The ServiceConfigStore, which turns Strings representing a JiraService into the actual Class, needs to know about all of the ClassLoaders in the system. This means it needs the PluginAccessor injected and needs to iterate through those ClassLoaders when trying to instantiate the JiraService. It now does this.