File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes interceptor problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "interceptor problem" Watch "interceptor problem" New topic
Author

interceptor problem

tyte kyat
Ranch Hand

Joined: May 17, 2011
Posts: 40
Hi,

I got a problem with interceptor implementation in my application. and the following is my struts.xml file



What happens here is when I reference my interceptor to listcustomer action, I got NullPointerException. And if I do NOT reference it, the whole thing is working fine.

and again, then I realize (after reading some websites) in my stack(mystack), there is no defaultStack and it might be the reason I got error. So, I change it as follow



and then I reference the stack (mystack) to the action listcustomer. Again, nullpointerexception.

So, I took the that out, and put it in the action tag. as follow





and again null pointer exception.

I am really lost now. can someone lift me up please? thanks.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Friend, There is no problem in struts configuration please provide more details when you are posting here we couldn't understand what you are doing without details. You should provide complete stack trace as well. In Struts2 one thing you should remember when you are overriding interceptor stack you have to configure the default interceptor-stack in you want or else it wouldn't be called. You have problem in custom Interceptor. Post here if you feel something that wouldn't be shared share a sample code similar to that. If so we can help you.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
tyte kyat
Ranch Hand

Joined: May 17, 2011
Posts: 40
I am sorry, it is ok to share

the following is my CustomerListAction. Basically, what it does is getting the list of customer from my table in database.




and this is my DAO implementation which implement a CustomerListDAOImpl method from its interface.



this is my custom interceptor which is going to check whether a user is logged in or not.



The following is the jar that I used


that is and I DO want to understand it please. Thanks.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

In which line you are getting NullPointerException and provide ExceptionStackTrace.
tyte kyat
Ranch Hand

Joined: May 17, 2011
Posts: 40
Thanks by the way..

the error is when I modified my struts.xml file as follow ..


the related Action Class is as follow



and the related DAO is as follow



the error report is as follow ..



by the way as soon as I run the project I used to get the following error and I am not quite sure whether it is related or not


thanks Mohana
tyte kyat
Ranch Hand

Joined: May 17, 2011
Posts: 40
Hi, Mohana

I got it running. the reason I got error is in my struts.xml file. As I am using full-hibernate-plugin, my custom stack should inherit from defaultStackHibernate or basicStackHibernate.

Thanks.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: interceptor problem