Announcement Announcement Module
Collapse
No announcement yet.
Problems with proxy and object pooling Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with proxy and object pooling

    Hi

    I am running Spring 1.2.8. I am starting a Singleton context listener in a web app. The singleton provides access to the Object Pool from Jakarta Commons Pooling. When the web app starts I am getting the following error

    [7/24/06 12:40:32:281 CDT] 0000001d ContextLoader E TRAS0014I: The following exception was logged org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'EIServiceProxy' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigExcepti on: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
    org.springframework.aop.framework.AopConfigExcepti on: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
    at org.springframework.aop.framework.DefaultAopProxyF actory.createAopProxy(DefaultAopProxyFactory.java: 72)
    at org.springframework.aop.framework.AdvisedSupport.c reateAopProxy(AdvisedSupport.java:487)
    at org.springframework.aop.framework.ProxyFactoryBean .getSingletonInstance(ProxyFactoryBean.java:285)
    at org.springframework.aop.framework.ProxyFactoryBean .setBeanFactory(ProxyFactoryBean.java:239)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:391)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:233)


    I have cglib-xxx.jar in the lib directory of the web app so I don't understand that error.

    My applicationContext.xml is:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>
    <bean id="pooledExpertBean" class="ca.aion.undkbpa9.EIServiceBean" singleton="false">
    </bean>

    <bean id="poolTargetSource" class="org.springframework.aop.target.CommonsPoolT argetSource">
    <property name="targetBeanName" value="pooledExpertBean"/>
    <property name="maxSize" value="5"/>
    <property name="minIdle" value="2"/>
    <property name="maxIdle" value="3"/>
    <property name="maxWait" value="1000"/>
    <!-- WHEN_EXHAUSTED VALUE = WHEN_EXHAUSTED_GROW, .i.e value = 2; - the pool
    will grow even when capped at 5. This will prevent hard timeout
    errors due to pool size. -->
    <property name="whenExhaustedAction" value="2"/>
    <property name="timeBetweenEvictionRunsMillis" value="10000"/>
    <property name="minEvictableIdleTimeMillis" value="10000"/>

    </bean>

    <bean id="pool" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="targetSource" ref="poolTargetSource"/>
    </bean>

    </beans>

    Thanks for your help.

    David

  • #2
    In order to proxy classes (as opposed to interfaces) CGLIB library is required (as specified by the exception message). In your case the EIServiceBean class doesn't contain any interfaces (which can be used for proxying) so Spring has to proxy the class and hence the requirement for CGLIB.

    Comment


    • #3
      Cglib jar in classpath

      Hi

      Thanks for the response. I do have the cglib jar in the lib directory of the web application so it should be available to Spring.

      David

      Comment

      Working...
      X