Background: I’m trying to switch to Spring Java configuration for from the old altassian-plugin.xml component-import for Confluence 9.
However, as soon as import the GlobalSettingsManager
or deprecated SettingsManager
I get a java.lang.ClassNotFoundException: org.springframework.cglib.proxy.Factory
.
Other imports seem to work fine, although I didn’t get app running far enough to be sure.
The import looks like this:
public class AppConfiguration {
@Bean GlobalSettingsManager settingsManager(){ return importOsgiService(GlobalSettingsManager.class);}
// later I use it:
@Bean public BitbucketService bitbucketService() throws Exception {
ApplicationLinkService appLinks = applicationLinks();
GlobalSettingsManager settings = settingsManager();
return new BitbucketService(settings,appLinks, ...)
}
}
This fails on the settingsManager (see exception below).
It also fails if I change it to a FactoryBean
as suggest here.
What is so special about the GlobalSettingsManager
and how do I import it?
Or, is there an alternative to get the getBaseUrl
?
Update: I get the same issue with the SALs ApplicationProperties
.
Here is the full stack trace. You can see how the call to settingsManager
in the AppConfiguration
triggers the error with the proxy.Factory.
[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bitbucketService' defined in ch.mibex.confluence.include.AppConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ch.mibex.confluence.include.bitbucket.BitbucketService]: Factory method 'bitbucketService' threw exception; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.NoClassDefFoundError-->org/springframework/cglib/proxy/Factory
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
[INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:57)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:322)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:287)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
[INFO] [talledLocalContainer] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[INFO] [talledLocalContainer] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[INFO] [talledLocalContainer] at java.base/java.lang.Thread.run(Thread.java:829)
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [ch.mibex.confluence.include.bitbucket.BitbucketService]: Factory method 'bitbucketService' threw exception; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.NoClassDefFoundError-->org/springframework/cglib/proxy/Factory
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
[INFO] [talledLocalContainer] ... 19 more
[INFO] [talledLocalContainer] Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.NoClassDefFoundError-->org/springframework/cglib/proxy/Factory
[INFO] [talledLocalContainer] at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:512)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
[INFO] [talledLocalContainer] at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
[INFO] [talledLocalContainer] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319)
[INFO] [talledLocalContainer] at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:572)
[INFO] [talledLocalContainer] at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:419)
[INFO] [talledLocalContainer] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.createCglibProxyForFactoryBean(ConfigurationClassEnhancer.java:515)
[INFO] [talledLocalContainer] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.enhanceFactoryBean(ConfigurationClassEnhancer.java:489)
[INFO] [talledLocalContainer] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:313)
[INFO] [talledLocalContainer] at ch.mibex.confluence.include.AppConfiguration$$EnhancerBySpringCGLIB$$bfc245d4.settingsManager(<generated>)
[INFO] [talledLocalContainer] at ch.mibex.confluence.include.AppConfiguration.bitbucketService(AppConfiguration.java:48)
[INFO] [talledLocalContainer] at ch.mibex.confluence.include.AppConfiguration$$EnhancerBySpringCGLIB$$bfc245d4.CGLIB$bitbucketService$0(<generated>)
[INFO] [talledLocalContainer] at ch.mibex.confluence.include.AppConfiguration$$EnhancerBySpringCGLIB$$bfc245d4$$FastClassBySpringCGLIB$$3ed3752a.invoke(<generated>)
[INFO] [talledLocalContainer] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
[INFO] [talledLocalContainer] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
[INFO] [talledLocalContainer] at ch.mibex.confluence.include.AppConfiguration$$EnhancerBySpringCGLIB$$bfc245d4.bitbucketService(<generated>)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [talledLocalContainer] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
[INFO] [talledLocalContainer] ... 20 more
[INFO] [talledLocalContainer] Caused by: java.lang.NoClassDefFoundError: org/springframework/cglib/proxy/Factory
[INFO] [talledLocalContainer] at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[INFO] [talledLocalContainer] at java.base/java.lang.System$2.defineClass(System.java:2148)
[INFO] [talledLocalContainer] at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:962)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
[INFO] [talledLocalContainer] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [talledLocalContainer] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[INFO] [talledLocalContainer] at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:507)
[INFO] [talledLocalContainer] ... 47 more
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: org.springframework.cglib.proxy.Factory not found by com.atlassian.plugin.osgi.bridge [11]
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1585)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1970)
[INFO] [talledLocalContainer] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
[INFO] [talledLocalContainer] ... 54 more