Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validate() method throwing a NullPointerException with execAndWait interceptor.

 
Abhimanyus singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys.....
I've a problem ...
I'm trying to implement execAndWait interceptor...just to give an impression to the user that some heavy task starts executing..as sooon as he.she logs in....but...after displaying the default wait page for a certain period of time, the web page informs that a NPE is thrown...

my struts.xml is:::-->

The Exception's stack trace is as follows:::



The Action Class is:::


The line 32 of my Action Class is trying to test whether the user has entered his/her name or not !!


Please help !!!
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try to get the value for username while debugging , i think this.username is null and when you try to invoke method isempty on null it gives you the exception.

Regards
Jatan
 
Abhimanyus singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jatan bhavsar wrote:Hi,

Try to get the value for username while debugging , i think this.username is null and when you try to invoke method isempty on null it gives you the exception.

Regards
Jatan


Yeah...That seems to be the issue...but, please let me know , on how to get rid of it !!!
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check to see if your field "username" is exactly the same as the one received from your form JSP . Check for spelling mistakes . Also verify that you are using the correct case . Keep care , since UserName is not the same as username .
 
Abhimanyus singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif Asif wrote:Check to see if your field "username" is exactly the same as the one received from your form JSP . Check for spelling mistakes . Also verify that you are using the correct case . Keep care , since UserName is not the same as username .


Hi Asif...the field names in the jsp's properly correspond to the properties in the Action Class, as mentioned in the first post, the issue arises only when i put an execAndWait interceptor reference in struts.xml.......and the moment I remove the interceptor reference, everything goes fine, I think the inclusion of the execAndWait interceptor is "kind of" keeps on preventing the mapping of form fields to the respective properties in the Action Class.....but if that is the problem...How can I cure it ??
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you have a "wait" result configured for your action?
I see the documentation says the following:
Important: Because the action will be running in a seperate thread, you can't use ActionContext because it is a ThreadLocal. This means if you need to access, for example, session data, you need to implement SessionAware rather than calling ActionContext.getSession().

ExecuteAndWaitInterceptor
I wonder if you are having a thread-related problem with your validation.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic