Announcement Announcement Module
Collapse
No announcement yet.
java.lang.IllegalStateException & Parameter name Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.IllegalStateException & Parameter name

    Hi here,

    I encounter a problem when I upgrade to spring mvc 3.0.4.
    the case is:
    Controller definition:
    Code:
        <bean parent="controller">
        	<property name="proxyInterfaces" value="com.asap.dbs.web.action.UserAction" />
        	<property name="target" >
        		<bean class="com.asap.dbs.web.action.UserActionImpl"  scope="prototype" />
        	</property>
        </bean>
    Java Code
    Code:
    @Controller
    @RequestMapping("/user")
    public interface UserAction{
       @RequestMapping(value="fetch/{name}")
       void fetch(@PathVariable("name") String name);
    }
    public class UserActionImpl implements UserAction{
      ...
    }
    when I try to access http://host/user/fetch/someone I got below Exception
    Code:
    java.lang.IllegalStateException: No parameter name specified for argument of type [java.lang.String], and no parameter name information found in class file either.
    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.getRequiredParameterName(HandlerMethodInvoker.java:618)
    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolvePathVariable(HandlerMethodInvoker.java:597)
    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:289)
    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:163)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
    But it work well at previous version 3.0.1.
    After I trace into LocalVariableTableParameterNameDiscoverer.inspectC lass(Class<?> clz). I have found diference between two version.
    At 3.0.1, argument clz was populated interface UserAction instead of version 3.0.4's proxy object. According to this reason. spring can found parameter name at version 3.0.1 but cannot found at version 3.0.4.

    Should I report this as a bug or I use spring in wrong way?

    thanks in advance

  • #2
    meaning

    I've not studied your example but according to my knowledge: java.lang.IllegalStateException
    it Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.
    All the best.

    Bridal Shower Favors
    wedding favors

    Comment


    • #3
      Thanks martin675.

      I actually traced to source code at class
      Code:
      LocalVariableTableParameterNameDiscoverer.inspectClass(Class<?> clz)
      , and found some deference between 3.0.1 and 3.0.4. Please take some time on my example if you are still insterested, Also I found some familar issue at tracing system of Spring.

      liang xiao

      Comment


      • #4
        I found issue SPR-5457 at Spring projects issue tracker is related to this thread.
        https://jira.springframework.org/browse/SPR-5457

        Comment


        • #5
          Below is my code when the same error occurred. I have VelocityViewResolver as my viewResolver. But in a weird situation, the error occurs when I have my security context enabled. But it works perfectly when security context is commented out.

          Code:
          @PreAuthorize("hasAuthority('PERM_DOCTORS_NOTES_CREATE')")
              @RequestMapping(value = "/patient/{pin}/doctors-notes/action", method = RequestMethod.POST, params = "draftBtn")
              ModelAndView saveDraft(@PathVariable("pin") long pin,
                                     @RequestParam(value = "formKey") String formKey,
                                     @ModelAttribute(WebFormSupport.FORM_NAME) FormResultDto formResult, BindingResult result,
                                     HttpSession httpSession, HttpServletRequest request);




          Code:
          Handler execution resulted in exception org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public abstract org.springframework.web.servlet.ModelAndView com.tmc.emr.web.template.docnotes.controller.DoctorsNotesActionController.saveDraft(long,java.lang.String,com.tmc.emr.workflow.model.FormResultDto,org.springframework.validation.BindingResult,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest)]; nested exception is java.lang.IllegalStateException: No parameter name specified for argument of type [java.lang.String], and no parameter name information found in class file either.
          	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:181)
          	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
          	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)

          Comment

          Working...
          X