|
版本: |
|
小版本号: |
|
|
|
数据库: |
|
服务器操作系统: |
|
应用服务器: |
|
客户端操作系统: |
|
浏览器: |
|
|
|
平台链接一个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
|
|