Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

validate() method throwing a NullPointerException with execAndWait interceptor.

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!!
 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!!
 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ??
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic