2年来,我一直在努力寻找解决此错误的方法。你能帮我发生什么事
这是错误堆栈跟踪:
“ java.lang.IllegalArgumentException:参数类型的名称 [java.lang.String]不可用,参数名称信息不可用 在类文件中找到。\ r \ n \ tat org.springframework.util.Assert.notNull(Assert.java:112)\ r \ n \ tat org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.updateNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:138)\ r \ n \ tat org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.getNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:117)\ r \ n \ tat org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:84)\ r \ n \ tat org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)\ r \ n \ tat org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)\ r \ n \ tat org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)\ r \ n \ tat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)\ r \ n \ tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)\ r \ n \ tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)\ r \ n \ tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)\ r \ n \ tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)\ r \ n \ tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)\ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)\ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)\ r \ n \ tat javax.servlet.http.HttpServlet.service(HttpServlet.java:735)\ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)\ r \ n \ tat javax.servlet.http.HttpServlet.service(HttpServlet.java:848)\ r \ n \ tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)\ r \ n \ tat org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1496)\ r \ n \ tat org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:82)\ r \ n \ tat org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:294)\ r \ n \ tat org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1484)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:330)\ r \ n \ tat org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)\ r \ n \ tat org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)\ r \ n \ tat org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)\ r \ n \ tat org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)\ r \ n \ tat org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)\ r \ n \ tat org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)\ r \ n \ tat org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1476)\ r \ n \ tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)\ r \ n \ tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)\ r \ n \ tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)\ r \ n \ tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)\ r \ n \ tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)\ r \ n \ tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)\ r \ n \ tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)\ r \ n \ tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)\ r \ n \ tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)\ r \ n \ tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)\ r \ n \ tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)\ r \ n \ tat org.eclipse.jetty.server.Server.handle(Server.java:370)\ r \ n \ tat org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)\ r \ n \ tat org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)\ r \ n \ tat org.eclipse.jetty.server.AbstractHttpConnection $ RequestHandler.headerComplete(AbstractHttpConnection.java:1033)\ r \ n \ tat org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)\ r \ n \ tat org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)\ r \ n \ tat org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)\ r \ n \ tat org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)\ r \ n \ tat org.eclipse.jetty.io.nio.SelectChannelEndPoint $ 1.run(SelectChannelEndPoint.java:52)\ r \ n \ tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)\ r \ n \ tat org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:543)\ r \ n \ tat java.lang.Thread.run(Thread.java:748)\ r \ n“
答案 0 :(得分:1)
您最有可能尝试将参数作为字符串传递给某个地方,在该地方,该参数不应接受字符串作为参数,也可能根本不接受任何参数。
正如评论之一所说,您可以在此处发布代码吗?日志也无法告诉您哪个特定班级有例外。
答案 1 :(得分:0)
我怀疑您有一些Spring MVC控制器,希望Spring会自动匹配控制器方法参数并按名称请求参数。
根据本文enter link description here,仅当您的代码已使用调试信息(javac -g选项)进行编译时,此方法才有效。
我在这个问题上也很难受。它在我的IDE中有效,但在将ant构建部署到tomcat时无效。当我尝试远程调试tomcat并因此添加javac调试选项时,它突然工作了。但是,我没有看到调试选项与我正在寻找的问题的关系;-)
答案 2 :(得分:0)
实际上,这里的String类型不可用,这意味着就像我们提供参数一样: @Requestparam(value =“ myString”)字符串myString 如果我们给它类似@Requestparam String myString,则很可能会收到该错误。
答案 3 :(得分:0)
当该方法未针对字符串添加@RequestParam批注时,我们遇到了相同的错误。当我们开始通过Jenkins使用Ant Build时,会生成该错误。通过Eclipse IDE导出WAR文件时,不会出现。