I am working a SPring-MVC project where I am trying to set the cookie. I am using Tomcat7, And I have already set the cookie processor in context.xml to Rfc6265CookieProcessor. Currently I am getting the following error.
Error log :
HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value
type Exception report
message Request processing failed; nested exception is java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: An invalid character [44] was present in the Cookie value
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:979)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
Cookie values to be set : The spaces are not actually there, got them while reformatting in IntelliJ to get them in one paragraph :
s.d774b7c6eabba92fce3edbed8a9b003b,
s.bdf5f951e4ab858aac87fb182439f57f,
s.e77bd0cd86b4af86c4a550ec11d71d4c,
s.431334e112350c9d545f7a44cbcc530d,
s.6e6057e5483b538cf9c6daf2934fd825,
s.ea2438094c8631123fab3bf3efb7ec17,
s.e17b1d9dd1b9702ca8c9e95d30906dd5, s .3f 3 c8f3fc19597025ef87dafc0fb277a, s .5531
b742d6e12717f4071818b5861bd2, s .420811998d
b14d0a68dd9e3d3c04849f, s.d8ed1aa3b0a2e513d449a96182898160, s.f3b5784d6e777032c6b7576e7d824af0, s .69
bc19557e43fcfa83816f427b60a09d, s .5677087e bc57003436c55f49fceff5cb, s .5f
a872b3e84fd69618534940034e1adb, s.fe4184c9b925ddf04def79c0c55392ca, s .74e4438d 05f 267
c48297a0c66a7dbeba, s .95e c071a356cf1998d809267006725db, s .9 b72a01cfda4509833c1f0c7bf2afdac, s .5240f
10897d 2f 96f 49d 0328 a2521519c, s .518 cd1d749fbba6540424874d64c5443
Character 44 (comma) is not valid in a cookie value.
See https://www.rfc-editor.org/rfc/rfc6265 for more details.
The solution for me was to change the version of Tomcat, I was working with 8.5 and I was getting the character error in cookie value, I changed to Tomcat 9 and the problem continued, finally with Tomcat 7 it was solved. The most logical option is to replace the commas in the cookie values, but if you want to quickly fix the problem locally and keep working you might consider switching from Tomcat.
Related
I have cluster "ABC". Now I moved the Application to "XYZ" Cluster. And I changed all configuration file with Clsuter "XYZ". Now when I trying to deploy application then getting below error:
o.s.v.c.l.SecretLeaseEventPublisher$LoggingErrorListener - - [RequestedSecret [path='bass/orchestrator/sit', mode=ROTATE]] Lease [leaseId='null', leaseDuration=PT0S, renewable=false] Cannot login using Kubernetes: invalid role name "bass-reader-prod-nezbleu"; nested exception is org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request
org.springframework.vault.authentication.VaultLoginException: Cannot login using Kubernetes: invalid role name "Xyz123"; nested exception is org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request
at org.springframework.vault.authentication.VaultLoginException.create(VaultLoginException.java:64)
at org.springframework.vault.authentication.KubernetesAuthentication.login(KubernetesAuthentication.java:107)
at org.springframework.vault.authentication.LifecycleAwareS
Application.yaml:
request.delay.ms: 200
A spring component:
#Value("${request.delay.ms}")
private long requestDelay;
Now, as strange as it sounds, it looks like spring can successfully resolve the property if it's value is a string, i.e. if I change 200 to 200a. It does throw an error
Caused by: java.lang.NumberFormatException: For input string: "200a" but that's expected.
If I change the value back to 200 I get
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'long'; nested exception is java.lang.NumberFormatException: For input string: "${request.delay.ms}"
And if I run tomcat in debug mode and step through the spring code, it works fine with no errors.
String #Value(s) are resolved fine in the same component all the time.
If you are using YAML instead of .properties you should write it in the following manner:
request:
delay:
ms: 200
which will be transformed to properties:
request.delay.ms=200 but you are mixing both files
See more here
My upload token expired and upon executing
./fortifyclient token -getoken AnalysisUploadToken -url"http://<localhost>/ssc" -user ssc_upload
I receive
An internal error has occurred.
A JAXB unmarshalling exception;
nested exception is javax.xml.bind.UnmarshalException: unexpected element
I would show the rest, however it is approx. 200 lines.
The last time this happened (90 days ago), I used the 4.00 version of ./fortifyclient and it worked.
Any suggestions?
Is time synchronized between your client and server? I think that any operation with fortifyclient will fail if the time on the client and server differs by more than 5 or 10 minutes.
This will include checking the date and timezone as well.
My CF9 application running on a windows server pops mail. When I attempt to retrieve the entire body of the message, I sometimes get the following error...
Error:
An exception occurred while retrieving mail.
The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Location:
Line 335 in controllers\Submissions.cfc
Not sure if this is pertinent, but FYI every message will have an image attached and the whole process usually works fine. This problem is intermittent.
My Questions
Any idea what causes this?
Any idea how to catch and resolve this issue?
I suspect I'll need to drop down into java, but not sure where to start.
Code Fragments
<cfscript>
// setup variables array for all cfpop calls
CFPopAttributes = {
server = request.pop.server,
port = request.pop.port,
username = request.pop.username,
password = request.pop.password,
timeout = 300
};
</cfscript>
<cfpop
action="getall"
name="entireEmail"
uid="#uid#"
attachmentpath="#originalsPath#"
attributecollection="#CFPopAttributes#" // Line 335
generateuniquefilenames="true"
/>
NOTE: I added the comment "Line 335" above to communicate exactly where in the code the template is breaking. If I move the attributecollection up or down (before/after other attributes), the error always breaks at the attributecollection line.
Stack Trace
struct [Filtered - 1 of 8 keys hidden]
Detail: An exception occurred while invoking an event handler method from Application.cfc. The method name is: onRequest.
Message: Event handler exception.
RootCause:
[struct]
Detail: The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Message: An exception occurred while retrieving mail.
RootCause:
[struct]
Message: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
StackTrace: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
at coldfusion.mail.EmailTable.getAttachmentName(EmailTable.java:819)
at coldfusion.mail.EmailTable.populate(EmailTable.java:283)
at coldfusion.mail.PopImpl.getMails(PopImpl.java:241)
at coldfusion.tagext.net.PopTag$1.run(PopTag.java:433)
at java.security.AccessController.doPrivileged(Native Method)
at coldfusion.tagext.net.PopTag.doStartTag(PopTag.java:429)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799)
at cfSubmissions2ecfc1952269377$funcGETEMAIL.runFunction(D:\home\wwwroot\controllers\Submissions.cfc:335)
If my code throws an exception, sometimes - not everytime - the jsf presents a blank page. I´m using facelets for layout.
A similar error were reported at this Sun forumn´s post, but without answers.
Anyone else with the same problem, or have a solution?
;)
Due to some requests. Here follow more datails:
web.xml
<error-page>
<exception-type>com.company.ApplicationResourceException</exception-type>
<location>/error.faces</location>
</error-page>
And the stack related to jsf is printed after the real exception:
####<Sep 23, 2008 5:42:55 PM GMT-03:00> <Error> <HTTP> <comp141> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1222202575662> <BEA-101107> <[weblogic.servlet.internal.WebAppServletContext#6d46b9 - appName: 'ControlPanelEAR', name: 'ControlPanelWeb', context-path: '/Web'] Problem occurred while serving the error page.
javax.servlet.ServletException: viewId:/error.xhtml - View /error.xhtml could not be restored.
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:249)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:525)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:261)
at weblogic.servlet.internal.ForwardAction.run(ForwardAction.java:22)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.ErrorManager.handleException(ErrorManager.java:144)
at weblogic.servlet.internal.WebAppServletContext.handleThrowableFromInvocation(WebAppServletContext.java:2201)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2053)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
javax.faces.application.ViewExpiredException: viewId:/error.xhtml - View /error.xhtml could not be restored.
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:180)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
I´m using the jsf version Mojarra 1.2_09, richfaces 3.2.1.GA and facelets 1.1.13.
Hope some help :(
I think this largely depends on your JSF implementation. I've heard that some will render blank screens.
The one we were using would throw error 500's with a stack trace. Other times out buttons wouldn't work without any error for the user. This was all during our development phase.
But the best advice I can give you is to catch the exceptions and log them in an error log so you have the stack trace for debugging later. For messages that we couldn't do anything about like a backend failing we would just add a fatal message to the FacesContext that gets displayed on the screen and log the stack trace.
I fixed a similar problem in my error.jsp page today. This won't be exactly the same as yours, but it might point someone in the right direction if they're having a similar problem. My problem seemed to be coming from two different sources.
First, the message exception property wasn't being set in some of the servlets that were throwing exceptions caught by the error page. The servlets were catching and rethrowing exceptions using the ServletException(Throwable rootCause) constructor.
Second, in the error page itself, the original author had used scriptlet code to parse the message using String.split(message, ";"); Since the message was null this failed. I was getting a NullPointerException in my error log, along with the message "Problem occurred while serving the error page."
These two things combined to give me a blank page at the URL of the servlet that was throwing the original exception. I fixed my problem by providing my own error message when I rethrow exceptions in my servlets using the ServletException(String message, Throwable rootCause) constructor, so the error message will no longer be null. I also rewrote the error.jsp page using EL instead of scriptlet code, but that wasn't strictly necessary.
For a blank page on JSF 2, place a breakpoint in ExceptionHandlerWrapper.handle or a class overriding this method. In my case it was due to custom code which was a too restrictive and the error was not logged.