File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Null pointer exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Null pointer exception" Watch "Null pointer exception" New topic

Null pointer exception

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi All,
Im facing a situation where my code throws an NPE ,it shows the NPE as being thrown by the domaintypeoid data member at line 110; however this variable is already initialized and used at a previous location , where it works fine (line marked in code ). but however ,the small value points to a null when used in another action in the same class .Could any tell me how to over come this?

The Stack trace produced is..
Listing domain
at com.vivek.struts2.action.DomainAction1.obtainData(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimer


Please help..

Learning and Learning!-- Java all the way!
I agree. Here's the link:
subject: Null pointer exception
It's not a secret anymore!