Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null issue

 
Nikhil Bansal
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

We are having a strange issue.

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.

Thanks,
Nikhil
 
Jesus Mireles
Ranch Hand
Posts: 122
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Nikhil Bansal
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lucas,

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.

Could there be a session problem as well ?

Thanks,
Nikhil
 
Jesus Mireles
Ranch Hand
Posts: 122
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ....

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic