您的位置:程序门 -> websphere ->



求救:关于mq连接报错2059(应用程序错误)的问题?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


求救:关于mq连接报错2059(应用程序错误)的问题?
发表于:2007-06-29 11:24:37 楼主
问题是我在程序中做了一个线程监测与mq服务器的连接,一旦连接中断则重新连接,但是在现成运行的过程中,偶尔会报2059:应用程序错误,不知道为什么,应该不是连接数已满的问题,请大侠们帮助解决一下,源代码如下:
while   (conn_flag   &&   !isrunning)
                        {
                                try
                                {
                                        //线程正在运行
                                        isrunning   =   true;
                                        //if   (count   ==   short.maxvalue   -   1)
                                        //{
                                        //         count   =   0;
                                        //}
                                        //mqmanager.connqueuemanager();
                                        mqmanager.initiate();
                                        try
                                        {
                                                count   =   count   +   1;
                                        }
                                        catch   (exception   ex)
                                        {
 
                                        }
                                        try
                                        {
                                                srv.writeln(count.tostring());
                                        }
                                        catch   (exception   ex1)
                                        {
 
                                        }
                                        //若连接成功则跳出循环,线程不再运行
                                        //this.conn_flag   =   true;
                                        //线程取得正常的运行结果,不需要再次运行
                                        isrunning   =   false;
                                        try
                                        {
                                                thread.sleep(1   *   1000);
                                        }
                                        catch   (exception   ex2)
                                        {
 
                                        }
                                        if   (count   ==   1)
                                        {
                                                globalvariable.setglobalvariable( "mq ",   mqmanager);
                                                srv.writeln( "连接mq服务器成功!可以进行读写操作! ");
                                                globalvariable.writeeventlog( "mq ",   "连接mq服务器成功 ",   eventlogentrytype.information);
                                                string   auto   =   srv.configuration[ "autorun "];
                                                if   (bool.parse(auto))
                                                {
                                                        listhread   =   new   theadmanager( "rcvmq ");
                                                        listhread.startlisten();
                                                        globalvariable.setglobalvariable( "listenthread ",   listhread);
                                                }
                                                if   (globalvariable.getglobalvariable( "player ")   !=   null)
                                                {
                                                        //停止报警
                                                        //soundplay   play   =   (soundplay)globalvariable.getglobalvariable( "player ");
                                                        //play.stopplay();
                                                }
                                                this.iscatch   =   true;
                                        }

                                }
                                //以下为对连接过程中出现异常的处理
                                catch   (mqexception   ex)
                                {
                                        count   =   0;                                        
                                        if   (globalvariable.getglobalvariable( "mq ")   !=   null)
                                        {
                                                globalvariable.remove( "mq ");
                                        }
                                        //modify-07-04-19
                                        //if   (globalvariable.getglobalvariable( "ims ")   !=   null)
                                        //{
                                        //         globalvariable.remove( "ims ");
                                        //}                                        
                                        if   (!iscatch)
                                        {
                                                globalvariable.writeeventlog( "mq ",   "连接mq服务器异常     "   +   "异常代码 "   +   ex.reasoncode.tostring()   +   "异常信息 "   +   ex.message,   eventlogentrytype.failureaudit);
                                                player   =   (soundplay)globalvariable.getglobalvariable( "player ");
                                                if   (player   !=   null)
                                                {
                                                        player.playsound();
                                                }
                                                this.iscatch   =   true;
                                        }
                                        try
                                        {
                                                //出现异常关闭监听线程
                                                theadmanager   thread   =   (theadmanager)globalvariable.getglobalvariable( "listenthread ");
                                                if   (thread   !=   null)
                                                {
                                                        thread.closelisten();
                                                }
                                        }
                                        catch
                                        {
                                                srv.writeln( "监听线程未启动 ");
                                        }

                                        string   name   =   thread.currentthread.name;
                                        //srv.writeln( "连接mq服务器的过程中出现异常,请查看日志!日志位置位于安装目录下mq文件夹下 "+ex.tostring());
                                        switch   (ex.reasoncode)
                                        {
                                                //连接断开
                                                case   2009:
                                                //队列管理者无效或未知
                                                case   2058:
                                                //队列管理者无效
                                                case   2059:
                                                //意外的错误发生
                                                case   2195:
                                                //服务器正在启动
                                                case   2161:
                                                //服务器正在关闭
                                                case   2162:
                                                        //阻塞线程三秒,之后重新连接,重复3次,如果连接不上,置空
                                                        //for   (int   i   =   0;   i   <   3;   i++)
                                                        {
                                                                srv.writeln( "正在重新连接mq服务器!若没有恢复请及时联系mq服务器管理员! "   +   ex.tostring());

                                                                //线程十秒后再次运行
                                                                thread.sleep(5   *   1000);
                                                                fm   =   new   filemanager( "mq\\mqlog.log ");
                                                                fm.writestringtofile(datetime.now.tostring()   +   "             连接mq服务器的过程中出现问题     "   +   ex.message.tostring()   +   "错误代码: "   +   ex.reasoncode   +   "错误提示: "   +   ex.tostring());
                                                                fm.closestreamwriter();
                                                        }
                                                        //线程一次运行已经结束,但未得到预期的结果,需要再次运行
                                                        isrunning   =   false;
                                                        conn_flag   =   true;
                                                        mqmanager.setqueuemanager(null);
                                                        break;
                                                //无权访问服务器队列管理者
                                                case   2035:
                                                        //线程不需要再次运行,直接写入日志文件,并报警
                                                        conn_flag   =   false;
                                                        fm   =   new   filemanager( "mq\\mqlog.log ");
                                                        fm.writestringtofile(datetime.now.tostring()   +   "           无权访问mq服务器队列管理者     "   +   ex.message.tostring()   +   "错误代码: "   +   ex.reasoncode);
                                                        fm.closestreamwriter();
                                                        mqmanager.setqueuemanager(null);
                                                        break;
                                                //其他异常
                                                default:
                                                        //线程不需要再次运行,直接写入日志文件,并报警
                                                        conn_flag   =   true;
                                                        fm   =   new   filemanager( "mq\\mqlog.log ");
                                                        fm.writestringtofile(datetime.now.tostring()   +   "           连接mq服务器的过程之中出现未知的异常     "   +   ex.message.tostring()   +   "错误代码: "   +   ex.reasoncode);
                                                        fm.closestreamwriter();
                                                        mqmanager.setqueuemanager(null);
                                                        break;
                                        }
                                }
                                finally
                                {
                                        //关闭mq服务器队列管理器
                                        mqmanager.closemanager();
                                }
发表于:2007-06-29 11:30:281楼 得分:0
如果有用c#开发mq程序的可以交流一下,qq283633218   白天在线
发表于:2007-06-29 11:42:452楼 得分:0
这是我在事件日志查看器中查看到的日志

远程通道当前不可用。    

因通道   'rcvmq.chl '   当前在远程系统上不可用,通道程序已终止。这可能是因为该通   道是禁用的或远程系统没有足够的资源来运行另外的通道。    

检查远程系统以确保通道是可用于运行的,然后重试该操作。
发表于:2007-06-29 17:27:153楼 得分:0
http://bbs.chinaunix.net/viewthread.php?tid=833625&extra=&page=2
参考这篇文章
发表于:2007-07-03 21:51:284楼 得分:0
2059
queue   manager   not   available   for   connection.  
corrective   action:   ensure   that   the   queue   manager   has   been   started.   if   the   connection   is   from   a   client   application,   check   the   channel   definitions.  
发表于:2007-08-20 13:48:485楼 得分:0
2059     0x0000080b     mqrc_q_mgr_not_available
可能是活动通道连接数量超过上限,可以通过修改ini配置文件,增大连接数


快速检索

最新资讯
热门点击