使用jmeter测试jsf spring应用程序ajax请求

时间:2011-08-10 19:40:18

标签: ajax jsf jmeter

我正在使用j meter来检查从客户端按下a4j按钮到服务器答案所需的时间。

为了实现这一点,我使用fiddler打开了一个HTTP请求,并查找:

  1. ajax请求对其进行解码并将其插入http头中的值?
  2. 我还应该插入什么才能发送请求? sessionID?如何将其插入http标头?
  3. 我在运行Tomcat的同一台机器上运行它,我可以在我的Eclipse记录器中看到我进入正确的页面,但是没有按下按钮,有人可以帮助我。

    这是我在Eclipse中获得的记录器:

    2011-08-17 09:52:32,673 ERROR [_ErrorPageWriter] An exception occurred
    javax.faces.FacesException: javax.crypto.BadPaddingException: Given final block not properly padded
        at org.apache.myfaces.shared_impl.util.StateUtils.symmetric(StateUtils.java:456)
        at org.apache.myfaces.shared_impl.util.StateUtils.symmetric(StateUtils.java:494)
        at org.apache.myfaces.shared_impl.util.StateUtils.decrypt(StateUtils.java:294)
        at org.apache.myfaces.shared_impl.util.StateUtils.reconstruct(StateUtils.java:243)
        at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getSavedState(HtmlResponseStateManager.java:187)
        at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getTreeStructureToRestore(HtmlResponseStateManager.java:151)
        at org.ajax4jsf.application.AjaxStateManager.restoreLogicalViewId(AjaxStateManager.java:564)
        at org.ajax4jsf.application.AjaxStateManager.restoreStateFromSession(AjaxStateManager.java:495)
        at org.ajax4jsf.application.AjaxStateManager.restoreView(AjaxStateManager.java:444)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:515)
        at org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:107)
        at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:85)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:151)
        at org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:103)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
        at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.coral.project.web.context.ExecutionContextFilter.doFilter(ExecutionContextFilter.java:75)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
    Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA13*..)
        at javax.crypto.Cipher.doFinal(DashoA13*..)
        at org.apache.myfaces.shared_impl.util.StateUtils.symmetric(StateUtils.java:452)
        ... 40 more
    

    编辑:我认为这可能有助于解决我的问题:

    enter image description here

1 个答案:

答案 0 :(得分:1)

如果您不确定您的AJAX调用要求成功,最简单的方法是使用HTTP代理并记录操作。这将为您提供传递给服务器的所有参数,以及它们在记录时的值。

然后,在适当的情况下,使参数值动态化(sessionID就是一个很好的例子)。

How to record