尝试重播Jmeter脚本时显示空指针异常

时间:2018-07-24 06:54:41

标签: jmeter

我正在尝试重播我的JMeter脚本,在该脚本中,我单击了几个按钮来浏览enter image description here网页。但是我在响应数据部分中得到了空指针异常。奇怪的是,在采样器结果部分下,我得到的响应代码为“ 200”。我在捕获请求时正在使用“测试脚本记录器”。在以前的构建中,我遵循相同的方法,但是从未遇到过问题。

异常显示为:

{“ errorTrace”:“ java.lang.NullPointerException \ r \ n \ tat com.bird.common.service.NewReportService.getSchemaDetails(NewReportService.java:97)\ r \ n \ tat com.bird.common。 controller.NewReportController.getSchemaDetails(NewReportController.java:197)\ r \ n \ tat sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)\ r \ n \ tat sun.reflect.NativeMethodAccessorImpl.invoke(未知源)\ r \ n \ tat sun.reflect.DelegatingMethodAccessorImpl.invoke(未知源)\ r \ n \ tat java.lang.reflect.Method.invoke(未知源)\ r \ n \ tat org.springframework.web.bind.annotation.support。 HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:178)\ r \ n \ tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:444)\ r \ n \ tat org.springframework.web。 servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:432)\ r \ n \ tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServl et.java:959)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)\ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet。 java:970)\ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)\ r \ n \ tat javax.servlet.http.HttpServlet.service(HttpServlet.java:634) \ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)\ r \ n \ tat javax.servlet.http.HttpServlet.service(HttpServlet.java:741)\ r \ n \ tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\ r \ n \ tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\ r \ n \ tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\ r \ n \ tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\ r \ n \ tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC hain.java:166)\r\n\tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:317)\ r \ n \ tat org.springframework.security.web.access.intercept。 FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)\ r \ n \ tat org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)\ r \ n \ tat org.springframework.security。 web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)\ r \ n \ tat org.springframework。 security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)\ r \ n \ tat org。 springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web。 authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security。 web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework。 security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org。 springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.se curity.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.keycloak.adapters.springsecurity.filter.KeycloakPreAuthActionsFilter.doFilter(KeycloakPreAuthActionsFilter.java:84)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)\ r \ n \ tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java: 56)\ r \ n \ tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilte r.java:107)\r\n\tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web.session.ConcurrentSessionFilter。 doFilter(ConcurrentSessionFilter.java:155)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web.context。 SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)\ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ r \ n \ tat org.springframework.security.web。 FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)\ r \ n \ tat org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)\ r \ n \ tat org.springframework.web.filter.DelegatingFilterProxy。 invokeDelegate(DelegatingFilterProxy.java:346)\ r \ n \ tat org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.jav a:262)\ r \ n \ tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\ r \ n \ tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 166)\ r \ n \ tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)\ r \ n \ tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) \ r \ n \ tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)\ r \ n \ tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)\ r \ n \ tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\ r \ n \ tat org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)\ r \ n \ tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)\ r \ n \ tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\ r \ n \ tat org.apache.coyote.http11.Http11Processor.service(Http11Proces sor.java:412)\r\n\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)\ r \ n \ tat org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java: 754)\ r \ n \ tat org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1385)\ r \ n \ tat org.apache.tomcat.util.net.SocketProcessorBase.run( SocketProcessorBase.java:49)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源)\ r \ n \ tat java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知来源)\ r \ n \ tat org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)\ r \ n \ tat java.lang.Thread.run(未知源)\ r \ n“,” errorCode“ :“ ERR-9026”,“错误”:“未知异常。请联系支持团队”}

1 个答案:

答案 0 :(得分:0)

您似乎正在尝试对启用了Spring Session Management的Web应用程序进行负载测试。这意味着如果不对它应用correlation,将无法按原样重放录制的脚本。

  1. 再记录一次脚本
  2. 比较2个生成的.jmx脚本并找出差异
  3. 检查上一个页面响应以找到动态元素,使用合适的JMeter Variable将其提取到JMeter PostProcessor中,并用相关变量替换记录的硬编码值

在大多数常见设置中,只需在测试计划中添加HTTP Cookie Manager即可自动处理Cookie,并发送HTTP Header Manager发送可以从cookie中获取的相关会话标头值,但是实现可能是不同。您需要与Web应用程序开发人员联系,以了解有关详细信息的更多信息。