characterEncoding=utf8&{"客户端发现响应内容类型为“text/html;charset=utf-8”,但应为“text/xml”。\r\n
请求失败,错误信息为:\r\n--\r\n<html><head><title>Apache Tomcat/6.0.44 - 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 - java.lang.IllegalArgumentException: JwtUtil.parseToken() .. token is null</h1><HR size=\"1\" noshade=\"noshade\"><p><b>type</b> Exception report</p><p><b>message</b> <u>java.lang.IllegalArgumentException: JwtUtil.parseToken() .. token is null</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>javax.servlet.ServletException: java.lang.IllegalArgumentException: JwtUtil.parseToken() .. token is null\n\tcom.jdwl.platform.wms.auth.filter.AuthFilter.doFilter(AuthFilter.java:62)\n\tcom.jd.bk.common.web.filter.CharsetFilter.doFilter(CharsetFilter.java:68)\n</pre></p><p><b>root cause</b> <pre>java.lang.IllegalArgumentException: JwtUtil.parseToken() .. token is null\n\tcom.jdwl.platform.wms.auth.jwt.JwtUtil.parseToken(JwtUtil.java:74)\n\tcom.jdwl.platform.wms.auth.handle.in.DefaultClientRedisParseAuthHandler.handler(DefaultClientRedisParseAuthHandler.java:51)\n\tcom.jdwl.platform.wms.auth.filter.chain.BearerFilter.doFilter(BearerFilter.java:33)\n\tcom.jdwl.platform.wms.auth.filter.chain.IAbstractFilter.commonFilter(IAbstractFilter.java:19)\n\tcom.jdwl.platform.wms.auth.filter.chain.BasicFilter.doFilter(BasicFilter.java:47)\n\tcom.jdwl.platform.wms.auth.filter.chain.IAbstractFilter.commonFilter(IAbstractFilter.java:19)\n\tcom.jdwl.platform.wms.auth.filter.chain.SoapFilter.doFilter(SoapFilter.java:67)\n\tcom.jdwl.platform.wms.auth.filter.chain.IAbstractFilter.commonFilter(IAbstractFilter.java:19)\n\tcom.jdwl.platform.wms.auth.filter.chain.PathFilter.doFilter(PathFilter.java:48)\n\tcom.jdwl.platform.wms.auth.filter.AuthFilter.doFilter(AuthFilter.java:59)\n\tcom.jd.bk.common.web.filter.CharsetFilter.doFilter(CharsetFilter.java:68)\n</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/6.0.44 logs.</u></p><HR size=\"1\" noshade=\"noshade\"><h3>Apache Tomcat/6.0.44</h3></body></html>
本地winform客户端启动连接本地spring项目时,出现以上错误;
只看前面以为是编码格式设置有问题,仔细往后读会看到java.lang.IllegalArgumentException: JwtUtil.parseToken() .. token is null这个异常,在JwtUtil.parseToken()这里打断点发现本地spring服务默认配置了jwt认证,从而定位到了web.xml中的
<filter>
<filter-name>AuthFilter</filter-name>
<!--这边的*.*.*是为了保密我隐去了有关项目的信息 哈哈哈-->
<filter-class>com.*.*.*.auth.filter.AuthFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这个配置,所有的请求都会先进行认证过滤,由于我是本地项目启动无关安全问题,直接把这段注释掉之后重试发现错误解决!