loadrunner怎么取得DWR的dwr.engine. executejs中的scriptsessionid

java程序报错:Failed to find parameter: scriptSessionId,如何处理啊?_百度知道
java程序报错:Failed to find parameter: scriptSessionId,如何处理啊?
错误信息: 09:47:08,408 [http-9011-Processor19] WARN - Exception while processing batchjava.lang.IllegalArgumentException: Failed to find parameter: scriptSessionId
at org.directwebremoting.dwrp.Batch.extractParameter(Batch.java:91)
at org.directwebremoting.dwrp.Batch.&init&(Batch.java:59)
at org.directwebremoting.dwrp.CallBatch.&init&(CallBatch.java:46)
at org.directwebremoting.dwrp.BaseCallHandler.handle(BaseCallHandler.java:72)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:120)
at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:141)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
提问者采纳
参数错没参数Failed to find parameter: scriptSessionId(参数)sql候参数弄错
这个参数好像和dwr有关,而且没有调到后台的方法,纠结啊
有没有可能是页面上的这个节点错误呢?
不清楚啊,就是不知道那个地方有错,所以无从下手啊,而且这个错是偶尔才会出现的,不好捕捉。。。
有没有是session的问题,过期之类的?
恩,这个可能性也有,回头再看看吧,呵呵,快下班了,明天再搞吧,谢谢了
提问者评价
来自团队:
其他类似问题
为您推荐:
java程序的相关知识
其他1条回答
scriptSessionId字段找查.hbm.xml跟实体类字段应数据库没字段
有,都看过了,这个错误是偶尔会出现,大概十几次又一次出错吧,搞不明白为什么,页面显示也是正常的。。。
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁3613人阅读
JQuery@DWR(10)
出现这种错误 , 是由于 dwr 在发送 request 的时候, 其被 Struts2的 filter 拦截了
一般情况下是由于在 web.xml 中 Struts 的 url-pattern& 写成 * 了
--------------------
&&filter-mapping&&&&&&&& &filter-name&struts2&/filter-name&&&&&&&& &url-pattern&*&/url-pattern&&& &/filter-mapping&
=======================
正确的写法是如下: Struts 只是拦截指定类型的请求
在 web.xml 中:
&filter-mapping&
&filter-name&struts2&/filter-name&
&url-pattern&*.action&/url-pattern&
&/filter-mapping&
&servlet-mapping&
&servlet-name&dwr-invoker&/servlet-name&
&url-pattern&/dwr/*&/url-pattern&
&/servlet-mapping&
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1662999次
积分:22311
积分:22311
排名:第186名
原创:593篇
转载:134篇
评论:330条
文章:11篇
阅读:2000
(5)(5)(5)(13)(4)(2)(1)(1)(6)(4)(1)(1)(1)(3)(3)(1)(1)(1)(2)(1)(1)(2)(2)(2)(1)(8)(7)(7)(19)(5)(10)(3)(2)(4)(3)(5)(2)(3)(4)(4)(7)(3)(15)(18)(5)(7)(9)(3)(9)(8)(15)(22)(11)(7)(20)(7)(46)(56)(41)(23)(32)(60)(66)(48)(34)查看: 4439|回复: 3
LoadRunner9.5 无法获取dwr 的scriptSessionId
该用户从未签到
录下来的代码:
& &// 想用
& & web_reg_save_param(&sSessionId&,
& & & & & & & & &LB/IC=scriptSessionId=&,
& & & & & & & & &RB/IC=\\nc0-scriptName=&,
& & & & & & & & &Ord=1&,
& & & & & & & & &Search=ALL&,
& & & & & & & & &RelFrameId=1&,
& & & & & & & & LAST);
& & //来读取web_custom_request的scriptSessionId。但是发现 scriptSessionId是在post的时候发给服务器的,
& & //使用url模式也没看到这个值怎么来的。请问有办法关联这个scriptSessionId值吗?
& & & & web_custom_request(&focAction.getFlightView.dwr&,
& & & & & & & & &URL=http://{MyUrl}/dwr/call/plaincall/focAction.getFlightView.dwr&,
& & & & & & & & &Method=POST&,
& & & & & & & & &Resource=0&,
& & & & & & & & &RecContentType=text/javascript&,
& & & & & & & & &Referer=http://{MyUrl}/report/hardReportFlyAdd.do&,
& & & & & & & & &Snapshot=t46.inf&,
& & & & & & & & &Mode=HTML&,
& & & & & & & & &EncType=text/plain&,
& & & & & & & & &Body=callCount=1\npage=/report/hardReportFlyAdd.do\nhttpSessionId={JSessionID}\nscriptSessionId=XX##XXX##X##XX@@%%&&\nc0-scriptName=focAction\nc0-methodName=getFlightView\nc0-id=0\nc0-param0=string:\nc0-param1=string:CK221\nbatchId=1\n&, LAST);
TA的每日心情开心 11:26签到天数: 42 天连续签到: 1 天[LV.5]测试团长
这个ID肯定是在前台你访问的某个页面时,服务器返回给你的,从你描述的情况看,是你找错了URL
该用户从未签到
是放错地方了
是放错地方了,把扩展日志 的data returned by server 打开。从头放了一遍脚本,在日志里一搜 结果在login的时候 dwr就把sessionID返回了。
该用户从未签到
我最近也在用LR测试dwr框架,发现服务器返回的是origScriptSessionId,然后在后面加上了个随机数,才生成的ScriptSessionId,但却无法获得加了随机数之后的ScriptSessionId,不知道怎样解决这样的问题?
站长推荐 /4
小伙伴们踊跃闯关,赢取测试积点,换取豪礼,还等什么,赶快行动吧~
赏金公告:悬赏任务已,小伙伴们赶紧行动起来,赚取,去积点商城获取奖励吧!
了解自己的心里圈,学习不同的内容,让自己由内而外强大起来!
8年测试经验,有移动互联网等多个大型平台测试,最新项目大型移动电商平台测试经验。擅长:测试管理、项目管理、测试职业发展探索、测试方法论、持续集成、自动化测试、敏捷测试实践者。
Powered by当前访客身份:游客 [
这个人很懒,啥也没写
:引用来自“xiao木”的评论终于发现问题了,send方...
:引用来自“xiao木”的评论终于发现问题了,send方...
:引用来自“googlebrain”的评论你这文章写的到底...
:写的很详细,有没有demo可以下载,。执行Browser...
:引用来自“googlebrain”的评论你这文章写的到底...
:楼主好,我和问题和10楼一下。刷新receiver.jsp页...
:引用来自“googlebrain”的评论你这文章写的到底...
:你这文章写的到底对不对啊,为什么报找不到show ...
:DWR3使用Browser对象推送,推送时间和浏览器执行回...
:引用来自“andybruse”的评论楼主楼主,有两个问...
今日访问:3
昨日访问:12
本周访问:3
本月访问:138
所有访问:6720
DWR3.0框架入门(3) —— ScriptSession的维护及优化
发表于2年前( 08:38)&&
阅读(2830)&|&评论()
0人收藏此文章,
1.ScriptSession使用中存在的问题
& & &在上一节实现了服务器的推送功能,但是根据
ScriptSession的生命周期我们可以得出以下几点的问题:
(1)ScriptSession不会与HttpSession同时创建
当我们访问一个页面的时候,如果是第一次访问,就会创建一个新的HttpSession,之后再访问的时候,就会保持当前的Session,即使是刷新,也能保持当前的HttpSession。
但是,ScriptSession不同,第一次访问,会创建一个ScriptSession,但是,如果你刷新,就会创建一个新的ScriptSession.
(2)如何得到ScriptSession
在DWR中,我们可以通过WebContextFactory.get()来取得一个WebContext对象,进而通过WebContext的getScriptSession()取得ScriptSession对象。
但是要注意,在我们自定义的Servlet中,我们也可以通过WebContextFactory.get()来取得一个WebContext,但是这种方法却不能取得ScriptSession对象。因为,此WebContext对象其实不是通过DWR的上下文环境得到的,所以,就根本没有创建ScriptSession对象。
假设这种方式也能得到ScriptSession的话,那么我们实现“推”也就可以不局限在DWR的上下文环境中了,那么其灵活性就会大很多了。所以,这就是我们不能在Servlet中实现推的原因。
(3) 关于刷新就创建一个新的ScriptSession问题
&在我们需要推送的页面中,如果你刷新一下,那么就提交一个Http的request,此时,如果是第一次,那么就会创建一个httpSession对象,同时,请求由DwrServlet来处理后,就会创建一个ScriptSession.这个ScriptSession会和你的request请求的URI绑定放在一个由ScriptSessionManager维护的Map里面(这里面其实是一个URI对应的Set,在Set里面放置的是URI绑定的所有ScriptSession)。
当你刷新的时候,同样的一个HttpSession,却会创建一个新的ScriptSession,然后绑定到对应的URI上。
&(4)向所有的页面访问者推送 当我们想向所有的页面访问者推送的时候,我们只需要,取得所有的页面访问者,就可以“推”了。 如何取得所有的页面访问者?
DWR3.0可以通过
//得到所有ScriptSession
Collection&ScriptSession& sessions = Browser.getTargetSessions();
DWR2.x可以通过
Collection pages = webContext.getScriptSessionsByPage("/yourPage.jsp");
通过此方法,就可以实现调用客户端的javascript函数,实现对客户端的操作。
(5) 在上面的推送中产生的问题 上面的方法已经可以实现向所有的访问者推送。但是问题是,在客户端,如果用户刷新一次或多次,那么,Collection里面可能就保存了很多的无用的ScriptSession,所以不仅仅会影响性能问题,更重要的是,可能就不能实现你想要的功能。
2.如何管理有效的ScriptSession
& & &由于上面的问题,我们就需要自己管理ScriptSession。其实,有效地HttpSession,就是那个和当前的HttpSession匹配的ScriptSession。
所以,我们就可以自己维护一个Map,在这个Map里面,我们定义key就是HttpSession的Id,其值就是ScriptSession对象。
在每一次页面载入的时候,都去注册此ScriptSession,那么就会把新的ScriptSession绑定到httpSession上面了。
在DWR3.0中推出了 ScriptSessionListener用来监听ScriptSession的创建及销毁事件。我们可以使用该监听器来维护我们自己的Map。
在上一节的代码上修改Demo:
1.新建一个类实现
ScriptSessionListener接口
package sugar.
import java.util.C
import java.util.HashM
import java.util.M
import javax.servlet.http.HttpS
import org.directwebremoting.ScriptS
import org.directwebremoting.WebC
import org.directwebremoting.WebContextF
import org.directwebremoting.event.ScriptSessionE
import org.directwebremoting.event.ScriptSessionL
public class DWRScriptSessionListener implements ScriptSessionListener {
//维护一个Map key为session的Id, value为ScriptSession对象
public static final Map&String, ScriptSession& scriptSessionMap = new HashMap&String, ScriptSession&();
* ScriptSession创建事件
public void sessionCreated(ScriptSessionEvent event) {
WebContext webContext = WebContextFactory. get();
HttpSession session = webContext.getSession();
ScriptSession scriptSession = event.getSession();
scriptSessionMap.put(session.getId(), scriptSession);
//添加scriptSession
System. out.println( "session: " + session.getId() + " scriptSession: " + scriptSession.getId() + "is created!");
* ScriptSession销毁事件
public void sessionDestroyed(ScriptSessionEvent event) {
WebContext webContext = WebContextFactory. get();
HttpSession session = webContext.getSession();
ScriptSession scriptSession = scriptSessionMap.remove(session.getId());
//移除scriptSession
System. out.println( "session: " + session.getId() + " scriptSession: " + scriptSession.getId() + "is destroyed!");
* 获取所有ScriptSession
public static Collection&ScriptSession& getScriptSessions(){
return scriptSessionMap.values();
2.新建一个类继承
DefaultScriptSessionManager,用来绑定
DWRScriptSessionListener
package sugar.
import org.directwebremoting.impl.DefaultScriptSessionM
public class DWRScriptSessionManager extends DefaultScriptSessionManager {
public DWRScriptSessionManager(){
//绑定一个ScriptSession增加销毁事件的监听器
this.addScriptSessionListener( new DWRScriptSessionListener());
System. out.println( "bind DWRScriptSessionListener");
3.在web.xml中将
DWRScriptSessionManager
dwr-invoker servlet中
&init-param&
&param-name &org.directwebremoting.extend.ScriptSessionManager &/param-name&
&param-value &sugar.dwr.DWRScriptSessionManager &/param-value&
&/init-param&
这样在服务器启动时即会绑定
ScriptSessionListener,
ScriptSession在创建时会自动添加到我们维护的Map中
4.通过以下方法获取所有的
ScriptSession
//得到所有ScriptSession
Collection&ScriptSession& sessions = DWRScriptSessionListener.getScriptSessions();
ScriptSessionFilter过滤
& & &如果我们不想要给所有的客户端
推送消息,只想给特定的客户端推送,那么我们可以使用
ScriptSessionFilter来实现。在filter中去判定session中的Attribute值是不是我们给定的。
1.使用以下方法推送消息
//执行推送
Browser.withAllSessionsFiltered(filter, run);
//注意这里调用了有filter功能的方法
2.通过参数可知我们需要一个
ScriptSessionFilter对象,此时send的方法改写成如下:
public void send(final String content){
ScriptSessionFilter filter = new ScriptSessionFilter() {
public boolean match(ScriptSession scriptSession) {
String tag = (String)scriptSession.getAttribute("tag" );
System. out.println(tag);
return "receiverTag" .equals(tag);
Runnable run = new Runnable(){
private ScriptBuffer script = new ScriptBuffer();
public void run() {
//设置要调用的 js及参数
script.appendCall( "show", content);
//得到所有ScriptSession
Collection&ScriptSession& sessions = DWRScriptSessionListener.getScriptSessions();
//遍历每一个ScriptSession
for (ScriptSession scriptSession : sessions){
scriptSession.addScript( script);
//执行推送
Browser. withAllSessionsFiltered(filter, run);
//注意这里调用了有filter功能的方法
3.在打开jsp页面时需要在
ScriptSession
中注入设定的attribute,MessagePush中的方法
public void onPageLoad(final String tag){
//获取当前的ScriptSession
ScriptSession scriptSession = WebContextFactory.get().getScriptSession();
scriptSession.setAttribute( "tag", tag);
System. out.println( "setAttribute");
4.在jsp中调用该方法
&script type= "text/javascript"&
//这个方法用来启动该页面的ReverseAjax功能
dwr.engine.setActiveReverseAjax( true);
//设置在页面关闭时,通知服务端销毁会话
dwr.engine.setNotifyServerOnPageUnload( true);
var tag = "receiverTag";
//自定义一个标签
messagePush.onPageLoad(tag);
//这个函数是提供给后台推送的时候 调用的
function show(content){
$( "#content").text(content);
&/script &
这样我们可以给不同客户端的jsp中导入不同的tag值,过滤推送的客户端
更多开发者职位上
1)">1)">1" ng-class="{current:{{currentPage==page}}}" ng-repeat="page in pages"><li class='page' ng-if="(endIndex<li class='page next' ng-if="(currentPage
相关文章阅读6802人阅读
loadrunner(3)
我的测试(27)
一.loadrunner自动关联验证码
1.将loadrunner菜单栏的TOOLS-&Recording Options-&Enable correlation during recording,设置为选择
2.开始录制,录制过程中loadrunner会自动关联,以下是录制首页登录时验证码关联的部分脚本
vuser_init()
&& //设置关联返回&#20540;存放的参数的最大长度
&web_set_max_html_param_len(&1024&);&&&
& //关联名称和对应&#20540;
&&&&&&&&&&&&
&&&&/* Registering parameter(s) from source task id 226&&
&// {Siebel_Analytic_ViewState2} = &/wEPDwUKMTM1MjA2MDk2OA9kFgICAw9kFggCAw8PZBYEHgdPbkZvY3VzBRVvcGVuQm9yZGVyU3R5bGUodGhpcykeBk9uQmx1cgUWY2xvc2VCb3JkZXJTdHlsZSh0aGlzKWQCBw8PZBYEHwAFFW9wZW5Cb3JkZXJTdHlsZSh0aGlzKR8BBRZjbG9zZUJvcmRlclN0eWxlKHRoaXMpZAILDw9kFgQfAAUVb3BlbkJvcmRlclN0eWxlKHRoaXMpHwEFFmNsb3NlQm9yZGVyU3R5bGUodGhpcylkAg8PEA8WBh4NRGF0YVRleHRGaWVsZAUEanNtYx4ORGF0YVZhbHVlRmllbGQFBGpzeGgeC18hRGF0YUJvdW5kZ2QQFQgPPT096K&#43;36YCJ5oupPT09CeeuoeeQhuWRmAblrabnlJ8G5a626ZW/CeePreS4u&#43;S7uxvnoJTnqbbmgKflrabkuaDmjIflr7zmlZnluIgY56S&#43;5Lya5a6e6Le15oyH5a&#43;85pWZ5biIGOekvuWMuuacjeWKoeaMh&#43;WvvOaVmeW4iBUIAi0xATABMQEyATQBNQE2ATcUKwMIZ2dnZ2dnZ2dkZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAwUMcmFkVmlld1R5cGUxBQxyYWRWaWV3VHlwZTIFDHJhZFZpZXdUeXBlMipm08V/zsZ9rrfYgzFqadEHfv2f&
&web_reg_save_param(&Siebel_Analytic_ViewState2&,
&&&LB/IC=ViewState/& value=/&&,
&&&RB/IC=/&&,
&&&Ord=1&,
&&&Search=Body&,
&&&RelFrameId=1&,
&web_url(&default.aspx&,&
& ..........
&return 0;
3.submitAction中 ,关联部分脚本入红色字体
web_submit_data(&default.aspx_2&,
&&&Action=http://192.168.1.10/xxb/default.aspx&,
&&&Method=POST&,
&&&RecContentType=text/html&,
&&&Referer=http://192.168.1.10/xxb/default.aspx&,
&&&Snapshot=t10.inf&,
&&&Mode=HTML&,
&&ITEMDATA,
&&&Name=__VIEWSTATE&, &Value={Siebel_Analytic_ViewState2}&, ENDITEM,
<span style="color:#.自动关联成功
二.手动关联sessionid
这几天录制脚本发现自动关联不是万能的。设置loadrunner自动关联,录制的脚本回放成功但是参数化后运行时不成功。仔细分析后是关联部分数据——sessionID关联的设置的不正确,只好进行手动关联。
将loadrunner菜单栏的TOOLS-&Recording Options-&Enable correlation during recording,设置为不勾选,然后重新录制脚本。回放脚本,成功后切换到tree模式,点击coreelation&
scan& 按钮执行coreelation操作,loadrunner扫描出需关联的部分(有些是需要关联的有些是不需要关联的,根据实际情况选择关联)。
但是coreelation scan 也并不能扫描出所有想要的关联,本人是通过另外一种方法解决的。在tree模式下,查看response和request信息,然后选中需要关联的数据点击右键弹出菜单,选择create coreelation&也可创建关联(该操作需要知道哪些数据需要关联)。如下图。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:141976次
积分:1868
积分:1868
排名:第13525名
原创:44篇
评论:32条
(6)(2)(1)(1)(1)(2)(5)(1)(2)(3)(2)(8)(7)(2)(2)(7)

我要回帖

更多关于 dwr scriptsessionid 的文章

 

随机推荐