Back Forum Reply New

Problem with CGLIB

mons.dbcp.BasicDataSourcequot;
destroy-method=quot;closequot;gt;
lt;property name=quot;driverClassNamequot;gt;
lt;valuegt;com.informix.jdbc.IfxDriverlt;/valuegt;
lt;/propertygt;
lt;!-- attention : ne pas laisser d'espaces entre les deux balises lt;valuegt; --gt;
lt;!--
l'ucl standard pour informix est :
jdbc:informix-sqli--[{ip-address|host-name}ort-number][/dbname]:INFORMIXSERVER=servername[;user=user;password=password]
--gt;
lt;property name=quot;uclquot;gt;
lt;valuegt;jdbc:informix-sqli--192.9.200.1:1526/pharma:INFORMIXSERVER=inforollt;/valuegt;
lt;/propertygt;
lt;property name=quot;usernamequot;gt;
lt;valuegt;odbclt;/valuegt;
lt;/propertygt;
lt;property name=quot;passwordquot;gt;
lt;valuegt;odbclt;/valuegt;
lt;/propertygt;
lt;/beangt;

lt;bean id=quot;pgDataSourcequot; class=quot;org.apache.commons.dbcp.BasicDataSourcequot;
destroy-method=quot;closequot;gt;
lt;property name=quot;driverClassNamequot;gt;
lt;valuegt;org.postgresql.Driverlt;/valuegt;
lt;/propertygt;
lt;property name=quot;uclquot;gt;
lt;valuegt;jdbcostgresqlharmajlt;/valuegt;
lt;/propertygt;
lt;property name=quot;usernamequot;gt;
lt;valuegt;javaciplt;/valuegt;
lt;/propertygt;
lt;property name=quot;passwordquot;gt;
lt;valuegt;pharmalt;/valuegt;
lt;/propertygt;
lt;/beangt;

lt;!-- SqlMapCllient(s) : 1 pour chaque bdd (Informix et PostgreSQL) --gt;
lt;bean id=quot;ifxSqlMapClientquot;
class=quot;org..orm.ibatis.SqlMapClient  FactoryBeanquot;gt;
lt;property name=quot;dataSourcequot;gt;
lt;ref local=quot;ifxDataSourcequot;/gt;
lt;/propertygt;
lt;property name=quot;configLocationquot;gt;
lt;valuegt;classpath:ibatis\sql-map-config-ifx.xmllt;/valuegt;
lt;/propertygt;
lt;/beangt;

lt;bean id=quot;pgSqlMapClientquot;
class=quot;org..orm.ibatis.SqlMapClient  FactoryBeanquot;gt;
lt;property name=quot;dataSourcequot;gt;
lt;ref local=quot;pgDataSourcequot;/gt;
lt;/propertygt;
lt;property name=quot;configLocationquot;gt;
lt;valuegt;classpath:ibatis\sql-map-config-pg.xmllt;/valuegt;
lt;/propertygt;
lt;/beangt;

lt;!-- [dao] --gt;
lt;!-- la classes d'accès à la couche [dao] Informix --gt;
lt;bean id=quot;daoIfxquot; class=quot;net.baboutini.commandes.dao.DaoIfxImplquot;gt;
lt;property name=quot;sqlMapClientquot;gt;
lt;ref local=quot;ifxSqlMapClientquot;/gt;
lt;/propertygt;
lt;/beangt;

lt;!-- la classes d'accès à la couche [dao] PostgreSQL--gt;
lt;bean id=quot;daoPgquot; class=quot;net.baboutini.commandes.dao.DaoPgImplquot;gt;
lt;property name=quot;sqlMapClientquot;gt;
lt;ref local=quot;pgSqlMapClientquot;/gt;
lt;/propertygt;
lt;/beangt;

lt;!-- [service] --gt;
lt;!-- la classes d'accès à la couche [service] Informix --gt;
lt;bean id=quot;serviceIfxquot; class=quot;net.baboutini.commandes.service.ServiceIfxI  mplquot;gt;
lt;property name=quot;daoIfxquot;gt;
lt;ref local=quot;daoIfxquot;/gt;
lt;/propertygt;
lt;/beangt;

lt;!-- gestionnaire de transactions pour PostgreSQL --gt;
lt;bean id=quot;pgTransactionManagerquot;
class=quot;org..jdbc.datasource.DataSou  rceTransactionManagerquot;gt;
lt;property name=quot;dataSourcequot;gt;
lt;ref local=quot;pgDataSourcequot;/gt;
lt;/propertygt;
lt;/beangt;

lt;!-- la classes d'accès à la couche [service] pour PostgreSQL --gt;
lt;bean id=quot;servicePgquot;
class=quot;org..transaction.interceptor  .TransactionProxyFactoryBeanquot;gt;
lt;property name=quot;transactionManagerquot;gt;
lt;ref local=quot;pgTransactionManagerquot;/gt;
lt;/propertygt;
lt;property name=quot;targetquot;gt;
lt;bean class=quot;net.baboutini.commandes.service.ServicePgIm  plquot;gt;
lt;property name=quot;daoPgquot;gt;
lt;ref local=quot;daoPgquot;/gt;
lt;/propertygt;
lt;/beangt;
lt;/propertygt;
lt;property name=quot;transactionAttributesquot;gt;
lt;propsgt;
lt;prop key=quot;get*quot;gtROPAGATION_REQUIRED,readOnlylt;/propgt;
lt;prop key=quot;save*quot;gtROPAGATION_REQUIREDlt;/propgt;
lt;prop key=quot;delete*quot;gtROPAGATION_REQUIREDlt;/propgt;
lt;/propsgt;
lt;/propertygt;
lt;/beangt;

I've taken a transaction manager configuration in a tutorial and it seems to work for this guy. But when I run a test, I get this stack trace :
org..beans.factory.BeanCreationExce  ption: Error creating bean with name 'servicePg' defined in class path resource [net/baboutini/commandes/tests/spring-config-test.xml]: Initialization of bean failed; nested exception is org..aop.framework.AopConfigExcepti  on: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
org..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..aop.framework.DefaultAopProxyF  actory.createAopProxy(DefaultAopProxyFactory.java:  72)
at org..aop.framework.AdvisedSupport.c  reateAopProxy(AdvisedSupport.java:487)
at org..aop.framework.ProxyFactory.get  Proxy(ProxyFactory.java:70)
at org..transaction.interceptor.Transa  ctionProxyFactoryBean.getProxy(TransactionProxyFac  toryBean.java:338)
at org..transaction.interceptor.Transa  ctionProxyFactoryBean.afterPropertiesSet(Transacti  onProxyFactoryBean.java:310)
at org..beans.factory.support.Abstract  AutowireCapableBeanFactory.invokeInitMethods(Abstr  actAutowireCapableBeanFactory.java:1091)
at org..beans.factory.support.Abstract  AutowireCapableBeanFactory.createBean(AbstractAuto  wireCapableBeanFactory.java:396)
at org..beans.factory.support.Abstract  BeanFactory.getBean(AbstractBeanFactory.java:233)
at org..beans.factory.support.Abstract  BeanFactory.getBean(AbstractBeanFactory.java:145)
at net.baboutini.commandes.tests.TestServicePg.setUp(  TestServicePg.java:33)
at junit.framework.TestCase.runBare(TestCase.java:125  )
at junit.framework.TestResult$1.protect(TestResult.ja  va:106)
at junit.framework.TestResult.runProtected(TestResult  .java:124)
at junit.framework.TestResult.run(TestResult.java:109  )
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:2  08)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu  nner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu  nner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu  nner.main(RemoteTestRunner.java:196)So it cannot find CGLIB2.

I don't fully understand Spring AOP, could someone help me ?

TIA

Arnaud

OK, stupid mistake, I've found cglib.jar in the spring framework directory

Sorry ;-)

Arnaud
¥
Back Forum Reply New