Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.2.5
-
None
-
Spring 2.5.6
Description
In some cases we're using the ContextSingletonBeanFactoryLocator to obtain a cxf client from a non spring bean (cp. Spring's section about "Glue code and the evil singleton"). For example:
BeanFactory bf = ContextSingletonBeanFactoryLocator.getInstance().useBeanFactory("cssBeanFactory").getFactory();
final AccountService accountService = (AccountService) bf.getBean("accountService", AccountService.class);
With 2.2.3 this was no problem...the proxies were only created once at startup (no further call, when bf.getBean is called):
ReflectionServiceFactoryBean.buildServiceFromClass() line: 351
ReflectionServiceFactoryBean.initializeServiceModel() line: 444
ReflectionServiceFactoryBean.create() line: 195
ClientFactoryBean(AbstractWSDLBasedEndpointFactory).createEndpoint() line: 100
ClientFactoryBean.create() line: 52
ClientProxyFactoryBeanDefinitionParser$SpringClientProxyFactoryBean(ClientProxyFactoryBean).create() line: 102
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CglibSubclassingInstantiationStrategy(SimpleInstantiationStrategy).instantiate(RootBeanDefinition, String, BeanFactory, Object, Method, Object[]) line: 115
ConstructorResolver.instantiateUsingFactoryMethod(String, RootBeanDefinition, Object[]) line: 435
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).instantiateUsingFactoryMethod(String, RootBeanDefinition, Object[]) line: 903
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBeanInstance(String, RootBeanDefinition, Object[]) line: 817
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 440
AbstractAutowireCapableBeanFactory$1.run() line: 409
AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 380
AbstractBeanFactory$1.getObject() line: 264
DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 222
DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class, Object[], boolean) line: 261
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String, Class, Object[]) line: 185
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 164
DefaultListableBeanFactory.preInstantiateSingletons() line: 429
ClassPathXmlApplicationContext(AbstractApplicationContext).finishBeanFactoryInitialization(ConfigurableListableBeanFactory) line: 728
ClassPathXmlApplicationContext(AbstractApplicationContext).refresh() line: 380
ClassPathXmlApplicationContext.<init>(String[], boolean, ApplicationContext) line: 139
ClassPathXmlApplicationContext.<init>(String[]) line: 93
NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not available [native method]
NativeConstructorAccessorImpl.newInstance(Object[]) line: 39
DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 27
Constructor<T>.newInstance(Object...) line: 513
BeanUtils.instantiateClass(Constructor, Object[]) line: 100
CglibSubclassingInstantiationStrategy(SimpleInstantiationStrategy).instantiate(RootBeanDefinition, String, BeanFactory, Constructor, Object[]) line: 87
ConstructorResolver.autowireConstructor(String, RootBeanDefinition, Constructor[], Object[]) line: 248
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).autowireConstructor(String, RootBeanDefinition, Constructor[], Object[]) line: 925
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBeanInstance(String, RootBeanDefinition, Object[]) line: 835
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 440
AbstractAutowireCapableBeanFactory$1.run() line: 409
AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 380
AbstractBeanFactory$1.getObject() line: 264
DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 222
DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class, Object[], boolean) line: 261
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String, Class, Object[]) line: 185
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String, Class) line: 168
ClassPathXmlApplicationContext(AbstractApplicationContext).getBean(String, Class) line: 884
ContextSingletonBeanFactoryLocator(SingletonBeanFactoryLocator).useBeanFactory(String) line: 397
ContextLoader.loadParentContext(ServletContext) line: 341
ContextLoader.initWebApplicationContext(ServletContext) line: 195
ContextLoaderListener.contextInitialized(ServletContextEvent) line: 45
With 2.2.5 there is no call at startup time, but each time bf.getBean is called
ReflectionServiceFactoryBean.buildServiceFromClass() line: 432
ReflectionServiceFactoryBean.initializeServiceModel() line: 523
ReflectionServiceFactoryBean.create() line: 271
ClientFactoryBean(AbstractWSDLBasedEndpointFactory).createEndpoint() line: 100
ClientFactoryBean.create() line: 51
ClientProxyFactoryBeanDefinitionParser$SpringClientProxyFactoryBean(ClientProxyFactoryBean).create() line: 102
ClientProxyFactoryBeanDefinitionParser$SpringClientProxyFactoryBean.getObject() line: 111
FactoryBeanRegistrySupport$1.run() line: 121
AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
DefaultListableBeanFactory(FactoryBeanRegistrySupport).doGetObjectFromFactoryBean(FactoryBean, String, boolean) line: 116
DefaultListableBeanFactory(FactoryBeanRegistrySupport).getObjectFromFactoryBean(FactoryBean, String, boolean) line: 98
DefaultListableBeanFactory(AbstractBeanFactory).getObjectForBeanInstance(Object, String, String, RootBeanDefinition) line: 1288
DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class, Object[], boolean) line: 217
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String, Class, Object[]) line: 185
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String, Class) line: 168
ClassPathXmlApplicationContext(AbstractApplicationContext).getBean(String, Class) line: 884
After some time this leads to a OutOfMemoryError:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountService': FactoryBean threw exception on
object creation; nested exception is java.lang.OutOfMemoryError: Java heap space
Attachments
Issue Links
- relates to
-
CXF-2449 Spring Autowire by type doesn't work with jaxws:client
- Closed