具体报错:

2020-06-30 16:59:04,466 ERROR o.a.j.t.JMeterThread: Error while processing sampler: 'JDBC Request-insert'.

java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source) ~[?:1.8.0_251]
at java.lang.Long.parseLong(Unknown Source) ~[?:1.8.0_251]
at java.lang.Long.parseLong(Unknown Source) ~[?:1.8.0_251]
at org.apache.jmeter.functions.Random.execute(Random.java:64) ~[ApacheJMeter_functions.jar:5.3]
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:135) ~[ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:110) ~[ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:100) ~[ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.modifiers.UserParameters.setValues(UserParameters.java:156) ~[ApacheJMeter_components.jar:5.3]
at org.apache.jmeter.modifiers.UserParameters.process(UserParameters.java:141) ~[ApacheJMeter_components.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.runPreProcessors(JMeterThread.java:950) ~[ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:549) ~[ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.3]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.3]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]

 

解决方法:

1.查看下insert sql语句中的每个字段值是否正确,我这里是因为参数化了,但是字段参数化有问题,所以导致报错;问题如下:

 

2,查看下insert操作时,字段的类型是否正确,字段类型转换是否正确,否则也会报错,尤其注意date类型的参数化,时间戳比较容易出问题,

可参考:jmeter的时间戳函数使用

https://blog.csdn.net/jocleyn/article/details/83414433

我这里后来改为了:${__time(yyyy-MM-dd HH:mm:ss:SSS,time)}  ,错误得以解决