You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/12/09 08:36:51 UTC

[GitHub] [incubator-shardingsphere] winson08Li opened a new issue #3694: Navicat keeps showing NPE when I trying to connect to sharding-proxy

winson08Li opened a new issue #3694: Navicat keeps showing NPE when I trying to connect to sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3694
 
 
   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   4.0.0-RC3
   
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-Proxy
   
   ### Expected behavior
   Connection success
   
   ### Actual behavior
   ```
   [INFO ] 16:27:09.459 [nioEventLoopGroup-2-1] i.n.handler.logging.LoggingHandler - [id: 0x34b52d22, L:/0:0:0:0:0:0:0:0:3307] READ: [id: 0xe09eaee7, L:/192.168.69.140:3307 - R:/192.168.69.140:52938]
   [INFO ] 16:27:09.460 [nioEventLoopGroup-2-1] i.n.handler.logging.LoggingHandler - [id: 0x34b52d22, L:/0:0:0:0:0:0:0:0:3307] READ COMPLETE
   [INFO ] 16:27:09.969 [ShardingSphere-Command-0] ShardingSphere-SQL - Rule Type: sharding
   [INFO ] 16:27:09.969 [ShardingSphere-Command-0] ShardingSphere-SQL - Logic SQL: SET NAMES utf8mb4
   [INFO ] 16:27:09.969 [ShardingSphere-Command-0] ShardingSphere-SQL - SQLStatement: CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.core.parse.sql.statement.dal.SetStatement@3f29ca90, tablesContext=TablesContext(tables=[], schema=Optional.absent()))
   [INFO ] 16:27:09.969 [ShardingSphere-Command-0] ShardingSphere-SQL - Actual SQL: ds_0 ::: SET NAMES utf8mb4
   [INFO ] 16:27:10.002 [ShardingSphere-Command-1] ShardingSphere-SQL - Rule Type: sharding
   [INFO ] 16:27:10.002 [ShardingSphere-Command-1] ShardingSphere-SQL - Logic SQL: SHOW VARIABLES LIKE 'lower_case_%'
   [INFO ] 16:27:10.002 [ShardingSphere-Command-1] ShardingSphere-SQL - SQLStatement: CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.core.parse.sql.statement.dal.dialect.mysql.ShowOtherStatement@7fcd454c, tablesContext=TablesContext(tables=[], schema=Optional.absent()))
   [INFO ] 16:27:10.002 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_0 ::: SHOW VARIABLES LIKE 'lower_case_%'
   [INFO ] 16:27:10.035 [ShardingSphere-Command-2] ShardingSphere-SQL - Rule Type: sharding
   [INFO ] 16:27:10.035 [ShardingSphere-Command-2] ShardingSphere-SQL - Logic SQL: SHOW VARIABLES LIKE 'sql_mode'
   [INFO ] 16:27:10.035 [ShardingSphere-Command-2] ShardingSphere-SQL - SQLStatement: CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.core.parse.sql.statement.dal.dialect.mysql.ShowOtherStatement@4fad8668, tablesContext=TablesContext(tables=[], schema=Optional.absent()))
   [INFO ] 16:27:10.035 [ShardingSphere-Command-2] ShardingSphere-SQL - Actual SQL: ds_1 ::: SHOW VARIABLES LIKE 'sql_mode'
   [INFO ] 16:27:10.133 [ShardingSphere-Command-3] ShardingSphere-SQL - Rule Type: sharding
   [INFO ] 16:27:10.133 [ShardingSphere-Command-3] ShardingSphere-SQL - Logic SQL: SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA
   [INFO ] 16:27:10.133 [ShardingSphere-Command-3] ShardingSphere-SQL - SQLStatement: SelectSQLStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.core.parse.sql.statement.dml.SelectStatement@1a3d6cbe, tablesContext=TablesContext(tables=[Table(name=SCHEMATA, alias=Optional.absent())], schema=Optional.of(information_schema))), projectionsContext=ProjectionsContext(startIndex=7, stopIndex=69, distinctRow=false, projections=[ColumnProjection(owner=null, name=SCHEMA_NAME, alias=Optional.absent()), ColumnProjection(owner=null, name=DEFAULT_CHARACTER_SET_NAME, alias=Optional.absent()), ColumnProjection(owner=null, name=DEFAULT_COLLATION_NAME, alias=Optional.absent())]), groupByContext=org.apache.shardingsphere.core.preprocessor.segment.select.groupby.GroupByContext@7ce6f1a2, orderByContext=org.apache.shardingsphere.core.preprocessor.segment.select.orderby.OrderByContext@459e27f0, paginationContext=org.apache.shardingsphere.core.preprocessor.segment.select.pagination.PaginationContext@764fb7d0, containsSubquery=false)
   [INFO ] 16:27:10.133 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: null ::: SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA
   [ERROR] 16:27:10.136 [ShardingSphere-Command-3] o.a.s.s.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: null
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.createConnection(JDBCBackendDataSource.java:150)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:123)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnectionFromUnderlying(BackendConnection.java:198)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:181)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:150)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.execute.callback.ProxyJDBCExecutePrepareCallback.getConnections(ProxyJDBCExecutePrepareCallback.java:56)
   	at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getSQLExecuteGroups(SQLExecutePrepareTemplate.java:89)
   	at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getSynchronizedExecuteUnitGroups(SQLExecutePrepareTemplate.java:67)
   	at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getExecuteUnitGroups(SQLExecutePrepareTemplate.java:59)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.execute.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:80)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:78)
   	at org.apache.shardingsphere.shardingproxy.backend.text.query.QueryBackendHandler.execute(QueryBackendHandler.java:54)
   	at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:73)
   	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:86)
   	at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:66)
   	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)
   
   ```
   ### Reason analyze (If you can)
   Have no idea
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   I just modify the server.yaml to following content:
   ```
   authentication:
       users:
         root:
           password: 123456
         sharding:
           password: sharding 
           authorizedSchemas: sharding_db
   
   props:
     acceptor.size: 16  # The default value is available processors count * 2.
     executor.size: 16  # Infinite by default.
     proxy.frontend.flush.threshold: 128  # The default value is 128.
     sql.show: true
   ```
   And the config-sharding.yaml:
   ```
   schemaName: sharding_db
   
   dataSources:
     ds_0:
       url: jdbc:mysql://192.168.69.167:3307/ds0?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
     ds_1:
       url: jdbc:mysql://192.168.69.167:3308/ds1?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
   
   shardingRule:
     tables:
       t_order:
         actualDataNodes: ds_${0..1}.t_order_${0..1}
         tableStrategy:
           inline:
             shardingColumn: order_id
             algorithmExpression: t_order_${order_id % 2}
         keyGenerator:
           type: SNOWFLAKE
           column: order_id
       t_order_item:
         actualDataNodes: ds_${0..1}.t_order_item_${0..1}
         tableStrategy:
           inline:
             shardingColumn: order_id
             algorithmExpression: t_order_item_${order_id % 2}
         keyGenerator:
           type: SNOWFLAKE
           column: order_item_id
     bindingTables:
       - t_order,t_order_item
     defaultDatabaseStrategy:
       inline:
         shardingColumn: user_id
         algorithmExpression: ds_${user_id % 2}
     defaultTableStrategy:
       none:
   ```
   So I click the `Run` button on IDEA, everything is fine, but when I connect with navicat, it shows the error in the log.
   
   ### Example codes for reproduce this issue (such as a github link).
   I didn't do any modification to the code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services