最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL despite adding

programmeradmin1浏览0评论

I've been trying to run some load testing scripts through JMeter, but I keep running into this error:

 Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL ; java.sql.SQLException: No suitable driver
        at org.apachemons.dbcp2.DriverFactory.createDriver(DriverFactory.java:68)
        at org.apachemons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:459)
        at org.apachemons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:525)
        at org.apachemons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:731)
        at org.apache.jmeter.protocol.jdbc.config.DataSourceElement$DataSourceComponentImpl.getConnection(DataSourceElement.java:362)
        at org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection(DataSourceElement.java:199)
        at org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.sample(JDBCSampler.java:81)
        at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651) 

The installed Java version is Java 22, which is why I put mssql-jdbc-12.8.0.jre11 jar file into jmeter\lib. I even added the jdbc driver jar to classpath. Here's jmeter.log:

2025-02-07 13:29:35,739 INFO o.a.j.u.JMeterUtils: Setting Locale to en_EN
2025-02-07 13:29:35,766 INFO o.a.j.JMeter: Loading user properties from: user.properties
2025-02-07 13:29:35,767 INFO o.a.j.JMeter: Loading system properties from: system.properties
2025-02-07 13:29:35,774 INFO o.a.j.JMeter: Copyright (c) 1998-2024 The Apache Software Foundation
2025-02-07 13:29:35,774 INFO o.a.j.JMeter: Version 5.6.3
2025-02-07 13:29:35,774 INFO o.a.j.JMeter: java.version=22.0.2
2025-02-07 13:29:35,774 INFO o.a.j.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM
2025-02-07 13:29:35,774 INFO o.a.j.JMeter: os.name=Windows Server 2022
2025-02-07 13:29:35,775 INFO o.a.j.JMeter: os.arch=amd64
2025-02-07 13:29:35,775 INFO o.a.j.JMeter: os.version=10.0
2025-02-07 13:29:35,775 INFO o.a.j.JMeter: file.encoding=UTF-8
2025-02-07 13:29:35,775 INFO o.a.j.JMeter: java.awt.headless=null
2025-02-07 13:29:35,775 INFO o.a.j.JMeter: Max memory     =8589934592
2025-02-07 13:29:35,775 INFO o.a.j.JMeter: Available Processors =16
2025-02-07 13:29:35,786 INFO o.a.j.JMeter: Default Locale=English (EN)
2025-02-07 13:29:35,786 INFO o.a.j.JMeter: JMeter  Locale=English (EN)
2025-02-07 13:29:35,786 INFO o.a.j.JMeter: JMeterHome=<redacted>\jmeter
2025-02-07 13:29:35,786 INFO o.a.j.JMeter: user.dir  =<redacted>\jmeter\bin
2025-02-07 13:29:35,787 INFO o.a.j.JMeter: PWD       =<redacted>\jmeter\bin
2025-02-07 13:29:35,791 INFO o.a.j.JMeter: IP: <redacted> Name: <redacted> FullName:<redacted>
2025-02-07 13:29:35,791 INFO o.a.j.JMeter: user.classpath=<redacted>/jmeter/lib/mssql-jdbc-12.8.0.jre11.jar
2025-02-07 13:29:35,791 INFO o.a.j.JMeter: Adding to classpath and loader: <redacted>/jmeter/lib/mssql-jdbc-12.8.0.jre11.jar

I tried changing the jdbc driver jar version to 7.1 and then to 8.4. Neither one seemed to work. I also added the classpath to jmeter.properties and user.properties but that did not help either. I am at my wit's end.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论