jfinal异常Communications link failure【已解决】

durid配置:

public void configPlugin(Plugins me) {
		Prop p = PropKit.use("a_little_config.txt");
		// C3p0Plugin c3p0Plugin = new C3p0Plugin(p.get("jdbcUrl"),
		// p.get("user"), p.get("password"));
		CommonKit.initComonKit();
		DruidPlugin dp = new DruidPlugin(CommonKit.getJdbcUrl(), CommonKit.getUserName(), CommonKit.getPassWord());
		// 配置初始化大小、最小、最大
		dp.setInitialSize(10);
		dp.setMinIdle(10);
		dp.setMaxActive(200);
		dp.setTestWhileIdle(true);
		// 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
		dp.setTimeBetweenEvictionRunsMillis(1000 * 60 * 5);
		// 配置获取连接等待超时的时间
		dp.setMaxWait(1000 * 60 * 5);
		//dp.setRemoveAbandonedTimeoutMillis(300000);
		// 配置一个连接在池中最小生存的时间,单位是毫秒
		dp.setMinEvictableIdleTimeMillis(1000 * 60 * 5);
		// 获取连接时检测连接的有效性
		dp.setTestOnBorrow(false);
		 // 返还连接时检测连接的有效性
		dp.setTestOnReturn(false);
		me.add(dp);
		ActiveRecordPlugin arp = new ActiveRecordPlugin(dp).setShowSql(true);
		_MappingKit.mapping(arp);
		me.add(arp);
		// ehcache缓存插件
        me.add(new EhCachePlugin());
        
        
		//DruidPlugin dp2 = new DruidPlugin(p.get("jdbcUrl2"), p.get("user2"), p.get("password2"),p.get("jdbcDriver2"));
        DruidPlugin dp2 = new DruidPlugin(CommonKit.getOracleUrl(),CommonKit.getOracleUser(),CommonKit.getOraclePassword(),CommonKit.getOracleDriver());
		// C3p0Plugin cp2 = new C3p0Plugin(PropKit.get("jdbcUrl2"),
		// PropKit.get("user2"),
		// PropKit.get("password2"),PropKit.get("jdbcDriver2"));
		/*
		 * cp2.setInitialPoolSize(3); cp2.setMaxIdleTime(10);
		 * cp2.setMinPoolSize(3); cp2.setMaxIdleTime(6);
		 */
		// 配置初始化大小、最小、最大
		dp2.setInitialSize(10);
		dp2.setMinIdle(10);
		dp2.setMaxActive(100);
		// 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
		dp2.setTimeBetweenEvictionRunsMillis(10000);
		// 配置获取连接等待超时的时间
		dp2.setMaxWait(80000);
		// 配置一个连接在池中最小生存的时间,单位是毫秒
		dp2.setMinEvictableIdleTimeMillis(300000);
		dp2.setValidationQuery("SELECT 1 FROM DUAL");
		dp2.setTestWhileIdle(true);
		dp2.setTestOnBorrow(false);
		dp2.setTestOnReturn(false);
		me.add(dp2);
		ActiveRecordPlugin arp2 = new ActiveRecordPlugin("db2", dp2).setShowSql(true);
		// arp2.setDialect(new AnsiSqlDialect());
		// com.seo.modeloracle._MappingKit.mapping(arp2);
		me.add(arp2);
        
		//配置任务调度插件 
        //Cron4jPlugin cp = new Cron4jPlugin(); 
        //cp.addTask("*/5 * * * *", new UpdateProductTask()); 
        //me.add(cp); 
	}

报错内容信息:

2019-10-15 17:38:22 [com.jfinal.core.ActionHandler]-[ERROR] /seo/admin/adminUser
com.jfinal.plugin.activerecord.ActiveRecordException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 7,711 milliseconds ago.  The last packet sent successfully to the server was 1 milliseconds ago.
at com.jfinal.plugin.activerecord.Model.find(Model.java:586)
at com.jfinal.plugin.activerecord.Model.find(Model.java:596)
at com.seo.controller.AdminController.adminUser(AdminController.java:28)
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 com.jfinal.aop.Invocation.invoke(Invocation.java:73)
at com.seo.intercepter.StoreInterceptor.intercept(StoreInterceptor.java:20)
at com.jfinal.aop.Invocation.invoke(Invocation.java:67)
at com.seo.intercepter.LoginSessionInterceptor.intercept(LoginSessionInterceptor.java:51)
at com.jfinal.aop.Invocation.invoke(Invocation.java:67)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:83)
at com.seo.silian.SilianHandler.handle(SilianHandler.java:34)
at com.seo.silian.SilianHandler.handle(SilianHandler.java:34)
at com.jfinal.ext.handler.FakeStaticHandler.handle(FakeStaticHandler.java:58)
at com.seo.silian.SilianHandler.handle(SilianHandler.java:34)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 7,711 milliseconds ago.  The last packet sent successfully to the server was 1 milliseconds ago.
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:1116)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3589)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3478)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4019)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2683)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2144)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2310)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:228)
at com.jfinal.plugin.activerecord.Model.find(Model.java:567)
at com.jfinal.plugin.activerecord.Model.find(Model.java:584)
... 34 more
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:3039)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3489)
... 44 more

不知道到底是哪儿问题呢?之前一直都好端端的!~重启过服务器,还是不行!~!

评论区

chcode

2019-10-16 09:42

网络 连不上吧

热门反馈

扫码入社