HTTP Status 500-request processing failed; Nested exception is Java.lang.IllegalArgumentException:Control character in cookie value or attribute.

Source: Internet
Author: User
Tags stack trace apache tomcat


 
 
 1 HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.
 2 type Exception report
 3 
 4 message Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.
 5 
 6 description The server encountered an internal error that prevented it from fulfilling this request.
 7 
 8 exception
 9 
10 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.
11     org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
12     org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
13     javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
14     org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
15     javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
16     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
17     org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
18     org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
19 root cause
20 
21 java.lang.IllegalArgumentException: Control character in cookie value or attribute.
22     org.apache.tomcat.util.http.CookieSupport.isHttpSeparator(CookieSupport.java:205)
23     org.apache.tomcat.util.http.CookieSupport.isHttpToken(CookieSupport.java:229)
24     org.apache.tomcat.util.http.ServerCookie.appendCookieValue(ServerCookie.java:185)
25     org.apache.catalina.connector.Response.generateCookieString(Response.java:1054)
26     org.apache.catalina.connector.Response.addCookie(Response.java:996)
27     org.apache.catalina.connector.ResponseFacade.addCookie(ResponseFacade.java:380)
28     admin.membersheep.hk.Controller.HomeController.Login(HomeController.java:327)
29     sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
30     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
31     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
32     java.lang.reflect.Method.invoke(Method.java:498)
33     org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)
34     org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
35     org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
36     org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
37     org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
38     org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
39     org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
40     org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
41     org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
42     org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
43     javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
44     org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
45     javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
46     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
47     org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
48     org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
49 note The full stack trace of the root cause is available in the Apache Tomcat/7.0.85 logs.


IllegalArgumentException This exception indicates that an invalid or incorrect parameter was passed to the method



Note Control character in cookie value or attribute this is the point.



Problem description Cookie Encoding format error



Workaround cookie stored value is indicated UTF8 international encoded format



Such as


Javax.servlet.http.Cookie Realcookie = new Javax.servlet.http.Cookie (Java.net.URLEncoder.encode (Temp.getname (), " UTF8 "), Java.net.URLEncoder.encode (Temp.getvalue ()," UTF8 "));

Do not reprint without consent!!!









HTTP Status 500-request processing failed; Nested exception is Java.lang.IllegalArgumentException:Control character in cookie value or attribute.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.