java.lang.IllegalArgumentException: object is not an instance of declaring class HandlerMethod details: Controller [$Proxy109] Method [public void com.dpgm.connect.framework.server.remoting.ConsoleHandler.handleRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException] Resolved arguments: [0] [type=org.eclipse.jetty.server.Request] [value=(GET /misc/console)@10144214 org.eclipse.jetty.server.Request@9ac9d6] [1] [type=org.eclipse.jetty.server.Response] [value=HTTP/1.1 200 ]

Spring JIRA | Daniel Gredler | 5 years 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

    As a result of the changes [1] made to RequestMappingHandlerMapping.isHandler(Class) to make it detect both Controller and RequestMapping annotations (see SPR-9374), one of our HttpRequestHandler implementations that was working in 3.1.1 no longer works in 3.1.2: {code} @RequestMapping("/console") @Transactional public class ConsoleHandler implements HttpRequestHandler, ApplicationContextAware { ... @RequestMapping(method = RequestMethod.GET) public void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ... } ... } {code} In 3.1.1, this handler was mapped by the DefaultAnnotationHandlerMapping, which was able to forward HTTP requests to this handler. However, because of the above change, in 3.1.2 this handler is mapped by the RequestMappingHandlerMapping, which throws the following exception when it tries to actually handle an HTTP request: {code} java.lang.IllegalArgumentException: object is not an instance of declaring class HandlerMethod details: Controller [$Proxy109] Method [public void com.dpgm.connect.framework.server.remoting.ConsoleHandler.handleRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException] Resolved arguments: [0] [type=org.eclipse.jetty.server.Request] [value=(GET /misc/console)@10144214 org.eclipse.jetty.server.Request@9ac9d6] [1] [type=org.eclipse.jetty.server.Response] [value=HTTP/1.1 200 ] at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:217) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) at javax.servlet.http.HttpServlet.service(HttpServlet.java:693) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:488) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:973) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) at org.eclipse.jetty.server.Server.handle(Server.java:350) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:442) at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class 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 org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) ... 34 more {code} I'm attaching the debug logs of the server startup + one HTTP request, one log file using Spring 3.1.1 and one log file using Spring 3.1.2. I've massaged the logs a little bit (removed most timestamps, normalized the hashcodes in the toStrings) so that it's easier to see the differences if you diff the files. [1] https://github.com/SpringSource/spring-framework/commit/2fa0e63e5ab84ac964c55a28000104d3855c886c

    Spring JIRA | 5 years ago | Daniel Gredler
    java.lang.IllegalArgumentException: object is not an instance of declaring class HandlerMethod details: Controller [$Proxy109] Method [public void com.dpgm.connect.framework.server.remoting.ConsoleHandler.handleRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException] Resolved arguments: [0] [type=org.eclipse.jetty.server.Request] [value=(GET /misc/console)@10144214 org.eclipse.jetty.server.Request@9ac9d6] [1] [type=org.eclipse.jetty.server.Response] [value=HTTP/1.1 200 ]
  2. 0

    As a result of the changes [1] made to RequestMappingHandlerMapping.isHandler(Class) to make it detect both Controller and RequestMapping annotations (see SPR-9374), one of our HttpRequestHandler implementations that was working in 3.1.1 no longer works in 3.1.2: {code} @RequestMapping("/console") @Transactional public class ConsoleHandler implements HttpRequestHandler, ApplicationContextAware { ... @RequestMapping(method = RequestMethod.GET) public void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ... } ... } {code} In 3.1.1, this handler was mapped by the DefaultAnnotationHandlerMapping, which was able to forward HTTP requests to this handler. However, because of the above change, in 3.1.2 this handler is mapped by the RequestMappingHandlerMapping, which throws the following exception when it tries to actually handle an HTTP request: {code} java.lang.IllegalArgumentException: object is not an instance of declaring class HandlerMethod details: Controller [$Proxy109] Method [public void com.dpgm.connect.framework.server.remoting.ConsoleHandler.handleRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException] Resolved arguments: [0] [type=org.eclipse.jetty.server.Request] [value=(GET /misc/console)@10144214 org.eclipse.jetty.server.Request@9ac9d6] [1] [type=org.eclipse.jetty.server.Response] [value=HTTP/1.1 200 ] at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:217) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) at javax.servlet.http.HttpServlet.service(HttpServlet.java:693) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:488) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:973) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) at org.eclipse.jetty.server.Server.handle(Server.java:350) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:442) at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class 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 org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) ... 34 more {code} I'm attaching the debug logs of the server startup + one HTTP request, one log file using Spring 3.1.1 and one log file using Spring 3.1.2. I've massaged the logs a little bit (removed most timestamps, normalized the hashcodes in the toStrings) so that it's easier to see the differences if you diff the files. [1] https://github.com/SpringSource/spring-framework/commit/2fa0e63e5ab84ac964c55a28000104d3855c886c

    Spring JIRA | 5 years ago | Daniel Gredler
    java.lang.IllegalArgumentException: object is not an instance of declaring class HandlerMethod details: Controller [$Proxy109] Method [public void com.dpgm.connect.framework.server.remoting.ConsoleHandler.handleRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException] Resolved arguments: [0] [type=org.eclipse.jetty.server.Request] [value=(GET /misc/console)@10144214 org.eclipse.jetty.server.Request@9ac9d6] [1] [type=org.eclipse.jetty.server.Response] [value=HTTP/1.1 200 ]
  3. 0

    Works both for me, but not together: Encountered an error executing the step: class java.lang.IllegalArgumentException: Unable to invoke method: [public void XXXReader.beforeStep(org.springframework.batch.core.StepExecution)] on object: [XXXReader@8b567c] with arguments: [[StepExecution: id=0, name=writeDatasheetXml, status=STARTED, exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, commitCount=0, rollbackCount=0, exitDescription=]] java.lang.IllegalArgumentException: Unable to invoke method: [public void XXXReader.beforeStep(org.springframework.batch.core.StepExecution)] on object: [XXXReader@8b567c] with arguments: [[StepExecution: id=0, name=XXX, status=STARTED, exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, commitCount=0, rollbackCount=0, exitDescription=]] at org.springframework.batch.support.SimpleMethodInvoker.invokeMethod(SimpleMethodInvoker.java:97) at org.springframework.batch.core.listener.MethodInvokerMethodInterceptor.invoke(MethodInvokerMethodInterceptor.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy18.beforeStep(Unknown Source) at org.springframework.batch.core.listener.CompositeStepExecutionListener.beforeStep(CompositeStepExecutionListener.java:76) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:193) at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:348) at org.springframework.batch.core.job.flow.FlowJob.access$100(FlowJob.java:43) at org.springframework.batch.core.job.flow.FlowJob$JobFlowExecutor.executeStep(FlowJob.java:137) at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:105) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:250) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:110) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:105) at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:207) at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:254) Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class 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 org.springframework.batch.support.SimpleMethodInvoker.invokeMethod(SimpleMethodInvoker.java:95) ... 19 more

    Spring JIRA | 8 years ago | Jörg Gottschling
    java.lang.IllegalArgumentException: Unable to invoke method: [public void XXXReader.beforeStep(org.springframework.batch.core.StepExecution)] on object: [XXXReader@8b567c] with arguments: [[StepExecution: id=0, name=XXX, status=STARTED, exitStatus=EXECUTING, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, commitCount=0, rollbackCount=0, exitDescription=]]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    CC error when using getAvailableItems()

    GitHub | 3 years ago | RikuSS4
    java.lang.IllegalArgumentException: object is not an instance of declaring class
  6. 0

    java.lang.IllegalArgumentException: object is not an instance of declaring class

    GitHub | 3 years ago | mibby
    java.lang.IllegalArgumentException: object is not an instance of declaring class

  1. johnxfly 2 times, last 2 months ago
  2. Pilleo 1 times, last 2 months ago
  3. musketyr 4 times, last 2 months ago
  4. Aria Pahlavan 16 times, last 5 months ago
  5. kjhdofjosvs 2 times, last 6 months ago
9 more registered users
72 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    object is not an instance of declaring class

    at sun.reflect.NativeMethodAccessorImpl.invoke0()
  2. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    4. java.lang.reflect.Method.invoke(Unknown Source)
    4 frames
  3. Spring
    InvocableHandlerMethod.invokeForRequest
    1. org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
    2. org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
    2 frames
  4. Spring MVC
    FrameworkServlet.doGet
    1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
    2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
    3. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
    4. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    8. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    8 frames
  5. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
    2. javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    2 frames
  6. Jetty
    AsyncHttpConnection.handle
    1. org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558)
    2. org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:488)
    3. org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
    4. org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
    5. org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
    6. org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:973)
    7. org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417)
    8. org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
    9. org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907)
    10. org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    11. org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47)
    12. org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
    13. org.eclipse.jetty.server.Server.handle(Server.java:350)
    14. org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:442)
    15. org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924)
    16. org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
    17. org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
    18. org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51)
    18 frames
  7. GWT dev
    SelectChannelEndPoint$1.run
    1. org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)
    2. org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)
    2 frames
  8. Jetty
    QueuedThreadPool$3.run
    1. org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
    2. org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
    2 frames
  9. Java RT
    Thread.run
    1. java.lang.Thread.run(Unknown Source)
    1 frame