乐优商城后期debug

1.添加有参构造,忘记添加无参构造

  ## 错误提示
  (no Creators, like default construct, exist ): cannot deserialize from Object value (no delegate- or property-based Creator)

2.忘记注入@Autowired

    ## 错误提示
```  Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
  java.lang.NullPointerException: null

3.Map的key是Long类型,获取时,传入string

4.v-if后边的值不需要加{}

<li v-if="search.page<4" :class="{active: search.page==i}" v-for="i in 5">
  <a href="#">{{i}}</a>
</li>

5.因为买了阿里云以及新配了一个电脑,把项目的数据库,fastDFS,elasticsearch等从虚拟机迁移到阿里云上遇到的大坑

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; 
nested exception is feign.RetryableException: 
Read timed out executing GET http://item-service/spu/page?saleable=true&page=1&rows=100] with root cause

java.net.SocketTimeoutException: Read timed out

用程序把数据库的内容导入elasticsearch时,出现错误,搞到凌晨两点钟才大概有一点点接近真相。

  • 出错的一部分原因是当时写导入程序应该用测试类直接运行,但是当时测试类一直报错。就另辟蹊径直接写个controller用get请求直接调用。
    -由于当时虚拟机处于一个局域网络 网速快,程序能很快处理完成。所有没有出错。而阿里云既要查询数据库,还要存入elasticsearch并不能很快完成。由于ribbon、hystrix的设置超时时间不大于程序执行时间,所以导致报错。
ribbon:
  ConnectTimeout: 1000 # 连接超时时间(ms)1000
  ReadTimeout: 3500 # 通信超时时间(ms)3500

  MaxAutoRetriesNextServer: 0 # 同一服务不同实例的重试次数
  MaxAutoRetries: 0 # 同一实例的重试次数


hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMillisecond: 5000 # 熔断超时时长:10000ms5000

6 因为要聚合spec里的子字段,没有按照正确格式写

图片.png
错误提示,因为聚合时字段填写错误 结果为为空,后续代码调用报错
org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms cannot be cast to org.elasticsearch.search.aggregations.bucket.terms.StringTerms

queryBuilder1.addAggregation(AggregationBuilders.terms(specParam.getName()).field("specs." + specParam.getName() + ".keyword"));//正确代码
queryBuilder1.addAggregation(AggregationBuilders.terms(specParam.getName()).field(specParam.getName()));//错误代码

7 使用feign调用接口 路径没写全

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; 
nested exception is feign.FeignException:
 status 404 reading SpecificationClient#queryGroupAndParamByCid(Long); content:{"timestamp":"2020-06-09T13:48:28.857+0000",
"status":404,
"error":"Not Found",
"message":"No message available",
"path":"/groupsAndParam/76"}] with root cause
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容