This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
There is currently a JSP having few fields and the request is sent to a backend procedure which fetches the JSP fields and creates a record in backend and returns a reference number to the user which is displayed as a result to the user like "Your reference no is : 1234567"
The application is working fine. However, only at a few times, null is being shown to the user, like Your reference no is : null. This is happening only a few times, something once or twice in a week and there is no straight pattern to it.
Can someone please let me know how to go about it.
My best advice would be to turn on trace and look through it.
Its obviously null .... from my experience you probably encountered a runtime exception in the action controller. The way I have solved this before is I put a try catch around the execute method or whatever method the action executed and in the catch block I have done a print stack trace. You'll then see what is causing the issue ... which in most cases is probably an array index out of bounds or something like that.
Joined: Jan 24, 2005
Ok. Will try printing the trace.
However, as I stated, that the issue is sporadic, happening once or twice in 2-3 weeks, with no specific pattern, could there be any other reason. The reference no returned from the backend is set in user's session in action class and is then displayed to the user.
nope there is something wrong with your code I highly doubt there is an issue with container if that is what your trying to say. There may be an issue with data in the session but the issue is still in your code. It can be because of something a user entered or maybe a third party your connecting with is not always sending you exactly what you think ... either way ... the only time I have ever seen such case and yes even if its sporadic has been a runtime exception in the action controller ....