Announcement Announcement Module
Collapse
No announcement yet.
proxyTargetClass using OJB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • proxyTargetClass using OJB

    Hi,

    I'm using spring's transactionmanagement with OJB 1.0. When trying to use a class rather than an interface I retrieve the following exception.
    Configuration is:

    Code:
    	<bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOjbConfigurer"/>
    	<bean id="myTransactionManager" class="org.springframework.orm.ojb.PersistenceBrokerTransactionManager"/>
    	<bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
    			abstract="true" >
    		<property name="transactionManager"><ref bean="myTransactionManager"/></property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				...
    			</props>
    		</property>
    	</bean>
    
    	<bean id="accessMng" parent="baseTransactionProxy" >
    		<property name="target" >
    			<bean class="eg.model.mng.AccessMngOjbImpl" />
    		</property>
    		<!-- this line causes the exception -->
    		<property name="proxyTargetClass"><value>true</value></property> 
    	</bean>
    Thanks for any help !
    Leo

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'accessMng' defined in class path resource [applicationContext-ojb.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null
    net.sf.cglib.core.CodeGenerationException: java.lang.IllegalArgumentException-->Protected method: createPersistenceBrokerTemplate()Lorg/springframework/orm/ojb/PersistenceBrokerTemplate;
    at net.sf.cglib.core.ReflectUtils.newInstance(Reflect Utils.java:235)
    at net.sf.cglib.core.ReflectUtils.newInstance(Reflect Utils.java:220)
    at net.sf.cglib.core.ReflectUtils.newInstance(Reflect Utils.java:216)
    at net.sf.cglib.proxy.Enhancer.createUsingReflection( Enhancer.java:566)
    at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer .java:493)
    at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:220)
    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:171)
    at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:136)
    at org.springframework.aop.framework.ProxyFactory.get Proxy(ProxyFactory.java:66)
    at org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean.afterPropertiesSet(Transacti onProxyFactoryBean.java:236)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:991)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:288)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:208)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:204)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:136)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:224)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:284)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:56)

  • #2
    Leo,

    Can you post the code for your AccessMngOjbImpl class. I have tried reproducing this with a simple example but I have been unable to do so. Also which version of Spring and CGLIB are you using?

    Rob

    Comment


    • #3
      Hi Rob,

      I'm using spring 1.1 and cglib-full-2.0.2. The code is:
      public class AccessMngOjbImpl extends PersistenceBrokerDaoSupport implements AccessMng {
      public void updateUser(AppUser user) throws MyException {
      if (user.getFirstname() == null)
      throw new MyException("firstname is not set for user: " + user.getId());
      getPersistenceBrokerTemplate().store(user);
      }
      ...
      }

      Leo

      Comment


      • #4
        Leo,

        Thanks for that. I am able to reproduce this bug on my machine. I will look into it a little more. I have created an issue on JIRA so you can track the progress: http://opensource.atlassian.com/proj...browse/SPR-357.

        For now I recommend that you use JDK proxies by removing the proxyTargetClass property.

        Rob

        Comment


        • #5
          Leo,

          This is now fixed in CVS and the fix will make its way into 1.1.1 which will be released fairly soon.

          Rob

          Comment


          • #6
            Hi Rob,

            thank you for the quick help !!

            Leo

            Comment

            Working...
            X