• 经验总结之 _DEBUGGER _01 _Invalid coercion null-node{} as xsstring _20210909


    经验总结之 _DEBUGGER _01 _Invalid coercion null-node{} as xsstring _20210909

    今天喜提一个bug,报错情况如下:

    该项目使用的是 springboot + markLogic + thymeleaf + bootstrap 的技术栈

    Servlet.service() for servlet [dispatcherServlet] in context with path [/XXX-web] threw exception [Request processing failed; nested exception is com.marklogic.client.FailedRequestException: Local message: failed to apply resource at eval: Bad Request. Server Message: XDMP-AS: (err:XPTY0004) search-pattern-type:execute($XxxxxType) -- Invalid coercion: null-node{} as xs:string] with root cause
    
    com.marklogic.client.FailedRequestException: Local message: failed to apply resource at eval: Bad Request. Server Message: XDMP-AS: (err:XPTY0004) search-pattern-type:execute($XxxxxType) -- Invalid coercion: null-node{} as xs:string
    

    一开始没找出原因,四处问人,说是可能是访问MarkLogic数据库的时候参数没有传对。

    四处debugger ,最后找到是一个 return 语句报错,但是这个mapping方法不就是 实现获取页面数据的获取然后 返回到指定页面吗?这就很奇怪。

    所以就怀疑是在页面上对 XxxxxType 这个值进行操作的时候 发生了 报错。

    我灵机一动把页面的body都注释掉然后进行访问,果然没有报错。

    最后,实在是没办法找不出来,只能吧没有出错的版本拉下来进行对比,结果也没发现有什么差异。

    最后的最后,罪魁祸首找到了,是我前几天 引入的 一个 js 文件,本来是打算 使用其中的一些函数的,但是最后也没用上,就遗留再来,结果后面对页面进行修改时,去除了一个id还是class,导致 jQuery 无法获取变量。才发生时了以上错误。就这就花了整整一上午的时间,真是心塞。谨以此文作为纪念,以后一定要杜绝此类情况发生!

  • 相关阅读:
    Xpath提取一个标签里的所有文本
    Mac Sublime Text 3
    激活pycharm
    Mac 终端命令大全
    操作dict时避免出现KeyError的几种方法
    JQ 选择器大全
    调用百度编辑器
    模拟 Ajax 上传
    图片上传
    PHP 字符串去掉空格
  • 原文地址:https://www.cnblogs.com/OwlInTheOaktree/p/15246965.html
Copyright © 2020-2023  润新知