Closed cay914 closed 4 years ago
Hi @cay914 Thanks for your feedback.
Which version do you use? Could you provide a more detailed stack log?
[ERROR] 11:09:41.556 [ShardingSphere-Command-3] o.a.s.s.f.c.CommandExecutorTask - Exception occur: groovy.lang.MissingMethodException: No signature of method: java.lang.String.mod() is applicable for argument types: (java.lang.Integer) values: [2] Possible solutions: drop(int), find(), any(), find(java.lang.CharSequence), use([Ljava.lang.Object;), take(int) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58) at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at Script5$_run_closure1.doCall(Script5.groovy:1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) at groovy.lang.Closure.call(Closure.java:426) at groovy.lang.Closure.call(Closure.java:420) at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.execute(InlineShardingStrategy.java:94) at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.doSharding(InlineShardingStrategy.java:76) at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.doSharding(InlineShardingStrategy.java:63) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeDataSources(ShardingStandardRoutingEngine.java:204) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route0(ShardingStandardRoutingEngine.java:192) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditionsWithCondition(ShardingStandardRoutingEngine.java:121) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditions(ShardingStandardRoutingEngine.java:115) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.getDataNodes(ShardingStandardRoutingEngine.java:96) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route(ShardingStandardRoutingEngine.java:74) at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:69) at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:53) at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:91) at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76) at org.apache.shardingsphere.underlying.pluggble.prepare.SimpleQueryPrepareEngine.route(SimpleQueryPrepareEngine.java:54) at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96) at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.doShardingRoute(StatementExecutorWrapper.java:80) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.wrapper.StatementExecutorWrapper.route(StatementExecutorWrapper.java:63) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:74) at org.apache.shardingsphere.shardingproxy.backend.text.query.QueryBackendHandler.execute(QueryBackendHandler.java:52) at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:78) at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93) at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
Hello, my navicat version:
sharding-proxy version: 4.1.1
And I have encounted another problem when i refresh 3 (or more) time with navicat. some time good, some time wrong. you can see the picture.
@caiglee @cay914 Thanks for detailed information.
Firstly @caiglee Which SQL did you execute to get the exception? Also, the related sharding rule
is required, since I found this exception was caused by InlineShardingStrategy
.
at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.execute(InlineShardingStrategy.java:94)
For @cay914 's image, It seems another issue, right?
@tuohai666 Do you think this user needs to provide more detail for us to look into?
The same environment, simply refresh from navicat.
@cay914
And I have encounted another problem when i refresh 3 (or more) time with navicat. some time good, some time wrong. you can see the picture.
The picture already told the reason order1.t_order_0 doesn't exist.
All actual tables in your rule as follows:
actualDataNodes: order0.t_order_$->{[0,2,4,6]}, order1.t_order_$->{[1,3,5,7]}
Please remove:
bindingTables:
- t_order
and try again. Only one table can not be binding tables.
For the previous Exception, please change the sharding value user_id from '1' to 1 .
I have try remove bindingTables. But it takes no effect. order1.t_order_0 doesn't exist problem is the same.
my test data is below, can you have a try @tuohai666 order.zip
@cay914 Set sql.show: true and upload the log for this problem. Let's find out what's the SQL need routing to order1.t_order_0.
You should use actual SQL via a ShardingSphere-Proxy, change the actual SQL to logical SQL please.
@tuohai666 I create the table use sharding-proxy and it divide 2 db and 4 table each. I just give you the actual data. You know?
The logical Table DDL via sharding-proxy and you can insert data using the actual data :
CREATE TABLE t_order
(
order_id
int(20) NOT NULL COMMENT '自动编号',
user_id
bigint(20) NOT NULL COMMENT '客户编号',
shop_id
bigint(20) NOT NULL COMMENT '商店编号',
product_count
int(11) NOT NULL COMMENT '商品数量',
product_amount_total
decimal(5,2) NOT NULL COMMENT '商品总价',
order_amount_total
decimal(5,2) NOT NULL COMMENT '订单金额',
logistics_fee
decimal(5,2) DEFAULT NULL COMMENT '运费金额',
is_unpacking_inspection
tinyint(1) DEFAULT NULL COMMENT '是否开箱验货',
is_invoice
tinyint(1) DEFAULT NULL COMMENT '是否开具发票',
invoice_no
varchar(50) DEFAULT NULL COMMENT '发票编号',
address_id
bigint(20) DEFAULT NULL COMMENT '收货地址编号',
logistics_id
bigint(20) DEFAULT NULL COMMENT '订单物流编号',
pay_channel
varchar(50) DEFAULT NULL COMMENT '订单支付渠道',
escrow_trade_no
varchar(50) DEFAULT NULL COMMENT '订单支付单号',
create_time
datetime DEFAULT NULL COMMENT '创建时间/下单时间',
pay_time
datetime DEFAULT NULL COMMENT '付款时间',
deliver_time
datetime DEFAULT NULL COMMENT '发货时间',
settlement_status
varchar(20) DEFAULT NULL COMMENT '货到付款、分期付款会使用',
settlement_time
datetime DEFAULT NULL COMMENT '订单结算时间',
PRIMARY KEY (order_id
),
KEY user_id
(user_id
) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Again. Set sql.show: true and upload the log for this problem. Let's find out what's the SQL need routing to order1.t_order_0.
I can't try to reproduce for I don't have an available Navicat. So, please provide the log.
stacktrace :(((((
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:280)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:254)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:528)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:153)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:144)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$ExposeRepositoryInvocationInterceptor.invoke(CrudMethodMetadataPostProcessor.java:364)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy140.save(Unknown Source)
at com.codebattery.service.OrderService.create(OrderService.java:29)
at com.codebattery.service.OrderService$$FastClassBySpringCGLIB$$49ca46bb.invoke(
You response is meaningless. And you ignored my response completely over and over. I suggest close this issue and tag invalid. If somebody else like to continue this issue, please reopen and assign to whose-self.
我错了哥,给次机会。没有时间看问题
I think sharding-proxy should spupport high version navicat.
Now, i use the navicat 11.1 version.
Ok, this time i can connect to sharding-proxy server. Now, sharding-proxy shocking me.
the table 't_order' ddl
CREATE TABLE
t_order
(order_id
int(20) NOT NULL COMMENT '自动编号',user_id
bigint(20) NOT NULL COMMENT '客户编号',shop_id
bigint(20) NOT NULL COMMENT '商店编号',product_count
int(11) NOT NULL COMMENT '商品数量',product_amount_total
decimal(5,2) NOT NULL COMMENT '商品总价',order_amount_total
decimal(5,2) NOT NULL COMMENT '订单金额',logistics_fee
decimal(5,2) DEFAULT NULL COMMENT '运费金额',is_unpacking_inspection
tinyint(1) DEFAULT NULL COMMENT '是否开箱验货',is_invoice
tinyint(1) DEFAULT NULL COMMENT '是否开具发票',invoice_no
varchar(50) DEFAULT NULL COMMENT '发票编号',address_id
bigint(20) DEFAULT NULL COMMENT '收货地址编号',logistics_id
bigint(20) DEFAULT NULL COMMENT '订单物流编号',pay_channel
varchar(50) DEFAULT NULL COMMENT '订单支付渠道',escrow_trade_no
varchar(50) DEFAULT NULL COMMENT '订单支付单号',create_time
datetime DEFAULT NULL COMMENT '创建时间/下单时间',pay_time
datetime DEFAULT NULL COMMENT '付款时间',deliver_time
datetime DEFAULT NULL COMMENT '发货时间',settlement_status
varchar(20) DEFAULT NULL COMMENT '货到付款、分期付款会使用',settlement_time
datetime DEFAULT NULL COMMENT '订单结算时间', PRIMARY KEY (order_id
), KEYuser_id
(user_id
) USING BTREE) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;insert data: INSERT INTO
t_order
(order_id
,user_id
,shop_id
,product_count
,product_amount_total
,order_amount_total
,logistics_fee
,is_unpacking_inspection
,is_invoice
,invoice_no
,address_id
,logistics_id
,pay_channel
,escrow_trade_no
,create_time
,pay_time
,deliver_time
,settlement_status
,settlement_time
) VALUES ( '1', '1', '1', '1', '1', '1', '1', NULL, '1', 'xxx', '1', '1', '微信支付', 'xxxx', '2020-07-31 00:56:41', '2020-07-31 00:56:44', '2020-07-31 00:56:46', NULL, NULL );the error message:
[Err] 10002 - 2Unknown exception: [No signature of method: java.lang.String.mod() is applicable for argument types: (java.lang.Integer) values: [2] Possible solutions: drop(int), find(), any(), find(java.lang.CharSequence), find(groovy.lang.Closure), use([Ljava.lang.Object;)]
the setting file is: sharding-proxy.zip
conclusion: Creating table is ok, but inserting data is TOO BAD。