接口调用一会正常,一会失败

       刚开始这个问题困扰了我很久,后面才发现接口平台用了两台zookeeper集群来处理我这个接口,但是其中有一个zookeeper集群部分配置已经过期了,经过部分权限的申请并重新开通权限后,我们的接口调用终于恢复正常了!(写的比较简捷,见谅!)

展开阅读全文

jsp运行时一个郁闷问题,一会成功,一会失败

11-10

怎么说呢,这个问题很郁闷,我运行JSP页面,调用后台两个简单的JAVA类。rn有时候成功,有时候有异常....rn异常占多数...我实在受不了了,我把JAVA代码贴出来,请大家帮帮忙看看~rn[code=Java]package rong.web;rnrnimport java.sql.Connection;rnimport java.sql.DriverManager;rnimport java.sql.ResultSet;rnimport java.sql.ResultSetMetaData;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnimport java.util.Hashtable;rnimport java.util.Vector;rnrnpublic class Access_db rn String name = "root";rnrn String password = "root";rnrn String url = "jdbc:mysql://localhost:3306/rtalk";rnrn Connection dbcon = null;rnrn Statement stmt = null;rnrn ResultSet rs = null;rnrn static Access_db ac_db = null;rnrn public Access_db() throws ClassNotFoundException, SQLException rn if (dbcon == null) rn Class.forName("com.mysql.jdbc.Driver");rn dbcon = DriverManager.getConnection(url, name, password);rn rn rn rn public static Access_db getInstance() rn try rn ac_db = new Access_db();rn catch (ClassNotFoundException e) rn e.printStackTrace();rn System.out.print("连接出错!");rn catch (SQLException e) rn e.printStackTrace();rn System.out.print("连接第二步出错!");rn rn return ac_db;rn rn //这一次调用是用到下面这个函数的时候报错~ rn public boolean exeSql(String Sql) rn try rn stmt = dbcon.createStatement();rn stmt.executeUpdate(Sql);//单步运行到这的时候,eclipse居然说找不到源;源代码连接不包含文件Connenction.class的源代码;然后叫我点击“更改已连接的源代码”来更改源代码连接rn return true;rn catch (SQLException e) rn System.out.print("exeSql error!");rn return false;rn rnrn rnrn public ResultSet Query(String Sql) rn try rn stmt = dbcon.createStatement();rn rs = stmt.executeQuery(Sql);rn catch (SQLException e) rn e.printStackTrace();rn System.out.print("Query error!");rn // System.out.print(Sql);rn rs = null;rn rn return rs;rn rnrn public Vector QueryVet(String Sql) rn Vector vet = null;rn try rn stmt = dbcon.createStatement();rn rs = stmt.executeQuery(Sql);//以前调用这个函数的时候会rn ResultSetMetaData meta = rs.getMetaData();rn while (rs.next()) rn Hashtable hash = new Hashtable();rn for (int i = 0; i < meta.getColumnCount(); i++) rn hash.put(meta.getColumnName(i + 1).toLowerCase(), rsrn .getString(i + 1) == null ? "" : rsrn .getString(i + 1));rn rn vet.add(hash);rnrn rn catch (Exception e) rn System.out.print("VET异常!");rn rn return vet;rn rnrn[/code]rnrn但是我用这个代码也完成过一些简单的工程啊?rn到底是什么原因?希望大家帮帮忙。rnrn不知道怎么发图,要是哪边我表述不清楚的告诉我一下!rn真的谢谢了 论坛

没有更多推荐了,返回首页