当前位置:网站首页>Shardingsphere JDBC keyword problem
Shardingsphere JDBC keyword problem
2022-07-26 22:36:00 【bohu83】
Use sharding When , There are two problems . Record :
1 Configuration problem :
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardingDataSource' defined in class path resource [org/apache/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingDataSource' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)The use of springboot+mybatis+yaml To configure . The version is 4.1.1
This is not common without configuration sharding Data source causes empty Error of .
dataSources:
ds0: !!org.apache.commons.dbcp.BasicDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/ds0
username: root
password: There needs to be more type attribute :
type: com.alibaba.druid.pool.DruidDataSource
About sharding Refer to the manual on the official website .
Yaml To configure :: ShardingSphere
I made a mistake . I only wrote the name of the tabulation Algorithm ,
The right is :
preciseAlgorithmClassName The corresponding class name , Be careful yaml Indentation

Two Keyword error
If the field is used order, mutex etc. mysql key word . Will result in query SQL Parsing exceptions , Or update the spatiotemporal pointer exception .
The hint here is , Suppose an old database has a pile of tables , Only separate individual tables . introduce sharding Although the sub table is specified later bindingTables, The rest go default-data-source It is the default that there is no table .
however sharding Will take over the data source , The old watch uses the default mybatis normal ,sharding There may be a mistake .
边栏推荐
- Redis distributed lock + Lua atomic operation
- 中兴通讯:5G基站在全球发货已超过5万个!
- Embedded sig | distributed soft bus
- 2022-07-26:以下go语言代码输出什么?A:5;B:hello;C:编译错误;D:运行错误。 package main import ( “fmt“ )
- [try to hack] firewall (I)
- DTS搭载全新自研内核,突破两地三中心架构的关键技术|腾讯云数据库
- LeetCode 121:买卖股票的最佳时机
- Nacos作为注册中心、配置中心入门使用篇-实现远程调用、动态获取配置文件、数据库配置信息
- Luo Yonghao bet on the last entrepreneurial credit
- Parameter analysis and stone jumping board
猜你喜欢

博途PLC输出通道映射FC

Linear DP of dynamic programming

golang中的信号量的实现原理

A chip company fell in round B

2022 latest Tibet Construction Safety Officer simulation question bank and answers

浮动引起的高度塌陷问题

Five years after graduation, I changed from information management to software testing engineer, and my monthly salary finally exceeded 12K

Leetcode 121: the best time to buy and sell stocks

yolov1

Implementation of V-model syntax sugar
随机推荐
JWT implements login authentication + token automatic renewal scheme, which is the correct posture!
判断numpy array数组的维数
A13处理器成iPhone11系列最大亮点:性能是麒麟980两倍!
JSON字符串转化为JSON对象,获取某个key的值,判断某个key是否存在
《强化学习周刊》第55期:LB-SGD、MSP-DRL & 对抗鲁棒强化学习
Leetcode:857. Minimum cost of employing K workers [think in blocks + start with simplicity]
Understand China's financial system in one article
Sell 700million a year, and get ready for the IPO of Dezhou braised chicken
leetcode:857. 雇佣 K 名工人的最低成本【分块思考 + 由简单入手】
[waiting and wakeup of QT multithreaded threads]
[IO Development Notes] smart cloud intelligent watering device practice (3) - automatic code generation and transplantation
功耗降低、功能升级!启英泰伦发布二代语音AI芯片:模组价格低至14.99元!
Iptables prevents nmap scanning and enables incremental backup of binlog
『MongoDB』你想要的MongoDB基本操作这里都有
Instructions for use of light source controller dial switch
【工具】Apifox
让程序在一秒或者多秒中做一件事情
SQL injection less24 (secondary injection)
Sort out each order when you are in love (it takes two months to sort out in detail)
Interview Essentials