shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Caused by: java.lang.NoClassDefFoundError: org/apache/shardingsphere/globalclock/core/yaml/config/YamlGlobalClockRuleConfiguration

Open wsm12138 opened this issue 1 year ago • 1 comments

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

cf4a0853401924082a0f7c8bdf699f4c1441e130

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

JDBC

Expected behavior

Actual behavior

17:19:44,796 [main] INFO   jTPCC : Term-00, config=/opt/jenkins/benchmarksql/run/config-tpcc.yaml
17:19:44,797 [main] INFO   ShardingJdbc : create in SHARDING!!!sharding:opengauss://localhost:5432/test?loggerLevel=OFF
java.lang.reflect.InvocationTargetException
	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 ShardingJdbc.loadShardingDataSource(ShardingJdbc.java:34)
	at ShardingJdbc.getDataSource(ShardingJdbc.java:58)
	at ShardingJdbc.getConnection(ShardingJdbc.java:73)
	at jTPCCUtil.getConfig(jTPCCUtil.java:76)
	at jTPCC.<init>(jTPCC.java:347)
	at jTPCC.main(jTPCC.java:68)
Caused by: java.lang.NoClassDefFoundError: org/apache/shardingsphere/globalclock/core/yaml/config/YamlGlobalClockRuleConfiguration
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetPublicMethods(Class.java:2902)
	at java.lang.Class.getMethods(Class.java:1615)
	at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1336)
	at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1197)
	at java.beans.Introspector.getBeanInfo(Introspector.java:426)
	at java.beans.Introspector.getBeanInfo(Introspector.java:173)
	at org.yaml.snakeyaml.introspector.PropertyUtils.getPropertiesMap(PropertyUtils.java:81)
	at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:149)
	at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:145)
	at org.yaml.snakeyaml.TypeDescription.discoverProperty(TypeDescription.java:166)
	at org.yaml.snakeyaml.TypeDescription.getProperty(TypeDescription.java:177)
	at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:224)
	at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:169)
	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:320)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:201)
	at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:185)
	at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:493)
	at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:459)
	at org.apache.shardingsphere.infra.util.yaml.YamlEngine.unmarshal(YamlEngine.java:56)
	at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:56)
	... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.shardingsphere.globalclock.core.yaml.config.YamlGlobalClockRuleConfiguration
	at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 34 more
java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
	at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
	at ShardingJdbc.getDataSource(ShardingJdbc.java:59)
	at ShardingJdbc.getConnection(ShardingJdbc.java:73)
	at jTPCCUtil.getConfig(jTPCCUtil.java:76)
	at jTPCC.<init>(jTPCC.java:347)
	at jTPCC.main(jTPCC.java:68)
17:19:44,942 [main] ERROR  jTPCC : Term-00, null
Term-00, Running Average tpmTOTAL: 0.00    Current tpmTOTAL: 0    Memory Usage: 2458MB / 30208MB

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

wsm12138 avatar May 06 '24 09:05 wsm12138

[root@localhost run]# ./runBenchmark.sh.source props.jdbc.1pcs^C
[root@localhost run]# cat props.jdbc.1pcs
db=postgres
driver=com.mysql.jdbc.Driver
//conn=jdbc:mysql://192.168.10.25:3333/sharding_db?useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&prepStmtCacheSize=8192&prepStmtCacheSqlLimit=8000
conn=sharding:opengauss://localhost:5432/test?loggerLevel=OFF
config=/opt/jenkins/benchmarksql/run/config-tpcc.yaml
user=root
password=root

warehouses=200
loadWorkers=100

terminals=200
//To run specified transactions per terminal- runMins must equal zero
runTxnsPerTerminal=0
//To run for specified minutes- runTxnsPerTerminal must equal zero
runMins=3
//Number of total transactions per minute
limitTxnsPerMin=0

//Set to true to run in 4.x compatible mode. Set to false to use the
//entire configured database evenly.
terminalWarehouseFixed=true

//The following five values must add up to 100
//The default percentages of 45, 43, 4, 4 & 4 match the TPC-C spec
newOrderWeight=45
paymentWeight=43
orderStatusWeight=4
deliveryWeight=4
stockLevelWeight=4

// Directory name to create for collecting detailed result data.
// Comment this out to suppress.
resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS
//osCollectorScript=./misc/os_collector_linux.py
//osCollectorInterval=1
//osCollectorSSHAddr=user@dbhost
//osCollectorDevices=net_eth0 blk_sda
shardingNumber=1


[root@localhost run]# cat /opt/jenkins/benchmarksql/run/config-tpcc.yaml

databaseName: sharding_db
dataSources:

  ds_0:
    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
    driverClassName: com.mysql.jdbc.Driver
    jdbcUrl: jdbc:mysql://192.168.10.20:13306/test?useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&prepStmtCacheSize=8192&prepStmtCacheSqlLimit=8000
    username: test
    password: sphereEx@2021
    connectionTimeout: 3600000
    idleTimeoutMilliseconds: 60000
    maxLifetime: 70000
    maximumPoolSize: 500
    minimumIdle: 500

rules:
- !SINGLE
  tables:
    - "*.*"
- !SHARDING
  bindingTables:
    - bmsql_warehouse, bmsql_customer
    - bmsql_stock, bmsql_district, bmsql_order_line
  defaultDatabaseStrategy:
    none:
  defaultTableStrategy:
    none:
  keyGenerators:
    snowflake:
      type: SNOWFLAKE
  autoTables:
    bmsql_warehouse:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: w_id
          shardingAlgorithmName: mod_1

    bmsql_district:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: d_w_id
          shardingAlgorithmName: mod_1

    bmsql_customer:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: c_w_id
          shardingAlgorithmName: mod_1

    bmsql_item:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: i_id
          shardingAlgorithmName: mod_1

    bmsql_history:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: h_w_id
          shardingAlgorithmName: mod_1

    bmsql_oorder:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: o_w_id
          shardingAlgorithmName: mod_1

    bmsql_stock:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: s_w_id
          shardingAlgorithmName: mod_1

    bmsql_new_order:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: no_w_id
          shardingAlgorithmName: mod_1

    bmsql_order_line:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: ol_w_id
          shardingAlgorithmName: mod_1

  shardingAlgorithms:
    mod_1:
      type: MOD
      props:
        sharding-count: 1
mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: 20240506_BenchmarkSQL_tt
      server-lists: 192.168.10.23:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500

wsm12138 avatar May 06 '24 09:05 wsm12138

@wsm12138 Hi,By the exception Caused by: java.lang.NoClassDefFoundError: org/apache/shardingsphere/globalclock/core/yaml/config/YamlGlobalClockRuleConfiguration.

The classpath is now org.apache.shardingsphere.globalclock.yaml.config.YamlGlobalClockRuleConfiguration, not core/yaml/config/YamlGlobalClockRuleConfiguration. Please use the latest jar package.

FlyingZC avatar May 07 '24 03:05 FlyingZC