Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用springboot获取netsuite suitescript 2.0引发的可读异常_Java_Spring Boot_Netsuite_Suitescript2.0 - Fatal编程技术网

Java 如何使用springboot获取netsuite suitescript 2.0引发的可读异常

Java 如何使用springboot获取netsuite suitescript 2.0引发的可读异常,java,spring-boot,netsuite,suitescript2.0,Java,Spring Boot,Netsuite,Suitescript2.0,无论何时从netsuite suitescript 2.0(restlet)获取异常 能够获得如下所示的可读异常响应,而suitescript从postman处命中 400错误请求 { "error": { "code": "UNIQUE_CUST_ID_REQD", "message": "{\"type\":\"error.SuiteScriptErro

无论何时从netsuite suitescript 2.0(restlet)获取异常

能够获得如下所示的可读异常响应,而suitescript从postman处命中

400错误请求

{
  "error": {
    "code": "UNIQUE_CUST_ID_REQD",
    "message": "{\"type\":\"error.SuiteScriptError\",\"name\":\"UNIQUE_CUST_ID_REQD\",\"message\":\"A customer record with this ID already exists. You must enter a unique customer ID for each record you create. To correct this record, click <a href=javascript:history.go(-1);;>back</a> and enter a new customer ID in the Customer field. Then, click Submit.\",\"stack\":[\"createError(N/error)\",\"formatAndThrowException(/SuiteScripts/ns_script.js:633)\",\"createObject(/SuiteScripts/ns_script.js:523)\",\"saveObject(/SuiteScripts/ns_script.js:552)\",\"post(/SuiteScripts/ns_script.js:503)\",\"createError(N/error)\"],\"cause\":{\"name\":\"UNIQUE_CUST_ID_REQD\",\"message\":\"A customer record with this ID already exists. You must enter a unique customer ID for each record you create. To correct this record, click <a href=javascript:history.go(-1);;>back</a> and enter a new customer ID in the Customer field. Then, click Submit.\"},\"id\":\"\",\"notifyOff\":false,\"userFacing\":true}"
  }
}
{
“错误”:{
“代码”:“唯一客户ID要求”,
“消息”:“{”type\“:\”error.SuiteScriptError\”,“\”name\“:\”UNIQUE\u CUST\u ID\u REQD\”,“\”message\“:\”具有此ID的客户记录已存在。您必须为创建的每个记录输入唯一的客户ID。若要更正此记录,请单击并在“客户”字段中输入新的客户ID。然后单击“提交”。\”,“堆栈\:[“createError(N/error)\”,”FormatAndRowException(/SuiteScripts/ns\u script.js:633)\”、“createObject(/SuiteScripts/ns\u script.js:523)\”、“saveObject(/SuiteScripts/ns\u script.js:552)\”、“post(/SuiteScripts/ns\u script.js:503)\”、“createError(N/error)\”、“cause\”、“cause\”:{“name\:“UNIQUE\u CUST ID\u requed\”、“message\”:”具有此ID的客户记录已存在。您必须为创建的每个记录输入唯一的客户ID。若要更正此记录,请单击并在“客户”字段中输入新的客户ID。然后单击“提交”。\“},\“ID\:\”,\“notifyOff\”:false,\“userFacing\”:true}”
}
}
但当从spring boot向suitescript发出相同的请求时,得到了如下屏幕截图所示的无法读取的字符作为响应

spring引导中使用的请求头调用restlet

[
Accept:"application/json", 
Content-Type:"application/json;charset=UTF-8",
Authorization:"OAuth realm="<ORGANIZATION_ID>",
oauth_consumer_key="<CONSUMER_KEY>",
oauth_token="<TOKEN>",
oauth_signature_method="HMAC-SHA256",
oauth_timestamp="<TIMESTAMP>",
oauth_nonce="<NONCE_VALUE>",
oauth_version="1.0",
oauth_signature="<OAUTH_SIGNATURE>",
Content-Length:"779"
]
[
接受:“应用程序/json”,
内容类型:“application/json;charset=UTF-8”,
授权:“OAuth领域=”,
oauth_consumer_key=“”,
oauth_token=“”,
oauth_signature_method=“HMAC-SHA256”,
oauth_timestamp=“”,
oauth_nonce=“”,
oauth_version=“1.0”,
oauth_签名=”,
内容长度:“779”
]
为什么在从spring boot发出请求时无法获取可读的异常信息


提前感谢

我使用Spring已经有很多年了,但是Java通常是以运行时确定的默认字符集启动的。搜索对字符集的引用并确保您的是UTF8。我使用Spring已经有很多年了,但是Java通常是以运行时确定的默认字符集启动的。Search以获取对字符集的引用,并确保您的字符集是UTF8