wrk
Feb 24th, 2005, 01:37 PM
I am attempting to use CommonsPoolTargetSource to manage instances of an object that expects a Properties object passed to the constructor, then apply ProxyFactoryBean to enable pooling within my application. I am working with Spring Framework 1.1.3.
Here is the definition of the target:
<bean id="delegateTarget" class="wrk.DirectoryInquiryDelegate" singleton="false">
<constructor-arg>
<props>
<prop key="java.naming.provider.url">${java.naming.provider.url}</prop>
<prop key="java.naming.security.principal">${java.naming.security.principal}</prop>
<prop key="java.naming.security.credentials">${java.naming.security.credentials}</prop>
</props>
</constructor-arg>
</bean>
Here is the declaration for the target source:
<bean id="poolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSo urce">
<property name="targetBeanName"><value>delegateTarget</value></property>
<property name="maxSize"><value>5</value></property>
</bean>
And finally, here is the proxy factory:
<bean id="delegate" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource"><ref local="poolTargetSource"/></property>
</bean>
Everything seems to be ok right up to the point of initializing the proxy, at which point the following exception is thrown:
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'delegate' defined in class path resource [csilContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhan cer.java:783)
at net.sf.cglib.proxy.Enhancer.emit(Enhancer.java:749 )
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer .java:481)
at net.sf.cglib.transform.TransformingClassGenerator. generateClass(TransformingClassGenerator.java:33)
at net.sf.cglib.core.DefaultGeneratorStrategy.generat e(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:215)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer. java:368)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:2 80)
at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:163)
at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:124)
at org.springframework.aop.framework.ProxyFactoryBean .getSingletonInstance(ProxyFactoryBean.java:241)
at org.springframework.aop.framework.ProxyFactoryBean .setBeanFactory(ProxyFactoryBean.java:201)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:301)
It is distinctly possible that I have misunderstood the configuration requirements for the use of the Commons Pool Target Source but I can't seem to figure out what I am doing wrong.
Any advice would be greatly appreciated!
Here is the definition of the target:
<bean id="delegateTarget" class="wrk.DirectoryInquiryDelegate" singleton="false">
<constructor-arg>
<props>
<prop key="java.naming.provider.url">${java.naming.provider.url}</prop>
<prop key="java.naming.security.principal">${java.naming.security.principal}</prop>
<prop key="java.naming.security.credentials">${java.naming.security.credentials}</prop>
</props>
</constructor-arg>
</bean>
Here is the declaration for the target source:
<bean id="poolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSo urce">
<property name="targetBeanName"><value>delegateTarget</value></property>
<property name="maxSize"><value>5</value></property>
</bean>
And finally, here is the proxy factory:
<bean id="delegate" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource"><ref local="poolTargetSource"/></property>
</bean>
Everything seems to be ok right up to the point of initializing the proxy, at which point the following exception is thrown:
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'delegate' defined in class path resource [csilContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhan cer.java:783)
at net.sf.cglib.proxy.Enhancer.emit(Enhancer.java:749 )
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer .java:481)
at net.sf.cglib.transform.TransformingClassGenerator. generateClass(TransformingClassGenerator.java:33)
at net.sf.cglib.core.DefaultGeneratorStrategy.generat e(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:215)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer. java:368)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:2 80)
at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:163)
at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:124)
at org.springframework.aop.framework.ProxyFactoryBean .getSingletonInstance(ProxyFactoryBean.java:241)
at org.springframework.aop.framework.ProxyFactoryBean .setBeanFactory(ProxyFactoryBean.java:201)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:301)
It is distinctly possible that I have misunderstood the configuration requirements for the use of the Commons Pool Target Source but I can't seem to figure out what I am doing wrong.
Any advice would be greatly appreciated!