zoukankan      html  css  js  c++  java
  • Ajax 报错 500 (Internal Server Error)

    ==========error======={"readyState":4,"responseText":"<html><head><title>Apache Tomcat/6.0.35 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Object is null (through reference chain: java.util.HashMap[&quot;data&quot;]-&gt;java.util.ArrayList[0]-&gt;net.sf.json.JSONObject[&quot;applyExcuse&quot;]-&gt;net.sf.json.JSONNull[&quot;empty&quot;]); nested exception is org.codehaus.jackson.map.JsonMappingException: Object is null (through reference chain: java.util.HashMap[&quot;data&quot;]-&gt;java.util.ArrayList[0]-&gt;net.sf.json.JSONObject[&quot;applyExcuse&quot;]-&gt;net.sf.json.JSONNull[&quot;empty&quot;])
    	org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.writeInternal(MappingJacksonHttpMessageConverter.java:194)
    	org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:179)
    	org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:148)
    	org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(……

    网上各种解释说明,然并卵。

    最后发现报错中有 “org.codehaus.jackson.map.JsonMappingException: Object is null ”   意思是map值中有null。

    传回前端时,null值没法转换成JSON。

    ajax定义数据传输为json。

    解决方案:

    1、自己循环或者找工具类处理null为“”。

    2、传回前端String。前端转换为JSON。 

  • 相关阅读:
    STM32F407 窗口看门狗 个人笔记
    Hadoop技巧系列索引
    从零自学Hadoop系列索引
    从零自学Hadoop(25):Impala相关操作下
    从零自学Hadoop(24):Impala相关操作上
    从零自学Hadoop(23):Impala介绍及安装
    Hadoop技巧(04):简易处理solr date 时区问题
    从零自学Hadoop(22):HBase协处理器
    从零自学Hadoop(21):HBase数据模型相关操作下
    从零自学Hadoop(20):HBase数据模型相关操作上
  • 原文地址:https://www.cnblogs.com/yeyuchangfeng/p/6857628.html
Copyright © 2011-2022 走看看