配置数据源采用的是下面文章中的方法,用jdk1.6可以正常运行,换成jdk1.7就无法运行 
http://blog.csdn.net/alaahong/article/details/8707915找了下原因是写一个DynamicDataSource类继承AbstractRoutingDataSource,
AbstractRoutingDataSource基类继承的是CommonDataSource,
CommonDataSource接口中增加了getParentLogger方法。
但不知道怎么实现这个方法

解决方案 »

  1.   

    换成jdk1.7就无法运行
    报什么错,这个总要贴下吧。
      

  2.   

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyParantService': 
    Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ews.xianguoxiu.shop.dao.IPropertyParantDao com.ews.xianguoxiu.shop.service.PropertyParantService.propertyParantDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyParantDao' defined in file [E:\xianguoxiu\WebRoot\WEB-INF\classes\com\ews\xianguoxiu\shop\daoImpl\PropertyParantDaoImpl.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file 
    [E:\xianguoxiu\WebRoot\WEB-INF\applicationContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [E:\xianguoxiu\WebRoot\WEB-INF\applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdviceXGX': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [E:\xianguoxiu\WebRoot\WEB-INF\applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': FactoryBean which is currently in creation returned null from getObject
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075)
    at com.ews.xianguoxiu.shop.test.service.PropertyParantTest.testGet(PropertyParantTest.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at junit.framework.TestCase.runTest(TestCase.java:168)
      

  3.   

    将org.springframework.jdbc-3.0.5.RELEASE.jar包换成org.springframework.jdbc-3.1.1.RELEASE.jar的包就可以了新包中有对CommonDataSource接口中getParentLogger() 的实现