Closed szlzhm closed 4 years ago
Hi @szlzhm Do you think sharding-example can give you some points?
Hi @szlzhm Do you think sharding-example can give you some points?
Sorry,this cant solve my problem. I am using alibaba-springcloud-seata ,not io.seata.all
Sorry, I am not a user of alibaba-springcloud-seata
. Also, I can not get any key info from the log above. I feel more logs about the sharding sphere can give us more hints.
@szlzhm I guess this is an alibaba-springcloud-seata issue.
When I use alibaba springcloud 2.2X sentinel seata feign to setup my spring cloud project, I encounter incompatible problems with the shardingjdbc.I use shardingjdbc4.1.X is also unable to solve this problem, ask for help. When remove shardingjdbc away from my project ,it doing work well.
The exception and application.properties and springboot main class and pom.xml are listed at bellow. spring boot main class : @SpringBootApplication(scanBasePackages = "com.kuangchi") @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) @EnableDiscoveryClient @EnableFeignClients
@MapperScan(basePackages = "com.kuangchi.mapper") public class SentinelApplicationpublic static void main(String[] args) throws Exception { SpringApplication.run(SentinelApplication.class, args); } } application.properties:
feign.okhttp.enabled=true
feign.sentinel.enabled=true management.endpoints.web.exposure.include=*
ribbon.okhttp.enabled=true
server.port=8088 spring.shardingsphere.datasource.names=ds0,ds1 spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.jdbc.Driver spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://10.2.28.41:3306/demo_ds0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8 spring.shardingsphere.datasource.ds0.password=XXXXXXX spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource spring.shardingsphere.datasource.ds0.username=root spring.shardingsphere.datasource.ds1.driver-class-name=com.mysql.jdbc.Driver spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:mysql://10.2.28.41:3306/demo_ds1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8 spring.shardingsphere.datasource.ds1.password=XXXXXXX spring.shardingsphere.datasource.ds1.type=com.zaxxer.hikari.HikariDataSource spring.shardingsphere.datasource.ds1.username=root
spring.shardingsphere.props.sql-show=true spring.shardingsphere.props.sharding.binding-tables=t_order,t_order_item spring.shardingsphere.props.sharding.broadcast-tables=t_address spring.shardingsphere.props.sharding.default-database-strategy.inline.algorithm-expression=ds$->{user_id % 2} spring.shardingsphere.props.sharding.default-database-strategy.inline.sharding-column=user_id spring.shardingsphere.props.sharding.tables.t_order.actual-data-nodes=ds$->{0..1}.t_order spring.shardingsphere.props.sharding.tables.t_order.key-generator.column=order_id spring.shardingsphere.props.sharding.tables.t_order.key-generator.props.worker.id=123 spring.shardingsphere.props.sharding.tables.t_order.key-generator.type=SNOWFLAKE spring.shardingsphere.props.sharding.tables.t_order_item.actual-data-nodes=ds$->{0..1}.t_order_item spring.shardingsphere.props.sharding.tables.t_order_item.key-generator.column=order_item_id spring.shardingsphere.props.sharding.tables.t_order_item.key-generator.props.worker.id=123 spring.shardingsphere.props.sharding.tables.t_order_item.key-generator.type=SNOWFLAKE spring.application.name=badger-spring-cloud-alibaba-sentinel spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 spring.cloud.sentinel.transport.dashboard=127.0.0.1:8080 spring.cloud.sentinel.transport.port=8719 spring.cloud.sentinel.datasource.ds1.nacos.server-addr=127.0.0.1:8848 spring.cloud.sentinel.datasource.ds1.nacos.data-id=${spring.application.name} spring.cloud.sentinel.datasource.ds1.nacos.rule-type=flow
POM.xml
Exception:
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]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1503) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1467) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1386) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1245) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:874) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:778) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] ... 116 common frames omitted Caused by: java.lang.IllegalArgumentException: null at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-4.2.jar:4.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-4.2.jar:4.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-4.2.jar:4.2]
at net.sf.cglib.proxy.BridgeMethodResolver.resolveAll(BridgeMethodResolver.java:61) ~[cglib-3.1.jar:na]
at net.sf.cglib.proxy.Enhancer.emitMethods(Enhancer.java:911) ~[cglib-3.1.jar:na]
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:498) ~[cglib-3.1.jar:na]
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) ~[cglib-3.1.jar:na]
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) ~[cglib-3.1.jar:na]
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) ~[cglib-3.1.jar:na]
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285) ~[cglib-3.1.jar:na]
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:663) ~[cglib-3.1.jar:na]
at io.seata.spring.annotation.datasource.SeataDataSourceBeanPostProcessor.proxyDataSource(SeataDataSourceBeanPostProcessor.java:77) ~[seata-all-1.1.0.jar:1.1.0]
at io.seata.spring.annotation.datasource.SeataDataSourceBeanPostProcessor.postProcessAfterInitialization(SeataDataSourceBeanPostProcessor.java:52) ~[seata-all-1.1.0.jar:1.1.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1807) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE]
... 129 common frames omitted