gpt4 book ai didi

jmeter-我需要做些什么来连接 mysql 数据库?

转载 作者:行者123 更新时间:2023-12-01 13:47:56 25 4
gpt4 key购买 nike

在我的 JMeter 测试计划中,我创建了一个线程组并添加了带有 JDBC 连接配置的配置元素:

Url: jdbc:mysql://localhost:3306/atmdb,
Driver class: com.mysql.jdbc.Driver
username: ****
password: ****

我还添加了 jdbc 请求采样器和一个 View 结果树监听器。然而在执行这个测试计划后,我看到了这个错误:

2015/12/18 12:53:39 INFO - jmeter.engine.StandardJMeterEngine: Running the test! 
2015/12/18 12:53:39 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2015/12/18 12:53:39 WARN - jmeter.protocol.jdbc.config.DataSourceElement: Could not load driver: com.mysql.jdbc.Driver java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource.configure(ResourceLimitingJdbcDataSource.java:264)
at org.apache.jmeter.protocol.jdbc.config.DataSourceElement.initPool(DataSourceElement.java:235)
at org.apache.jmeter.protocol.jdbc.config.DataSourceElement.testStarted(DataSourceElement.java:108)
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:214)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:336)
at java.lang.Thread.run(Thread.java:745)
2015/12/18 12:53:39 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,local)
2015/12/18 12:53:39 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : JDBC Users
2015/12/18 12:53:39 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group JDBC Users.
2015/12/18 12:53:39 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error
2015/12/18 12:53:39 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false
2015/12/18 12:53:39 INFO - jmeter.threads.ThreadGroup: Started thread group number 1
2015/12/18 12:53:39 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started
2015/12/18 12:53:39 INFO - jmeter.threads.JMeterThread: Thread started: JDBC Users 1-1
2015/12/18 12:53:39 WARN - jmeter.protocol.jdbc.config.DataSourceElement: Could not return Connection java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/atmdb at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at org.apache.avalon.excalibur.datasource.JdbcConnectionFactory.newInstance(JdbcConnectionFactory.java:182)
at org.apache.avalon.excalibur.pool.InstrumentedResourceLimitingPool.newPoolable(InstrumentedResourceLimitingPool.java:655)
at org.apache.avalon.excalibur.pool.ValidatedResourceLimitingPool.newPoolable(ValidatedResourceLimitingPool.java:145)
at org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcConnectionPool.newPoolable(ResourceLimitingJdbcConnectionPool.java:91)
at org.apache.avalon.excalibur.pool.InstrumentedResourceLimitingPool.get(InstrumentedResourceLimitingPool.java:371)
at org.apache.avalon.excalibur.pool.ValidatedResourceLimitingPool.get(ValidatedResourceLimitingPool.java:97)
at org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource.getConnection(ResourceLimitingJdbcDataSource.java:188)
at org.apache.jmeter.protocol.jdbc.config.DataSourceElement$DataSourceComponentImpl.getConnection(DataSourceElement.java:286)
at org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection(DataSourceElement.java:146)
at org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.sample(JDBCSampler.java:85)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
at java.lang.Thread.run(Thread.java:745)
2015/12/18 12:53:39 INFO - jmeter.threads.JMeterThread: Thread is done: JDBC Users 1-1
2015/12/18 12:53:39 INFO - jmeter.threads.JMeterThread: Thread finished: JDBC Users 1-1
2015/12/18 12:53:39 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test
2015/12/18 12:53:39 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,local)

有人可以帮我解决这个问题吗?

最佳答案

请按照以下两个步骤解决问题。它解决了我的问题

  1. 将 mysql 连接器 jar 放在 apache-jmeter-3.0\lib 文件夹中
  2. 重启jmeter

只有在重新启动后,它才会选择新放置的 jar 文件。

关于jmeter-我需要做些什么来连接 mysql 数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34350439/

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