java中访问mysql 出现 communications link failure

项目中一条很简单的select 语句:select coulmn1,coulmn2,coulmn3 from table where coulmn1 != 2;
一直都没有问题,table中也就20来条数据,今天项目启起来忽然出现:

org.springframework.dao.RecoverableDataAccessException:

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.

The error may exist in URL [jar:file:/D:/IDEA%20work/yohobuy-crm/web/target/yohobuy-crm-web/WEB-INF/lib/yohobuy-crm-dal-1.0.0-SNAPSHOT.jar!/META-INF/mybatis/PushTemplateMapper.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: SELECT content_type, push_template_id, push_template_title, push_template_content, push_template_herf, status, create_time, update_time, create_user_id,model_type,model_param FROM push_template WHERE status!=2

Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.
; SQL []; Communications link failure

The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:98)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy20.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy76.selectAllPushTemplate(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)

然后我把这句sql改成: select coulmn2, coulmn1,coulmn3 from table where e coulmn1
!= 2就可以。就是说这句sql稍微一点点改动就行,就是原来的不行,没理由啊,这是什么原因啊,大侠们有遇到的的吗?在线等!

1个回答

使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误:
Communications link failure,The last packet successfully received from the server was *** millisecond ago.The last packet successfully sent to the server was *** millisecond ago。
其中错误还会提示你修改wait_timeout或是使用Connector/J的autoReconnect属性避免该错误。
,大部分都是使用连接池方式时才会出现这个问题,短连接应该很难出现这个问题。这个问题的原因:
mysql服务器默认的“wait_timeout”是28800秒即8小时,意味着如果一个连接的空闲时间超过8个小时,MySQL将自动断开该连接,而连接池却认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就会导致上面的报错。
修改MySQL的参数,wait_timeout最大为31536000即1年,在my.cnf中加入:
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000
重启生效,需要同时修改这两个参数。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Java编程连接数据库Communications link failure,有代码求帮忙啊
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.Date; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; public class TeachSearchInfo extends JPanel implements ActionListener { private JLabel []jlArray={new JLabel("学号"),new JLabel("姓名"), new JLabel("性别"),new JLabel("出生日期"),new JLabel("年"), new JLabel("月"),new JLabel("日"),new JLabel("籍贯"), new JLabel("学院"),new JLabel("专业"),new JLabel("班级"), new JLabel("入学时间"),new JLabel("年"), new JLabel("月"),new JLabel("日")}; private JLabel jl=new JLabel("请输入要查询学生的学号"); private JTextField jtf=new JTextField(); private JButton jb=new JButton("查询"); //创建存放信息的jl数组 private JLabel []jlArray2=new JLabel[13]; private String host; public TeachSearchInfo(String host){ this.host=host; initialFrame(); addActionListener(); } public void initialFrame(){ this.setLayout(null); jl.setBounds(30, 20, 150, 30); this.add(jl); jtf.setBounds(200, 20, 100, 30); this.add(jtf); jb.setBounds(310, 20, 30, 30); this.add(jb); } public void addActionListener(){ jb.addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource()==jb){ String stu_id=jtf.getText(); if(stu_id.equals("")){ JOptionPane.showMessageDialog(this, "请输入学号", "错误", JOptionPane.ERROR_MESSAGE); return; }else{ String []baseinfo=getStuBaseInfo(stu_id,host); for(int i=0;i<13;i++){ System.out.println(baseinfo[i]); } } } } public String[] getStuBaseInfo(String stu_id,String host) { // TODO Auto-generated method stub String []message=new String[13]; Connection conn; Statement stmt; ResultSet rs; try{ Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection("jdbc:mysql://"+host+"/test"); stmt=conn.createStatement(); String sql="select stu_id,stu_name,stu_gender,stu_birth,nativeplace,"+ "coll_name,dept_name,class_name,cometime from student,dept,college,"+ "class where stu_id='"+stu_id+"' and student.coll_id=college.coll_id"+ " and student.dept_id=dept.dept_id and student.class_id=class.class_id"; rs=stmt.executeQuery(sql); if(rs.next()){ message[0]=rs.getString(1); message[1]=new String(rs.getString(2).getBytes("ISO-8859-1")); message[2]=new String(rs.getString(3).getBytes("ISO-8859-1")); Date stu_birth=rs.getDate(4); message[3]=stu_birth.getYear()+1900+""; message[4]=stu_birth.getMonth()+1+""; message[5]=stu_birth.getDate()+""; message[6]=new String(rs.getString(5).getBytes("ISO-8859-1")); message[7]=new String(rs.getString(6).getBytes("ISO-8859-1")); message[8]=new String(rs.getString(7).getBytes("ISO-8859-1")); message[9]=new String(rs.getString(8).getBytes("ISO-8859-1")); Date cometime=rs.getDate(9); message[10]=cometime.getYear()+1900+""; message[11]=cometime.getMonth()+1+""; message[12]=cometime.getDate()+""; } if(rs!=null) { rs.close(); } if(stmt!=null) { stmt.close(); } if(conn!=null) { conn.close(); } }catch (Exception e){ e.printStackTrace(); } return message; } //cs public static void main(String[] args){ TeachSearchInfo ts=new TeachSearchInfo("127.0.0.1:3036"); JFrame jf=new JFrame(); jf.add(ts); jf.setBounds(10,10,700,650); jf.setVisible(true); } } 报错信息如下: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2103) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:207) at TeachSearchInfo.getStuBaseInfo(TeachSearchInfo.java:83) at TeachSearchInfo.actionPerformed(TeachSearchInfo.java:65) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6216) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5981) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4583) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4413) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2475) at java.awt.Component.dispatchEvent(Component.java:4413) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at java.net.Socket.<init>(Socket.java:366) at java.net.Socket.<init>(Socket.java:209) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:253) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2026) ... 38 more null null null null null null null null null null null null null
hive Communications link failure
在hive链接mysql作为数据源的过程中,配置conf下的hive-site.xml 文件, hive是装在Hadoop集群的master上,ip地址是192.168.1.154. mysql直接使用的sudo apt-get install mysql-server 安装的。 使用netstat -nat 显示: 结果如下:![图片说明](https://img-ask.csdn.net/upload/201504/27/1430139457_697441.png) 然后我的hive 配置文件是:![图片说明](https://img-ask.csdn.net/upload/201504/27/1430139550_239328.jpg) 把ip地址换成localhost或者127.0.0.1 hive下 show tables;正确,换成本机ip 就是错的。就会出现:![图片说明](https://img-ask.csdn.net/upload/201504/27/1430139661_682999.png) 怎么解决一下?
写了一个propertie配置文件,测试的时候曝出 Communications link failure错误
``` ```本人正在学习中,然后跟着教程写了一个连接数据库的properties配置文件,测试的时候发现报错Communications link failure。 搜了一些问答 例如修改wait_timeout的我也做了 ![图片说明](https://img-ask.csdn.net/upload/201906/21/1561087418_663225.png) 再试还是这样,又担心是不是版本不匹配,检查了一遍也没看出问题,下面把我的配置和代码贴出来,希望有哪位大佬不吝举手之劳帮我看看问题 这是我的jar包 ``` mysql-connector-java-5.1.37-bin.jar commons-dbutils-1.6.jar ``` 报错: ```java.io.BufferedInputStream@15db9742 Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure ``` 测试代码如下: ```public class PropertiesDemo { public static void main(String[] args) throws Exception { //使用类的加载器 InputStream in = PropertiesDemo.class.getClassLoader().getResourceAsStream("database.properties"); System.out.println(in); Properties pro = new Properties(); pro.load(in); //System.out.println(pro); String driverClass = pro.getProperty("driverClass"); String url = pro.getProperty("url"); String username = pro.getProperty("username"); String password = pro.getProperty("password"); Class.forName(driverClass); Connection con = DriverManager.getConnection(url, username, password); System.out.println(con); ``` 后面我不信邪又另外测试了下: ``` import java.sql.Connection; import java.sql.SQLException; import org.apache.commons.dbutils.QueryRunner; public class Test3 { public static void main(String[] args) { insert(); } public static void insert(){ try { //获取一个用来执行SQL语句的对象 QueryRunner QueryRunner qr = new QueryRunner(); String sql = "INSERT INTO zhangwu(name,money,parent) VALUES(?,?,?)"; Object[] params = {"股票收入", 5500, "收入"}; Connection conn = JDBCUtils.getConnection(); int line = qr.update(conn,sql,params);// 用来完成表数据的增加、删除、更新操作 //结果集处理 System.out.println("line = " + line); } catch (SQLException e) { throw new RuntimeException(e); } } } ``` 报错: ``` Exception in thread "main" java.lang.ExceptionInInitializerError at com.itheima_dbutils.Test3.insert(Test3.java:19) at com.itheima_dbutils.Test3.main(Test3.java:10) Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: database.properties (系统找不到指定的文件。) at com.itheima_dbutils.JDBCUtils.<clinit>(JDBCUtils.java:28) ... 2 more Caused by: java.io.FileNotFoundException: database.properties (系统找不到指定的文件。) ``` 然后把配置文件贴一下吧 ``` driverClass = com.mysql.jdbc.Driver url = jdbc:mysql://locahost:3306/mybase username = root password = 123 ``` 最后是我的引用工具类 ``` package com.itheima_dbutils; import java.io.FileReader; import java.io.Reader; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; public class JDBCUtils { private static String driverClass; private static String url; private static String username; private static String password; // 静态代码块 static { try { // 1 使用Properties处理流 // 使用load()方法加载指定的流 Properties props = new Properties(); Reader is = new FileReader("database.properties"); props.load(is); // 2 使用getProperty(key),通过key获得需要的值, driverClass = props.getProperty("driverClass"); url = props.getProperty("url"); username = props.getProperty("username"); password = props.getProperty("password"); } catch (Exception e) { throw new RuntimeException(e); } } /** * 获得连接 */ public static Connection getConnection() { try { // 1 注册驱动 Class.forName(driverClass); // 2 获得连接 Connection conn = DriverManager.getConnection(url, username, password); return conn; } catch (Exception e) { throw new RuntimeException(e); } } } ```
Communications link failure报错
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 上网搜了,然后改了mysql的interactive_timeout,wait_timeout两个参数 也重启了mysql 为什么还是报同样的错误,非常郁闷!!!!!!!!!!!!!求大神帮忙!谢谢
mysql数据库问题java问题
我感觉是mysql数据库问题,那个懂数据库的来告诉告诉我 ``` com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure ``` com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 关于这个问题,需要数据库调配置吗
关于JDBC的使用 连接数据库出了问题 Communications link failure
我用的是SQLserver 驱动加载没问图 但是连接数据库的时候出了问题 报错如下: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 代码如下: public class DBCon { public static final String DRIVER="com.mysql.jdbc.Driver"; public static final String URL="jdbc:mysql://localhost:1433/工资管理系统"; public static final String USER="sa"; public static final String PWD="root"; private Connection con; private PreparedStatement ps; private ResultSet rs; public DBCon(){ try { //加载驱动程序 Class.forName(DRIVER); System.out.println("数据库驱动加载成功"); } catch (ClassNotFoundException e) { e.printStackTrace(); } } /** * @return返回数据库连接 */ public Connection getCon(){ try { con=DriverManager.getConnection(URL, USER, PWD); if(con!=null){ System.out.println("数据库连接成功"); } } catch (SQLException e) { System.out.println("数据库连接失败"); // TODO Auto-generated catch block e.printStackTrace(); } return con; } /** * 关闭资源 */ public void closeAll(){ if(rs!=null){ try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } if(ps!=null) try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } if(con!=null) try { con.close(); } catch (SQLException e) { e.printStackTrace(); } } public int update(String sql,Object... pras){ int resu=0; con=getCon(); try { ps=con.prepareStatement(sql); if(pras!=null){ for(int i=0;i<pras.length;i++){ ps.setObject(i+1, pras[i]); } } resu=ps.executeUpdate(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ closeAll(); } return resu; } /** * @param sql sql语句 * @param pras * @return 结果集 */ public ResultSet query(String sql,Object... pras){ con=getCon(); try { ps=con.prepareStatement(sql); if(pras!=null){ for(int i=0;i<pras.length;i++){ ps.setObject(i+1, pras[i]); } } rs=ps.executeQuery(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return rs; } public static void main(String[] args) { // TODO Auto-generated method stub DBCon con = new DBCon(); con.getCon(); } }
<SOS!!!> Communications link failureons
自己做的第一个信息类网站,第一次访问主页时能够正确显示,但过几分钟后刷新该页面是就会报错:错误类型如下: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 1,649,969 milliseconds ago. The last packet sent successfully to the server was 2 milliseconds ago . sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) java.lang.reflect.Constructor.newInstance(Constructor.java:513) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127) com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3715) 在网上查了一些解决方案,比如设置mysql参数“wait_timeout”等等都不奏效。求大神指点。。(ps: 用的是Hibernate访问数据库,MySQL版本为5.6的)
JAVA 如何 在MySQL 服务停止后 再开始时继续连接它
MySQL 服务有时会自动停止,然后再运行 当它停止时 我的JAVA程序会报 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure的错误 程序是一直反复读取数据库信息的,而当抛出这个错误后,就是MySQL的服务启动了,程序也无法读取数据库了,请问该怎么解决呢?我没有使用框架,麻烦各位了,谢谢。
jmeter测试mysql数据库报 通信链路故障 (mysql是5.7的)
Response message: java.sql.SQLException: Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)![图片说明](https://img-ask.csdn.net/upload/201912/20/1576842161_100444.png)
java.net.UnknownHostException: hostname
用jsp连接mysql数据库时出现了这样的错误,怎么解决? com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.UnknownHostException MESSAGE: hostname STACKTRACE: java.net.UnknownHostException: hostname
求大神抽时间看看,java连接本地mysql数据库出现connection reset错误
小弟弄这个小问题弄了好久,通过各种渠道找方法最后实在是没有办法了,望大神抽时间帮忙看看,谢谢 代码如下 import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class MysqlConnection { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); String url="jdbc:mysql://localhost:3306/test"; Connection con=DriverManager.getConnection(url, "root",""); Statement stmt=con.createStatement(); String sql="select * from msg"; boolean m=stmt.execute(sql); if(m){ System.out.println("succ"); }else System.out.println("false"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } } 出现如下错误: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Connection reset STACKTRACE: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:105) at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:148) at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:176) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1899) at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:481) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:964) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2544) at com.mysql.jdbc.Connection.<init>(Connection.java:1474) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:264) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at com.iotek.mysql.MysqlConnection.main(MysqlConnection.java:16) ** END NESTED EXCEPTION ** Last packet sent to the server was 27 ms ago. at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:552) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:964) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2544) at com.mysql.jdbc.Connection.<init>(Connection.java:1474) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:264) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at com.iotek.mysql.MysqlConnection.main(MysqlConnection.java:16)
servlet用javabean连接访问mysql失败
如果用java application连接wamp的mysql的话可以访问,但是换成servlet来访问就失败了 导入驱动包了,也把驱动包放入tomcat了,也改了mysql里面的服务时间了。 用php的话可以成功访问。 错误信息: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2132) ... 66 more ........ ......... 后面省略 查了好多方法,都没用,求各位帮个忙啊
java连接mysql 中getconnection的问题
Class.forName("com.mysql.jdbc.Driver"); System.out.println("成功加载MySQL驱动程序"); /*String url = "jdbc:mysql//loacalhost/javaweb"; String user = "root"; String password2 = "123456"; conn =DriverManager.getConnection(url,user,password2);*/ String url = "jdbc:mysql://localhost:3306/javaweb?" + "user=root&password=123456&useUnicode=true&characterEncoding=UTF8"; conn = DriverManager.getConnection(url); System.out.println("成功加载getconnection"); 这个代码是正确的,但是注释中的代码就是错误的,但是视频中就是这么写的没问题。 错误信息:java.sql.SQLException: No suitable driver found for jdbc:mysql///javaweb java.sql.SQLException: No suitable driver found for jdbc:mysql//loacalhost:3306/javaweb 这两种都不行,刚才注释中的代码是我写错了,是下面的两种代码,都是报错的: //String url = "jdbc:mysql//loacalhost:3306/javaweb";//错误代码 //String url = "jdbc:mysql///javaweb";//视频中代码,也不行 下面有位找出了问题。mysql少了: String url = "jdbc:mysql:///javaweb";//正确 String url = "jdbc:mysql://loacalhost:3306/javaweb";//报错: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
java内存溢出问题,不确定哪里出的问题
项目运行的时候出现了内存溢出情况,复现方式无法确定,大概出现了五六次,每次复现的方式都不一样,下面是我用MAT工具分析的dump文件 ![图片说明](https://img-ask.csdn.net/upload/202001/20/1579508231_612899.png) ![图片说明](https://img-ask.csdn.net/upload/202001/20/1579508244_502327.png) 除了hibernate里的那两个对象,其他的1000多万个对象里全是integer类型的对象 这是当时出现的时候产生的异常 ``` 2020-01-17 13:32:55 ERROR [DruidDataSource.java:2469] - create connection SQLException, url: jdbc:mysql://localhost:55060/mcs?useUnicode=true&characterEncoding=utf-8, errorCode 0, state 08S01 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 1 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3517) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3417) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3860) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:864) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1707) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1217) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.GeneratedConstructorAccessor118.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1513) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1578) at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2466) Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2969) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3427) ... 19 more 2020-01-17 13:33:03 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_preset_rlat failed: java.lang.OutOfMemoryError: GC overhead limit exceeded at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.getBytes(MemoryEfficientByteArrayOutputStream.java:65) at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.serialize(MemoryEfficientByteArrayOutputStream.java:99) at net.sf.ehcache.store.disk.DiskStorageFactory.serializeElement(DiskStorageFactory.java:405) at net.sf.ehcache.store.disk.DiskStorageFactory.write(DiskStorageFactory.java:384) at net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask.call(DiskStorageFactory.java:485) at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1088) at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1072) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 2020-01-17 13:32:59 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:32:59 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:32:55 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:16 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:27 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:33:27 ERROR [SqlExceptionHelper.java:144] - wait millis 7401, active 16, maxActive 40, creating 1 2020-01-17 13:33:27 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:33:33 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:33 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:02 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:34:02 ERROR [SqlExceptionHelper.java:144] - wait millis 5503, active 18, maxActive 40, creating 1 2020-01-17 13:34:02 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:34:04 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:08 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:12 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:12 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:14 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:14 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:14 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:17 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:34:17 ERROR [SqlExceptionHelper.java:144] - wait millis 5485, active 19, maxActive 40, creating 1 2020-01-17 13:34:17 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; Could not open connection; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:34:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:27 INFO [DeviceCache.java:249] - 设备状态及报警维护过程中出现异常 2020-01-17 13:34:35 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:35 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:42 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:42 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:44 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:44 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:52 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:34:52 ERROR [SqlExceptionHelper.java:144] - wait millis 7301, active 22, maxActive 40, creating 1 2020-01-17 13:34:52 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:34:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:35:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_roll_preset failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-17 13:35:18 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:35:18 ERROR [SqlExceptionHelper.java:144] - Error 2020-01-17 13:35:50 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:35:50 ERROR [SqlExceptionHelper.java:144] - Error 2020-01-17 13:36:13 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:13 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-17 13:36:13 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:24 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-17 13:36:13 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:37:01 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-17 13:37:43 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:36:37 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:33 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:22 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 ``` 现在就是无法确定到底哪里导致的内存溢出? 这个是上次出现的异常和代码 ``` 2020-01-13 13:21:44 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-13 13:21:44 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-13 13:23:55 INFO [MQTTProtocolHandler.java:283] - 接收到设备接入协议:{"topic":"info/deviceBaseInfo/BHIP118-S/00:00:01:A6:00:A2","reportTime":"256573751","decodeCapacity":{"totalLevel":2,"totalBlock":36,"totalPixel":16588800},"outputList":[{"status":"start","ratio":"UHD","pixel":"3840*2160","type":"UDP","url":"udp://231.0.100.80:7001"},{"status":"start","ratio":"HD","pixel":"960*540","type":"UDP","url":"udp://231.0.101.80:7001"},{"status":"start","ratio":"SD","pixel":"352*288","type":"UDP","url":"udp://231.0.102.80:7001"},{"status":"stop","ratio":"UHD","pixel":"3840*2160","type":"RTMP","url":"rtmp://192.168.15.80:1935/live/100"},{"status":"stop","ratio":"HD","pixel":"960*540","type":"RTMP","url":"rtmp://192.168.15.124:1935/live/101"},{"status":"stop","ratio":"SD","pixel":"352*288","type":"RTMP","url":"rtmp://192.168.15.80:1935/live/102"}],"baseInfo":{"deviceType":"BHIP118-S","code":"00:00:01:A6:00:A2","version":"v1.0.0.11","ip":"192.168.16.80"},"online":true} 2020-01-13 13:23:59 INFO [DeviceCache.java:127] - 接收到新增/更新设备信息:00:00:01:A6:00:A2 :BaseInfo [type=0,name=BHIP118-S,ip=192.168.16.80,port=0,code=00:00:01:A6:00:A2,groupCode=null,groupIndex=0,online=true,multiCastTime=0,ver=v1.0.0.11,channel=0,reserve=0,lockStatus=null,workMode=null,videoPixerls=null,kvmMode=null,serialNumber=null,sdipPortInfo is null,hdIpPortInfo is null,audioIpPortInfo is null,outputList[SourceOutput [ratio=UHD, url=udp://231.0.100.80:7001, pixel=3840*2160, channel=0, SourceOutput [ratio=HD, url=udp://231.0.101.80:7001, pixel=960*540, channel=0, SourceOutput [ratio=SD, url=udp://231.0.102.80:7001, pixel=352*288, channel=0, SourceOutput [ratio=UHD, url=rtmp://192.168.15.80:1935/live/100, pixel=3840*2160, channel=0, SourceOutput [ratio=HD, url=rtmp://192.168.15.124:1935/live/101, pixel=960*540, channel=0, SourceOutput [ratio=SD, url=rtmp://192.168.15.80:1935/live/102, pixel=352*288, channel=0],callStatus=null] 2020-01-13 13:24:06 INFO [MultiCastDeviceInfoHandler.java:229] - 更新视频合成器设备信息: Device [id=ff8080816f694555016f6a4bf61e158c, code=00:00:01:A6:00:A2, name=192.168.16.80, ip=192.168.16.80, port=0, status=0, type=BHIP118, deviceType=BHIP118-S, stamp=2020-01-03 15:26:00, abilityInfo=null, netCardInfo=null] 2020-01-13 13:24:53 INFO [MultiCastDeviceInfoHandler.java:364] - 更新解码器信息:Decoder [IP=192.168.16.80, Port=0, Channel=0, totalBlocks=36, totalLevel=2, uRefWidth=1920, uRefHeight=1080, audioPort=0, totalPixel=16588800, deviceTypeName=BHIP118-S, pixelsWidth=null, pixelsHeight=null] 2020-01-13 13:25:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:19 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:28 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:42 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-13 13:25:42 ERROR [SqlExceptionHelper.java:144] - wait millis 14463, active 11, maxActive 40, creating 1 2020-01-13 13:25:46 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_playback_task failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:25:48 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-13 13:25:50 ERROR [SqlExceptionHelper.java:144] - wait millis 18056, active 11, maxActive 40, creating 1 2020-01-13 13:25:50 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_source_volume failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:25:51 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:51 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:51 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; Could not open connection; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-13 13:25:51 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-13 13:25:58 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_kvm failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:25:56 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:56 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:03 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_video_terminal failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_pic_layer failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_template failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_multicast_address failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_mass_source failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_pic_encoder_block failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_ipc_preset_group failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:13 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_video_terminal failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:17 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_record_layer_block failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:24 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_video_meeting failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_audio_preset_rlat failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_preset failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_layer_block failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:32 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-13 13:26:32 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:32 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:32 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_encoder failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:52 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:27:07 ERROR [SqlExceptionHelper.java:144] - wait millis 20150, active 12, maxActive 40, creating 1 2020-01-13 13:26:50 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:46 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:46 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:41 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:41 ERROR [SqlExceptionHelper.java:144] - wait millis 23244, active 12, maxActive 40, creating 1 2020-01-13 13:26:41 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:41 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:29 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:25 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:07 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:07 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:07 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 ``` 这个是组播上报的设备信息,因为组播是一秒钟上报了好几次,是不是这里一直占用着连接 ``` public void run() { try { ms = new MulticastSocket(multiCastPort);//建立组播套接字 ms.setReceiveBufferSize(65535); // ms.setNetworkInterface(NetworkInterface.getByInetAddress(localAddress)); ms.joinGroup(InetAddress.getByName(multiCastIP));//加入组播组 LogHome.getLog().info("正常启动监听" + localAddress.getHostAddress()); byte[] buffer = null; DatagramPacket dp = null; while (true) { try { if (IsStop) { break; } buffer = new byte[1400]; dp = new DatagramPacket(buffer, buffer.length); LogHome.getLog().debug("等待接受组播信息:"); ms.receive(dp); MultiCastInfoParser info = new MultiCastInfoParser(dp.getData()); DeviceCache.baseInfoOf1004Handler(info.parse()); } catch (Exception e) { if (IsStop) {// 如果换网卡可能会出问题 break; } else { if (ms.isClosed()) { ms = new MulticastSocket(multiCastPort); ms.setNetworkInterface(NetworkInterface.getByInetAddress(localAddress)); ms.joinGroup(InetAddress.getByName(multiCastIP)); } } LogHome.getLog().error("接受并设置组播信息失败",e); }finally{ Thread.sleep(1); } } } catch (Exception e) { e.printStackTrace(); try { if (listenerList.containsKey(localAddress.getHostAddress())) { listenerList.remove(localAddress.getHostAddress()); } } catch (Exception ex) { LogHome.getLog().error(ex); } } ```
使用druid连接池连接数据库,出现了以下问题,忘各位大神解答
com.mysql.jdbc.exceptions.jorg.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. ### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 请各位大神帮帮小弟我,这是出现什么问题
远程连接服务器上,在自己的帐号下建立java连接mysql的程序,但是一直连接不上
我是通过远程连接在实验室机房的一台机器(linux操作系统)上,然后在该机器上建立JAVA程序,其中涉及到连接mysql数据库的操作,但是在获取连接时一直提示“Communications link failure“,涉及的代码为:connect=DriverManager.getConnection("jdbc:mysql://localhost:3306/pyq_test","root","120116"); [在linux终端查找mysql的所有用户/密码及主机的结果为:](https://img-ask.csdn.net/upload/201505/23/1432343964_536852.png) ![java程序报错](https://img-ask.csdn.net/upload/201505/23/1432344075_276126.png)
有关树莓派中MySQL访问的问题?
遇到一个问题: 在树莓派中建了一个MySQL数据库,然后在访问的时候就遇到了问题,如果是和一台共享网络的电脑,则在设置好账号,密码和IP地址之后该电脑可以执行java 程序来访问数据库中的数据,但是如果树莓派没有和电脑用网线直连,则这台电脑就不能访问了数据库,并且会出现以下的错误: Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:350) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2408) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2445) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2230) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at Connectingmysql.main(Connectingmysql.java:40) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:244) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:259) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300) ... 15 more 这个是报错之后的异常,程序本身是没有问题的,设置断点后发现是conn = DriverManager.getConnection(url, user, password);这条语句出错,就是未成功建立连接,不知道是什派中的
关于java项目访问数据库的问题
我用spring的定时任务,第一次操作数据库的时候没问题。但是10分钟后再次操作执行方法操作数据库就会报以下错误: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 616,228 milliseconds ago. The last packet sent successfully to the server was 24,213 milliseconds ago. at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy34.insertObject(Unknown Source) at com.supinfo.test.AutoGenerateData.generateData(AutoGenerateData.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:264) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 616,228 milliseconds ago. The last packet sent successfully to the server was 24,213 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3055) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2941) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562) at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4956) at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881) at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:223) ... 16 more Caused by: java.net.SocketException: Software caused connection abort: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114) at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161) at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2499) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2952) ... 24 more
ubuntu系统上的java工程用localhost代替ip地址来访问mysql报错
#1] com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$WarnLogger.log(214) | com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@3f4f4866 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.GeneratedConstructorAccessor43.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:356) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2502) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46) at sun.reflect.GeneratedConstructorAccessor38.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44) at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) Caused by: java.net.ConnectException: 拒绝连接 (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:244) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:258) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:306) ... 20 more
130 个相见恨晚的超实用网站,一次性分享出来
相见恨晚的超实用网站 持续更新中。。。
字节跳动视频编解码面经
三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时想着能进去就不错了,管他哪个岗呢,就同意了面试...
win10系统安装教程(U盘PE+UEFI安装)
一、准备工作 u盘,电脑一台,win10原版镜像(msdn官网) 二、下载wepe工具箱 极力推荐微pe(微pe官方下载) 下载64位的win10 pe,使用工具箱制作启动U盘打开软件, 选择安装到U盘(按照操作无需更改) 三、重启进入pe系统 1、关机后,将U盘插入电脑 2、按下电源后,按住F12进入启动项选择(技嘉主板是F12) 选择需要启...
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch, ...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Java描述设计模式(19):模板方法模式
本文源码:GitHub·点这里 || GitEE·点这里 一、生活场景 通常一款互联网应用的开发流程如下:业务需求,规划产品,程序开发,测试交付。现在基于模板方法模式进行该过程描述。 public class C01_InScene { public static void main(String[] args) { DevelopApp developApp = n...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n...
第三个java程序(表白小卡片)
前言: &nbsp;向女神表白啦,作为一个程序员,当然也有爱情啦。只不过,虽然前面两个程序都只是学习了基础的语法结构和向量哈希表。这里涉及的是Swing,awt图形用户界面和一点文件输入输出流的知识。 &nbsp; 表白代码如下: 另附:里面的音乐和图片可以放在一个自己创建的包里面,也可以放在src里面,或者使用绝对路径。至于布局,我自己的使用的是简单的排班,简单的继承。后面的程序会慢慢实现。 ...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的回答,对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalking,作者吴晟、刘浩杨 等等 仓库地址: apache/skywalking 更...
化繁为简 - 腾讯计费高一致TDXA的实践之路
导语:腾讯计费是孵化于支撑腾讯内部业务千亿级营收的互联网计费平台,在如此庞大的业务体量下,腾讯计费要支撑业务的快速增长,同时还要保证每笔交易不错账。采用最终一致性或离线补...
Linux网络服务-----实验---PXE和Kickstart的无人值守装机
目录 一.PXE的原理 二.kickstart的原理 三.PXE与kickstart的结合使用自动装机 一.PXE的原理 PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由支持通过网络启动操作系统,再启动过程中,终端要求服务器分配IP地址...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
A*搜索算法概述
编者按:本文作者奇舞团前端开发工程师魏川凯。A*搜索算法(A-star search algorithm)是一种常见且应用广泛的图搜索和寻径算法。A*搜索算法是通过使用启...
程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
从顶级黑客到上市公司老板
一看标题,很多老读者就知道我在写什么了。今天Ucloud成功上市,季昕华成为我所熟悉的朋友里又双叒叕一个成功上市的案例。我们认识大概是十五年多吧,如果没记错,第一次见面应该是2004年,...
蓝桥杯知识点汇总:基础知识和常用算法
文章目录基础语法部分:算法竞赛常用API:算法部分数据结构部分 此系列包含蓝桥杯绝大部分所考察的知识点,以及真题题解~ 基础语法部分: 备战蓝桥杯java(一):一般输入输出 和 快速输入输(BufferedReader&amp;BufferedWrite) 备战蓝桥杯java(二):java编程规范和常用数据类型 备战蓝桥杯java(三):常用功能符以及循环结构和分支结构 备战蓝桥杯java(四...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
强烈推荐10本程序员在家读的书
很遗憾,这个春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终将会...
Linux自学篇——linux命令英文全称及解释
man: Manual 意思是手册,可以用这个命令查询其他命令的用法。 pwd:Print working directory 意思是密码。 su:Swith user 切换用户,切换到root用户 cd:Change directory 切换目录 ls:List files 列出目录下的文件 ps:Process Status 进程状态 mkdir:Make directory ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
疫情数据接口api
返回json示例 { "errcode":0,//0标识接口正常 "data":{ "date":"2020-01-30 07:47:23",//实时更新时间 "diagnosed":7736,//确诊人数 "suspect":12167,//疑是病例人数 "death":170,//死亡人数 "cur...
智力题(程序员面试经典)
NO.1  有20瓶药丸,其中19瓶装有1克/粒的药丸,余下一瓶装有1.1克/粒的药丸。给你一台称重精准的天平,怎么找出比较重的那瓶药丸?天平只能用一次。 解法 有时候,严格的限制条件有可能反倒是解题的线索。在这个问题中,限制条件是天平只能用一次。 因为天平只能用一次,我们也得以知道一个有趣的事实:一次必须同时称很多药丸,其实更准确地说,是必须从19瓶拿出药丸进行称重。否则,如果跳过两瓶或更多瓶药...
相关热词 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数 c#日期精确到分钟 c#自定义异常必须继承 c#查表并返回值 c# 动态 表达式树 c# 监控方法耗时 c# listbox c#chart显示滚动条
立即提问