报错问题

261 阅读1分钟

springmvc框架中传递JSON对象报错

报错警告:[http-nio-8080-exec-4] org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver.handleHttpMessageNotReadable Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character ('u' (code 117)): was expecting double-quote to start field name; 
nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('u' (code 117)): was expecting double-quote to start field name at [Source: (PushbackInputStream); line: 1, column: 3]
报错原因:传递的json格式有问题,key值没有添加引号""
解决方法:key值添加引号,严格遵循json格式写代码

springmvc在使用jersey发送图片到另一台tocmat服务器的时候,报错com.sun.jersey.api.client.UniformInterfaceException:returned a response status of 403

报错警告:jerseycom.sun.jersey.api.client.UniformInterfaceException
报错原因:tomcat默认禁止上传
解决方法:在tomcat配置文件web.xml配置一下
<servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>readonly</param-name>
          <param-value>false</param-value>
        </init-param>
        <init-param>
          <param-name>listings</param-name>
          <param-value>false</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
      </servlet>