java.lang.NullPointerException

Spring JIRA | Jim Newsham | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When trying to use a validator method, I was getting a pretty deeply nested NullPointerException: org.springframework.webflow.ActionExecutionException: Exception thrown executing action 'com.commercepoint.superquote.webflow.action.VendorSignupActions@a010ba' in state 'page1' of flow 'vendorSignupFlow'; nested exception is java.lang.NullPointerException: null java.lang.NullPointerException at org.springframework.webflow.util.DispatchMethodInvoker.getParameterTypesString(DispatchMethodInvoker.java:168) at org.springframework.webflow.util.DispatchMethodInvoker.getSignature(DispatchMethodInvoker.java:206) at org.springframework.webflow.util.DispatchMethodInvoker$1.create(DispatchMethodInvoker.java:65) at org.springframework.util.CachingMapDecorator.get(CachingMapDecorator.java:143) at org.springframework.webflow.util.DispatchMethodInvoker.getDispatchMethod(DispatchMethodInvoker.java:217) at org.springframework.webflow.util.DispatchMethodInvoker.dispatch(DispatchMethodInvoker.java:230) at org.springframework.webflow.action.FormAction.invokeValidatorMethod(FormAction.java:729) at org.springframework.webflow.action.FormAction.doValidate(FormAction.java:703) at org.springframework.webflow.action.FormAction.bindAndValidate(FormAction.java:554) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.webflow.util.DispatchMethodInvoker.dispatch(DispatchMethodInvoker.java:231) at org.springframework.webflow.action.MultiAction.doExecute(MultiAction.java:138) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:225) at org.springframework.webflow.ActionExecutor.execute(ActionExecutor.java:65) at org.springframework.webflow.AnnotatedAction.execute(AnnotatedAction.java:154) at org.springframework.webflow.ActionExecutor.execute(ActionExecutor.java:65) at org.springframework.webflow.support.ActionTransitionCriteria.test(ActionTransitionCriteria.java:87) at org.springframework.webflow.support.TransitionCriteriaChain.test(TransitionCriteriaChain.java:65) at org.springframework.webflow.Transition.canExecute(Transition.java:239) [ETC ETC] ...which wasn't very descriptive of the problem, so I had to dig around in the source. It seems that since setFormObjectType was not invoked, the parameter types of the validator method invoker was not set. In my case, I wasn't setting formObjectType because I'm overriding loadFormObject. At the very least, this issue report is asking for: (1) more descriptive error reporting in case of improper use; (2) better documentation as to how custom validator methods may be invoked, perhaps within FormAction. However, you may also want to consider removing the requirement that formObjectType must be set. I see that it's now necessary since the validator method is typed to the form object type... but is this signature necessary? Why not just use the same signature as Validator.validate()?

    Spring JIRA | 1 decade ago | Jim Newsham
    java.lang.NullPointerException
  2. 0

    When trying to use a validator method, I was getting a pretty deeply nested NullPointerException: org.springframework.webflow.ActionExecutionException: Exception thrown executing action 'com.commercepoint.superquote.webflow.action.VendorSignupActions@a010ba' in state 'page1' of flow 'vendorSignupFlow'; nested exception is java.lang.NullPointerException: null java.lang.NullPointerException at org.springframework.webflow.util.DispatchMethodInvoker.getParameterTypesString(DispatchMethodInvoker.java:168) at org.springframework.webflow.util.DispatchMethodInvoker.getSignature(DispatchMethodInvoker.java:206) at org.springframework.webflow.util.DispatchMethodInvoker$1.create(DispatchMethodInvoker.java:65) at org.springframework.util.CachingMapDecorator.get(CachingMapDecorator.java:143) at org.springframework.webflow.util.DispatchMethodInvoker.getDispatchMethod(DispatchMethodInvoker.java:217) at org.springframework.webflow.util.DispatchMethodInvoker.dispatch(DispatchMethodInvoker.java:230) at org.springframework.webflow.action.FormAction.invokeValidatorMethod(FormAction.java:729) at org.springframework.webflow.action.FormAction.doValidate(FormAction.java:703) at org.springframework.webflow.action.FormAction.bindAndValidate(FormAction.java:554) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.webflow.util.DispatchMethodInvoker.dispatch(DispatchMethodInvoker.java:231) at org.springframework.webflow.action.MultiAction.doExecute(MultiAction.java:138) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:225) at org.springframework.webflow.ActionExecutor.execute(ActionExecutor.java:65) at org.springframework.webflow.AnnotatedAction.execute(AnnotatedAction.java:154) at org.springframework.webflow.ActionExecutor.execute(ActionExecutor.java:65) at org.springframework.webflow.support.ActionTransitionCriteria.test(ActionTransitionCriteria.java:87) at org.springframework.webflow.support.TransitionCriteriaChain.test(TransitionCriteriaChain.java:65) at org.springframework.webflow.Transition.canExecute(Transition.java:239) [ETC ETC] ...which wasn't very descriptive of the problem, so I had to dig around in the source. It seems that since setFormObjectType was not invoked, the parameter types of the validator method invoker was not set. In my case, I wasn't setting formObjectType because I'm overriding loadFormObject. At the very least, this issue report is asking for: (1) more descriptive error reporting in case of improper use; (2) better documentation as to how custom validator methods may be invoked, perhaps within FormAction. However, you may also want to consider removing the requirement that formObjectType must be set. I see that it's now necessary since the validator method is typed to the form object type... but is this signature necessary? Why not just use the same signature as Validator.validate()?

    Spring JIRA | 1 decade ago | Jim Newsham
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.webflow.util.DispatchMethodInvoker.getParameterTypesString()
    2. Spring Web Flow
      DispatchMethodInvoker$1.create
      1. org.springframework.webflow.util.DispatchMethodInvoker.getParameterTypesString(DispatchMethodInvoker.java:168)
      2. org.springframework.webflow.util.DispatchMethodInvoker.getSignature(DispatchMethodInvoker.java:206)
      3. org.springframework.webflow.util.DispatchMethodInvoker$1.create(DispatchMethodInvoker.java:65)
      3 frames
    3. Spring Core
      CachingMapDecorator.get
      1. org.springframework.util.CachingMapDecorator.get(CachingMapDecorator.java:143)
      1 frame
    4. Spring Web Flow
      DispatchMethodInvoker.dispatch
      1. org.springframework.webflow.util.DispatchMethodInvoker.getDispatchMethod(DispatchMethodInvoker.java:217)
      2. org.springframework.webflow.util.DispatchMethodInvoker.dispatch(DispatchMethodInvoker.java:230)
      2 frames
    5. Spring Web Flow
      FormAction.bindAndValidate
      1. org.springframework.webflow.action.FormAction.invokeValidatorMethod(FormAction.java:729)
      2. org.springframework.webflow.action.FormAction.doValidate(FormAction.java:703)
      3. org.springframework.webflow.action.FormAction.bindAndValidate(FormAction.java:554)
      3 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    7. Spring Web Flow
      DispatchMethodInvoker.dispatch
      1. org.springframework.webflow.util.DispatchMethodInvoker.dispatch(DispatchMethodInvoker.java:231)
      1 frame
    8. Spring Web Flow
      AbstractAction.execute
      1. org.springframework.webflow.action.MultiAction.doExecute(MultiAction.java:138)
      2. org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:225)
      2 frames
    9. org.springframework.webflow
      Transition.canExecute
      1. org.springframework.webflow.ActionExecutor.execute(ActionExecutor.java:65)
      2. org.springframework.webflow.AnnotatedAction.execute(AnnotatedAction.java:154)
      3. org.springframework.webflow.ActionExecutor.execute(ActionExecutor.java:65)
      4. org.springframework.webflow.support.ActionTransitionCriteria.test(ActionTransitionCriteria.java:87)
      5. org.springframework.webflow.support.TransitionCriteriaChain.test(TransitionCriteriaChain.java:65)
      6. org.springframework.webflow.Transition.canExecute(Transition.java:239)
      6 frames