wood burning stoves 2.0*
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(DomainAction1.java:110)
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(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimer


Please help..

Learning and Learning!-- Java all the way!
It is sorta covered in the JavaRanch Style Guide.
subject: Null pointer exception
Similar Threads
Help in Debugging
Equivalent of logic iterate in Struts 2
Struts 2 jsp Error.
Dynamic table not displaying.
List of beans returning empty