gpt4 book ai didi

java - YCSB JDBS 驱动程序 : java. lang.ClassNotFoundException

转载 作者:行者123 更新时间:2023-11-29 01:49:44 24 4
gpt4 key购买 nike

在尝试将数据加载到 MySQL 时出现以下错误:

    ~/YCSB$ bin/ycsb load jdbc -P workloads/workloada -P db.properties
[WARN] Running against a source checkout. In order to get our runtime dependencies we'll have to invoke Maven. Depending on the state of your system, this may take ~30-45 seconds
[DEBUG] Running 'mvn -pl com.yahoo.ycsb:jdbc-binding -am package -DskipTests dependency:build-classpath -DincludeScope=compile -Dmdep.outputFilterFile=true'
/usr/lib/jvm/java-8-oracle/bin/java -cp /home/zakaria/YCSB/jdbc/conf:/home/zakaria/YCSB/jdbc/target/jdbc-binding-0.14.0-SNAPSHOT.jar:/home/zakaria/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/zakaria/.m2/repository/org/apache/htrace/htrace-core4/4.1.0-incubating/htrace-core4-4.1.0-incubating.jar:/home/zakaria/.m2/repository/net/sourceforge/serp/serp/1.13.1/serp-1.13.1.jar:/home/zakaria/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.4/HdrHistogram-2.1.4.jar:/home/zakaria/.m2/repository/org/apache/openjpa/openjpa-jdbc/2.1.1/openjpa-jdbc-2.1.1.jar:/home/zakaria/.m2/repository/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar:/home/zakaria/.m2/repository/org/apache/openjpa/openjpa-kernel/2.1.1/openjpa-kernel-2.1.1.jar:/home/zakaria/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.4/jackson-core-asl-1.9.4.jar:/home/zakaria/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/zakaria/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/home/zakaria/YCSB/core/target/core-0.14.0-SNAPSHOT.jar:/home/zakaria/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.4/jackson-mapper-asl-1.9.4.jar:/home/zakaria/.m2/repository/org/apache/openjpa/openjpa-lib/2.1.1/openjpa-lib-2.1.1.jar:/home/zakaria/.m2/repository/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar com.yahoo.ycsb.Client -db com.yahoo.ycsb.db.JdbcDBClient -P workloads/workloada -P db.properties -load
Command line: -db com.yahoo.ycsb.db.JdbcDBClient -P workloads/workloada -P db.properties -loadYCSB Client 0.14.0-SNAPSHOT

Loading workload...
Starting test.
Error in initializing the JDBS driver: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver # The JDBC driver class to use.
com.yahoo.ycsb.DBException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver # The JDBC driver class to use.
at com.yahoo.ycsb.db.JdbcDBClient.init(JdbcDBClient.java:220)
at com.yahoo.ycsb.DBWrapper.init(DBWrapper.java:86)
at com.yahoo.ycsb.ClientThread.run(Client.java:423)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver # The JDBC driver class to use.
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.yahoo.ycsb.db.JdbcDBClient.init(JdbcDBClient.java:194)
... 3 more
com.yahoo.ycsb.DBException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver # The JDBC driver class to use.
at com.yahoo.ycsb.db.JdbcDBClient.init(JdbcDBClient.java:220)
at com.yahoo.ycsb.DBWrapper.init(DBWrapper.java:86)
at com.yahoo.ycsb.ClientThread.run(Client.java:423)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver # The JDBC driver class to use.
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.yahoo.ycsb.db.JdbcDBClient.init(JdbcDBClient.java:194)
... 3 more
[OVERALL], RunTime(ms), 5
[OVERALL], Throughput(ops/sec), 0.0
[TOTAL_GCS_PS_Scavenge], Count, 0
[TOTAL_GC_TIME_PS_Scavenge], Time(ms), 0
[TOTAL_GC_TIME_%PS_Scavenge], Time(%), 0.0
[TOTAL_GCS_PS_MarkSweep], Count, 0
[TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0
[TOTAL_GC_TIME%PS_MarkSweep], Time(%), 0.0
[TOTAL_GCs], Count, 0
[TOTAL_GC_TIME], Time(ms), 0
[TOTAL_GC_TIME%], Time(%), 0.0

我已将我的 db.properties(在 ~/YCSB 文件夹中)设置如下:

db.driver=com.mysql.jdbc.Driver # The JDBC driver class to use.
db.url=jdbc:mysql://master:3306/ycsb # The Database connection URL.
db.user=root # User name for the connection.
db.passwd=

我已经在“~/YCSB/jdbc”中创建了 lib 文件夹,并将“mysql-connector-java-5.1.46-bin.jar”放在那里。

最佳答案

您认为是评论,其实不是。在属性文件中,# 仅当它是一行中的第一个非空白字符时才表示注释。

来自 Properties.load(Reader) :

A comment line has an ASCII '#' or '!' as its first non-white space character;

错误消息包含该注释的事实证明了这一点:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver # The JDBC driver class to use.

换句话说,改变

db.driver=com.mysql.jdbc.Driver # The JDBC driver class to use.
db.url=jdbc:mysql://master:3306/ycsb # The Database connection URL.
db.user=root # User name for the connection.
db.passwd=

# The JDBC driver class to use.
db.driver=com.mysql.jdbc.Driver
# The Database connection URL.
db.url=jdbc:mysql://master:3306/ycsb
# User name for the connection.
db.user=root
db.passwd=

或者完全删除评论

关于java - YCSB JDBS 驱动程序 : java. lang.ClassNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49460240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com