jmeter beanshell 对象序列化报错

1.在jmeter中编写beanshell代码,创建消息对象,再对对象序列化,运行报错:
Response message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import com . . . '' : Typed variable declaration : Method Invocation msg.serialize
2.//序列化
byte[] buff = msg.serialize();
3.beanshell截图
图片说明

加入try catch,发现有个类找不到,导入jar包后正常
1.try{
buff = msg.serialize();
log.info("buff:"+buff);
sBuff = buff.toString();
log.info("sBuff:"+sBuff);
vars.put("preMsg",sBuff);
log.info("preMsg:"+preMsg);
}catch(Throwable ex){
log.error("Beanshell failure: ", ex);;
}
2.import io.netty.util.internal.StringUtil;

让你的实体类 implements Serializable