起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5049|回复: 1

[处理中3] 链接mysql报错的问题

[复制链接]

146

主题

589

帖子

1642

积分

金牌会员

Rank: 6Rank: 6

积分
1642
QQ
发表于 2020-3-25 10:57:58 | 显示全部楼层 |阅读模式
版本: 小版本号:
数据库: 服务器操作系统: 应用服务器:
客户端操作系统: 浏览器:
平台链接一个msql数据库,acction代码如下

         int i;
        java.sql.Connection conn;
        //字符串截取
                           
                conn = com.justep.model.ModelUtils.getConnection("/DianShangTongZhi/PingTai/data");               //更改数据源
                //java.sql.CallableStatement proc = conn.prepareCall("{ call L_SCGL_GWDF(?,?,?,?,?,?,?,?,?) }");   //更改ACCTION名
                java.sql.PreparedStatement proc=conn.prepareStatement("select count(*) from c_shop_cart where customer_id='a3b225ce-1afe-47d3-99df-5eed32874d40'");
               /*
                proc.setString(1, smo);                                                                     //输入参数            
                proc.setString(2, emo);            
                proc.setString(3, ys);
                proc.setString(4, yt);
                proc.setString(5, hc);
                proc.setString(6, name);
                proc.setInt(7, qsid);
                proc.setInt(8, top);
                proc.setString(9, ryid);
                */
                ResultSet rt = proc.executeQuery();
                rt.next();
                //rt.getString(1);得到文本数据
               i=rt.getInt(1);
                System.out.println(i);
               
                if (i>0)
                {
                      DingTalkClient clienta = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
                      OapiGettokenRequest requesta = new OapiGettokenRequest();
                      requesta.setCorpid("dingb72ffe32c6e2bb1735c2f4657eb6378f");
                      requesta.setCorpsecret("m2koTKcWOVZ9N489wJRKOWyJuUx_oyhNcNwxMhQhCAAus1zLAGztmfYDUHvmU-Lf");
                      requesta.setHttpMethod("GET");
                      OapiGettokenResponse responsea = clienta.execute(requesta);//对应throws  ApiException,声明中增加了一个单词
                      String sack = responsea.getAccessToken();  // 声明并初始化字符串 s
                                       
                     
                        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");

                        OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request();
                       
                        request.setUseridList("015816530721452593,015816530721452593");
                        request.setAgentId((long) 343857980);
                        request.setToAllUser(false);
                        OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
                        msg.setMsgtype("text");
                        msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
                        msg.getText().setContent("购物车中有需要付款的产品,请及时付款或清空购物车");
                        request.setMsg(msg);
                       OapiMessageCorpconversationAsyncsendV2Response response = client.execute(request,sack);
                     
                    
                }


链接字符串

<Resource name="gonglaoda" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://**.**.**.**:3306/gonglaoda" username="root" password="***" maxActive="10" maxIdle="5"/>

问题现象描述
mysql使用navicatelevation工具链接,查询一次也没有发生报错、链接错误的情况。
但使用b5平台做的功能新打开界面,第一次执行程序的时候时常(不是每次)都发生链接错误、报错。使用提示如下
2020-03-25 10:48:40 excute stream action, params:{executeContext=, action=FuKuanTiXing_Yang, parameters={}, executor=PSN01, activity=mainActivity, process=/DianShangTongZhi/PingTai/process/TiSh_FuKuan/tiSh_FuKuanProcess, translateParameter=null, actionFlag=__action_0__}
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.justep.system.action.Engine.invokeActions(Native Method)
    at com.justep.system.action.Engine.invokeActions(Unknown Source)
    at com.justep.business.server.BusinessServer.doAction(Unknown Source)
    at com.justep.business.server.BusinessServer.doExcute(Unknown Source)
    at com.justep.business.server.BusinessServer.excute(Unknown Source)
    at com.justep.business.server.BusinessServerServlet.execService(Unknown Source)
    at com.justep.business.server.BusinessServerServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at com.justep.x.bs.BusinessServerServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    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:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:595)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Connection reset by peer: socket write error


   
   
   

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35918
发表于 2020-3-25 11:16:55 | 显示全部楼层
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-4-27 17:12 , Processed in 0.065607 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表