记一次多数据源配置问题

问题:

        最近赶项目,云端这边同步数据项目我来搭的,因为需要用到多数据源(不同类型数据库,同一类型数据库不同ip),一开始都没什么问题,后来那哥们那边连接不了。

解决:

        因为sqlserver的版本不同,一个05(貌似),一个08,而jdk版本,我们使用的虽然都是1.8,但是小版本不同,我使用的是1.8.0_31,后来他改为我这个版本就好了。

猜想:

  估计他是用的版本,已经不兼容05sqlserver协议了...

spring下mybatis多数据源配置问题

11-30

这是我的applicationContext.xml文件rn[code=html]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rnrnrn[/code]rn但是用JUnit测试就报:rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mapperScannerConfigurer_1' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sqlSessionFactory' of bean class [org.mybatis.spring.mapper.MapperScannerConfigurer]: Bean property 'sqlSessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:398)rn at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:594)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at test.luobaolin.CjJyUserTest.before(CjJyUserTest.java:17)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)rn at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)rn at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:236)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnCaused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sqlSessionFactory' of bean class [org.mybatis.spring.mapper.MapperScannerConfigurer]: Bean property 'sqlSessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?rn at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)rn at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)rn at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)rn at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)rn ... 36 morernrn请问这是什么问题啊,如果谁有多数据源配置的可以发一个,

spring+JTA 多数据源配置问题

12-28

大家好,小弟在项目中需要连接两个数据库,并要求实现全局事务。查阅了一下资料,使用JOTM进行Spring与JTA的集成,但服务器(Tomcat)启动时报错。主要遇到如下两个问题:rn1、事务的bean,id必须为transactionManager吗?为什么我指定为其他名字,然后在指定,还是报错,说no bean names 'transactionManager'?rn2、即使我将bean的id命名为transactionManager,还是报错,为:Cannot convert value of type [org.springframework.transaction.jta.JtaTransactionManager] to required type [javax.transaction.TransactionManager] for property 'transactionManager': no matching editors or conversion strategy foundrn3、使用JOTM配置JTA,是不是一定要用XA连接池(StandardXAPoolDataSource),用dbcp或c3p0可以么?rn请指教,谢谢~~rn下面是我配置的XML:rn[code=XML]rn rn rn $jdbc.driverClassNamern rn rn $jdbc.urlrn rn rn $jdbc.usernamern rn rn $jdbc.passwordrn rn rn rn rn $jdbc2.driverClassNamern rn rn $jdbc2.urlrn rn rn $jdbc2.usernamern rn rn $jdbc2.passwordrn rn rnrn rn rn rn rn $hibernate.dialectrn 1rn $hibernate.show_sqlrn utf8rn rn rn rn rn classpath*:/xx/xxxrn rn rn rn rn rn rn rn $hibernate.dialectrn 1rn $hibernate.show_sqlrn utf8rn rn rn rn rn classpath*:/xxx/xxxxxrn rn rn rnrn rn rn rn rnrn rn rn rn rn classpath*:jdbc.propertiesrn rn rn rnrn rn rnrn rn rnrn rn rn rn rn rnrn rn rn rn rn rn rn rn rnrn rn rn rn rnrn rn rn rn[/code]

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭