首页 > 解决方案 > java.util.NoSuchElementException:未定义命名属性

问题描述

我有一个问题:我想读取多个 xml 文件(file1.xml、file2.xml ......),对于我在内存中读取的每个文件,然后我编辑并发送请求。阅读和编辑它的工作没有任何问题,但是当我发送请求时:

//some declarations
 .......
var payload=""
 try{
myscenario= scenario ("scenario Name")
.exec{mysession : Session =>
//open files, list all files

for (file <-listofmyfile) {

//some regex that i reuse in payload
// payload contains the change that i would like to add for each xml file

payload=(// some function and text message.... "XXX")
}
mysession
}
.exec("protocol used".requestReply.message(StringBody( session => 
 session(payload).as[String]))
.check(substring("XXX"))
 )
 }

setUp(myscenario.inject....)}

我得到这 2 个错误:

[ERROR] i.g.c.s.w.BufferedFileChannelWriter - Buffer overflow, you shouldn't be logging that much data. Truncating.
[ERROR] i.g.t.a.RequestReply - crashed on session Session

java.util.NoSuchElementException:没有定义名为“payload”的属性

标签: scalascala-collectionsgatlingscala-gatling

解决方案


推荐阅读