m.a.loading is not a function报错问题解决

项目采用Vue3与Vant4开发,在服务器部署后因Vant版本升级导致前端报错。新版本中组件调用方式变更,如Toast、Dialog等不再兼容旧版本,需锁定版本或调整调用方式。

项目使用vue3和vant4。

今年6月份开发的项目,当时用的是vant最新版本4.0.0-alpha.4。

后来项目上线了,我们在服务器上面进行打包项目,部署到服务器后发现前端报错:

 本地打包的文件都没问题;

经过一系列的问题排查,最后发现是服务器上面没有控制在vant版本(暂时不知道为什么在服务器上面版本锁定不了),服务器上面package-lock.json文件中的vant版本为v4.0.0-rc.0(目前vant的最新版)。

新版的vant修改了toast的调用方式

之前alpha版本是:

Toast('提示内容');

所以导致页面报错。

相关的修改还有Dialog,Notify等组件的调用方式;

(Vant好坑人,版本升级了,组件调用方式不兼容!!)

找到问题了就好解决:

办法一:

控制好vant版本;

办法二:

修改vant组件的调用方式,改为官网最新的。

2025-09-25 13:11:15,568 INFO o.j.r.JARSourceHTTP: Found cached repo 2025-09-25 13:11:15,813 INFO o.j.r.PluginManager: Plugins Status: [jpgc-graphs-basic=2.0, jpgc-casutg=3.1.1, jpgc-filterresults=2.2, jpgc-httpraw=0.1, jpgc-perfmon=2.1, jpgc-plugins-manager=1.10, bzm-random-csv=0.8, jmeter-core=5.6.2, jmeter-ftp=5.6.2, jmeter-http=5.6.2, jmeter-jdbc=5.6.2, jmeter-jms=5.6.2, jmeter-junit=5.6.2, jmeter-java=5.6.2, jmeter-ldap=5.6.2, jmeter-mail=5.6.2, jmeter-mongodb=5.6.2, jmeter-native=5.6.2, jmeter-tcp=5.6.2, jmeter-components=5.6.2] 2025-09-25 13:11:15,814 INFO o.j.r.PluginManagerMenuItem: Plugins Manager has upgrades: [jpgc-plugins-manager] 2025-09-25 13:11:20,691 INFO o.a.j.s.FileServer: Default base='D:\验收\apache-jmeter-5.6.2\bin' 2025-09-25 13:11:20,694 INFO o.a.j.g.a.Load: Loading file: D:\验收\测试执行\项目材料\2025\9月\应急救援\2025应急指挥系统性能测试脚本汇总.jmx 2025-09-25 13:11:20,694 INFO o.a.j.s.FileServer: Set new base='D:\验收\测试执行\项目材料\2025\9月\应急救援' 2025-09-25 13:11:20,777 INFO o.a.j.s.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2 2025-09-25 13:11:20,784 INFO o.a.j.s.SaveService: Using SaveService properties file encoding UTF-8 2025-09-25 13:11:20,785 INFO o.a.j.s.SaveService: Using SaveService properties version 5.0 2025-09-25 13:11:20,787 INFO o.a.j.s.SaveService: Loading file: D:\验收\测试执行\项目材料\2025\9月\应急救援\2025应急指挥系统性能测试脚本汇总.jmx 2025-09-25 13:11:20,913 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/html is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser 2025-09-25 13:11:20,913 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xhtml+xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser 2025-09-25 13:11:20,913 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser 2025-09-25 13:11:20,913 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser 2025-09-25 13:11:20,913 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser 2025-09-25 13:11:20,913 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/css is org.apache.jmeter.protocol.http.parser.CssParser 2025-09-25 13:11:21,318 INFO o.a.j.s.SampleResult: Note: Sample TimeStamps are START times 2025-09-25 13:11:21,318 INFO o.a.j.s.SampleResult: sampleresult.default.encoding is set to UTF-8 2025-09-25 13:11:21,318 INFO o.a.j.s.SampleResult: sampleresult.useNanoTime=true 2025-09-25 13:11:21,318 INFO o.a.j.s.SampleResult: sampleresult.nanoThreadSleep=5000 2025-09-25 13:11:21,480 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\common-login.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,492 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-perfmon-2.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,493 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-httpraw-0.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,493 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-graphs-basic-2.0.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,494 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-custom-lib-1.0.0.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,494 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-filterresults-2.2.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,495 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-manager-1.11.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,497 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-manager-1.10.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,498 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-random-csv-data-set-0.8.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,500 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\CMAEnDeUtil-1.0-SNAPSHOT.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,500 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-casutg-3.1.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.ResultRenderer], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,519 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\common-login.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,535 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-perfmon-2.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,536 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-httpraw-0.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,536 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-graphs-basic-2.0.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,537 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-custom-lib-1.0.0.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,537 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-filterresults-2.2.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,538 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-manager-1.11.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,540 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-manager-1.10.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,541 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-random-csv-data-set-0.8.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,543 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\CMAEnDeUtil-1.0-SNAPSHOT.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,543 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-casutg-3.1.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.visualizers.RequestView], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:21,625 INFO o.a.j.s.FileServer: Set new base='D:\验收\测试执行\项目材料\2025\9月\应急救援' 2025-09-25 13:11:32,869 INFO o.a.j.e.StandardJMeterEngine: Running the test! 2025-09-25 13:11:32,870 INFO o.a.j.s.SampleEvent: List of sample_variables: [] 2025-09-25 13:11:32,870 INFO o.a.j.s.SampleEvent: List of sample_variables: [] 2025-09-25 13:11:32,871 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must contain the string: '.functions.' 2025-09-25 13:11:32,871 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must not contain the string: '.gui.' 2025-09-25 13:11:33,054 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\common-login.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,065 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-perfmon-2.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,066 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-httpraw-0.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,066 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-graphs-basic-2.0.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,067 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-custom-lib-1.0.0.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,067 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-filterresults-2.2.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,067 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-manager-1.11.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,070 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-manager-1.10.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,072 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-random-csv-data-set-0.8.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,073 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\CMAEnDeUtil-1.0-SNAPSHOT.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,074 INFO o.a.j.r.ClassFinder: Will scan jar D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-plugins-casutg-3.1.1.jar with filter ExtendsClassFilter [parents=[interface org.apache.jmeter.functions.Function], inner=false, contains=null, notContains=null]. Consider exposing JMeter plugins via META-INF/services, and add JMeter-Skip-Class-Scanning=true manifest attribute so JMeter can skip classfile scanning 2025-09-25 13:11:33,079 INFO o.a.j.t.TestPlan: added D:\验收\apache-jmeter-5.6.2\lib\ext\jmeter-custom-lib-1.0.0.jar to classpath 2025-09-25 13:11:33,082 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*) 2025-09-25 13:11:33,083 INFO o.a.j.e.StandardJMeterEngine: Starting setUp thread groups 2025-09-25 13:11:33,083 INFO o.a.j.e.StandardJMeterEngine: Starting setUp ThreadGroup: 1 : setUp Thread Group 2025-09-25 13:11:33,083 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group setUp Thread Group. 2025-09-25 13:11:33,083 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error 2025-09-25 13:11:33,083 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false 2025-09-25 13:11:33,094 INFO o.a.j.t.ThreadGroup: Started thread group number 1 2025-09-25 13:11:33,095 INFO o.a.j.e.StandardJMeterEngine: Waiting for all setup thread groups to exit 2025-09-25 13:11:33,099 INFO o.a.j.t.JMeterThread: Thread started: setUp Thread Group 1-1 2025-09-25 13:11:33,100 INFO o.a.j.s.FileServer: Stored: D:/验收/测试执行/项目材料/2025/9月/应急救援/csv/custmer.csv 2025-09-25 13:11:33,126 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import com.ye.Sm2Util; import org.apache.commons.codec.digest.DigestUtils; impor . . . '' : Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest 2025-09-25 13:11:33,127 WARN o.a.j.m.BeanShellPreProcessor: Problem in BeanShell script. org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import com.ye.Sm2Util; import org.apache.commons.codec.digest.DigestUtils; impor . . . '' : Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest 2025-09-25 13:11:33,133 INFO o.a.j.p.h.s.HTTPHCAbstractImpl: Local host = LAPTOP-5AL5IVVO 2025-09-25 13:11:33,136 INFO o.a.j.p.h.s.HTTPHC4Impl: HTTP request retry count = 0 2025-09-25 13:11:33,291 INFO o.a.j.p.h.s.h.LazyLayeredConnectionSocketFactory: Setting up HTTPS TrustAll Socket Factory 2025-09-25 13:11:33,292 INFO o.a.j.u.JsseSSLManager: Using default SSL protocol: TLS 2025-09-25 13:11:33,292 INFO o.a.j.u.JsseSSLManager: SSL session context: per-thread 2025-09-25 13:11:33,300 INFO o.a.j.u.SSLManager: JmeterKeyStore Location: type JKS 2025-09-25 13:11:33,301 INFO o.a.j.u.SSLManager: KeyStore created OK 2025-09-25 13:11:33,301 WARN o.a.j.u.SSLManager: Keystore file not found, loading empty keystore 2025-09-25 13:11:33,426 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import com.ye.Sm2Util; import org.apache.commons.codec.digest.DigestUtils; impor . . . '' : Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest 2025-09-25 13:11:33,426 WARN o.a.j.m.BeanShellPreProcessor: Problem in BeanShell script. org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import com.ye.Sm2Util; import org.apache.commons.codec.digest.DigestUtils; impor . . . '' : Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest 2025-09-25 13:11:33,526 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import com.ye.Sm2Util; import org.apache.commons.codec.digest.DigestUtils; impor . . . '' : Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest 2025-09-25 13:11:33,526 WARN o.a.j.m.BeanShellPreProcessor: Problem in BeanShell script. org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import com.ye.Sm2Util; import org.apache.commons.codec.digest.DigestUtils; impor . . . '' : Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest 2025-09-25 13:11:33,700 INFO o.a.j.t.JMeterThread: Thread is done: setUp Thread Group 1-1 2025-09-25 13:11:33,700 INFO o.a.j.t.JMeterThread: Thread finished: setUp Thread Group 1-1 2025-09-25 13:11:33,701 INFO o.a.j.e.StandardJMeterEngine: All Setup Threads have ended 2025-09-25 13:11:33,808 INFO o.a.j.e.StandardJMeterEngine: No enabled thread groups found 2025-09-25 13:11:33,808 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test 2025-09-25 13:11:33,808 INFO o.a.j.s.FileServer: Close: D:/验收/测试执行/项目材料/2025/9月/应急救援/csv/custmer.csv 2025-09-25 13:11:33,814 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
最新发布
09-26
<think> 我们有两个问题需要解决: 1. BeanShell脚本错误:Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest 2. 测试执行日志中提示:No enabled thread groups found 我们先解决第一个问题:BeanShell脚本错误。 根据引用[1]中提到的类似错误(DigestUtils未定义),我们可以推断该错误通常有两个原因: - 脚本中未正确导入LoginRequest类(即缺少import语句) - 包含LoginRequest类的jar包未添加到JMeter的类路径中 解决步骤: 步骤1:在BeanShell脚本开头添加正确的导入语句 - 假设LoginRequest类的完整路径是com.example.LoginRequest,则在脚本开头添加: import com.example.LoginRequest; - 注意:如果prepareLoginData()是LoginRequest类的静态方法,则调用方式为:LoginRequest.prepareLoginData() 如果是实例方法,则需要先创建对象:LoginRequest request = new LoginRequest(); request.prepareLoginData(); 步骤2:将包含LoginRequest类的jar包添加到JMeter - 将jar包拷贝到JMeter安装目录下的lib/ext目录(例如:apache-jmeter-5.6.2/lib/ext),然后重启JMeter。 - 或者,在JMeter测试计划中直接添加jar包:右键点击测试计划 -> Add directory or jar to classpath -> 选择jar包 -> 重启JMeter。 步骤3:检查jar包依赖 - 确保LoginRequest类所依赖的其他jar包也已经添加到JMeter的类路径中。 步骤4:验证类是否加载成功 - 可以在BeanShell脚本中加入调试语句,例如: log.info("Class found: " + LoginRequest.class); 如果日志中打印出了类信息,则说明导入成功。 现在解决第二个问题:No enabled thread groups found 这个错误表示JMeter没有找到启用的线程组。可能的原因: - 测试计划中没有线程组(Thread Group)被启用(即线程组前面的复选框没有勾选) - 线程组被禁用(例如,通过“禁用”选项或者使用“仅主线程”模式运行) 解决步骤: 步骤1:打开JMeter测试计划,检查线程组 - 确保至少有一个线程组存在,并且该线程组前面的复选框是勾选状态(启用状态)。 步骤2:检查线程组的执行顺序 - 确保线程组不是在“setUp Thread Group”或“tearDown Thread Group”中,而是普通的“Thread Group”。因为日志中显示setUp线程组执行完后,没有找到启用的线程组。 步骤3:检查测试计划是否保存了线程组 - 如果测试计划中没有线程组,需要添加一个线程组(右键测试计划 -> 添加 -> 线程(用户) -> 线程组)并启用它。 步骤4:检查测试计划的执行模式 - 如果使用命令行模式运行,确认命令行参数中指定的测试计划(jmx文件)包含启用的线程组。 根据日志分析: 日志中显示: 2025-09-25 13:07:25,823 INFO o.a.j.e.StandardJMeterEngine: No enabled thread groups found 这说明在setUp线程组执行完成后,JMeter没有找到任何启用的线程组(普通线程组)。 因此,请检查测试计划中是否有一个或多个线程组(Thread Group)被启用。 总结解决方案: 1. 修复BeanShell脚本:添加导入语句,并确保相关jar包在类路径中。 2. 确保测试计划中至少有一个启用的普通线程组(Thread Group)。 如果按照以上步骤操作,问题应该可以解决。 生成相关问题: §§相关问题§§ 1. JMeter如何导入自定义jar包并使其在BeanShell脚本中生效? 2. JMeter测试计划中线程组的作用及常见配置有哪些? 3. 如何调试JMeter中的BeanShell脚本错误? </think> ### 解决JMeter BeanShell脚本报错及线程组未启用问题 以下是针对两个问题的完整解决方案: #### 问题1:BeanShell脚本报错 "Attempt to resolve method: prepareLoginData() on undefined variable or class name: LoginRequest" 此错误表明JMeter无法识别`LoginRequest`类或其方法,通常由类未导入或jar包缺失导致。 **解决步骤**: 1. **添加导入语句** 在BeanShell脚本开头添加正确的类导入(替换为实际包路径): ```java // 添加必要的导入语句 import com.ye.Sm2Util; import org.apache.commons.codec.digest.DigestUtils; // 关键:导入LoginRequest类 import com.yourpackage.LoginRequest; // ← 替换为实际包路径 ``` 2. **检查方法调用方式** - 静态方法调用:`LoginRequest.prepareLoginData()` - 实例方法调用: ```java LoginRequest request = new LoginRequest(); request.prepareLoginData(); ``` 3. **添加依赖jar包到JMeter** - 将包含`LoginRequest`类的jar包复制到JMeter的`lib/ext`目录(如`apache-jmeter-5.6.2/lib/ext`) - 重启JMeter(必须步骤) 4. **验证类加载** 在脚本中添加调试代码: ```java // 验证类是否加载成功 try { Class.forName("com.yourpackage.LoginRequest"); log.info("LoginRequest class loaded successfully"); } catch (ClassNotFoundException e) { log.error("LoginRequest class not found: " + e.getMessage()); } ``` 5. **检查依赖传递** 如果`LoginRequest`依赖其他jar包(如fastjson),需一并添加到`lib/ext`目录[^1]。 #### 问题2:日志报错 "No enabled thread groups found" 此错误表示JMeter未找到启用的线程组(Thread Group)。 **解决步骤**: 1. **启用线程组** - 打开JMeter测试计划 - 右键点击线程组 → 勾选 "启用"(确保复选框被选中) ![启用线程组](https://jmeter.apache.org/images/screenshots/enable_thread_group.png) 2. **检查线程组类型** - 普通线程组应使用 **Thread Group**(非setUp/tearDown) - 在测试计划中至少保留一个启用的Thread Group 3. **验证线程组配置** ```mermaid graph TD A[测试计划] --> B[Thread Group] B --> C[启用?] C -->|是| D[线程数 > 0] D -->|是| E[正确配置采样器] ``` 4. **检查测试计划结构** - 确保线程组不在"禁用"的控制器内 - 通过"运行"菜单 → "启用所有组件" 全局启用 #### 完整调试流程 1. 将jar包放入`lib/ext`目录 2. 在BeanShell脚本开头添加导入语句 3. 启用至少一个Thread Group 4. 添加调试日志: ```java log.info("Classpath: " + System.getProperty("java.class.path")); ``` 5. 重启JMeter并运行测试 > **关键提示**:JMeter对类加载敏感,任何jar包或脚本修改后必须重启才能生效。通过上述步骤,90%以上的同类错误可被解决[^1][^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值