测试问题——jmeter from-data上传文件不成功解决方案


通过postman是一直能成功的,但是放到jmeter中一直报错,一定要选择高级,设置 客户端实现-Java

如下postman成功:

jmeter报错1:

org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.handleParseFailure(StandardMultipartHttpServletRequest.java:123), org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:114), org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.(StandardMultipartHttpServletRequest.java:87), org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:87), org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1176), org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1011), org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942), org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005), org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908), javax.servlet.http.HttpServlet.service(HttpServlet.java:661), org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882), javax.servlet.http.HttpServlet.service(HttpServlet.java:742), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61), org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108), org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)]

jmeter报错2:[com.woodutech.core.riskcontrol.controller.OssControl.uncompressData(OssControl.java:134), com.woodutech.core.riskcontrol.controller.OssControl$$FastClassBySpringCGLIB$$f674b6ee.invoke(), org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218), org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749), org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163), org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47), org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93), org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688), com.woodutech.core.riskcontrol.controller.OssControl$$EnhancerBySpringCGLIB$$d208e1bd.uncompressData(), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.lang.reflect.Method.invoke(Method.java:498), org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190), org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138), org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104), org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892), org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)]

jmeter的解决方案如下 红色框设置

1,勾选form-data,MM类型根据文件类型选择合理的种类

 一定要选择高级,设置 客户端实现-Java

 最后对MIME类型说明
每个MIME类型由两部分组成,前面是数据的大类别,例如声音audio、图象image等,后面定义具体的种类

常用类型
数据的大类别 具体的种类
.doc application/msword
.docx application/
vnd.openxmlformats-officedocument.wordprocessingml.document
.pdf application/pdf
.xls application/vnd.ms-excel application/x-excel
.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.ppt application/vnd.ms-powerpoint
.pptx application/
vnd.openxmlformats-officedocument.presentationml.presentation
.txt text/plain
.png image/png