Caused by: java.net.SocketException: Software caused connection abort: socket write error

famido 发布于 2014/03/28 16:11
阅读 3K+
收藏 1

@wenshao 你好,想跟你请教个问题:

java.sql.SQLRecoverableException: IO 错误: Software caused connection abort: socket write error
	at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:587)
	at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:4011)
	at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:163)
	at com.alibaba.druid.filter.FilterAdapter.connection_close(FilterAdapter.java:758)
	at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:159)
	at com.alibaba.druid.filter.stat.StatFilter.connection_close(StatFilter.java:254)
	at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:159)
	at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.close(ConnectionProxyImpl.java:99)
	at com.alibaba.druid.util.JdbcUtils.close(JdbcUtils.java:81)
	at com.alibaba.druid.pool.DruidDataSource.discardConnection(DruidDataSource.java:707)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:674)
	at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4530)
	at com.alibaba.druid.filter.FilterAdapter.dataSource_getConnection(FilterAdapter.java:2706)
	at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4526)
	at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:659)
	at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4526)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:626)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:618)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:79)
	at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:162)
	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:464)
	at com.payplat.util.jdbc.other.impl.JdbcServerImpl.fetchEnergyData(JdbcServerImpl.java:277)
	at com.payplat.dacq.job.scheduling.job.energy.EnergyEDateTemp.execute(EnergyEDateTemp.java:30)
	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:597)
	at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
	at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:311)
	at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: java.net.SocketException: Software caused connection abort: socket write error
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
	at oracle.net.ns.DataPacket.send(DataPacket.java:210)
	at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:230)
	at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:321)
	at oracle.net.ns.NetInputStream.read(NetInputStream.java:268)
	at oracle.net.ns.NetInputStream.read(NetInputStream.java:190)
	at oracle.net.ns.NetInputStream.read(NetInputStream.java:107)
	at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
	at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
	at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:350)
	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
	at oracle.jdbc.driver.T4C7Ocommoncall.doOLOGOFF(T4C7Ocommoncall.java:61)
	at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:574)
	... 35 more



这个方法有时候报错,有时候不报错,方法如下:

@Override
    public List<EnergyData> fetchEnergyData() {
        //fixme 这里会抛异常 connection reset by peer socket write error
        DatabaseContextHolder.setDataSourceType(DatabaseContextHolder.DATA_SOURCE_FROM);
        StringBuffer sqlBuffer = new StringBuffer();
        sqlBuffer.append("SELECT ");
        sqlBuffer.append("f_devid as meterId, ");
        sqlBuffer.append("f_value as readings, ");
        sqlBuffer.append("f_systime as datetime ");
        sqlBuffer.append("FROM ");
        sqlBuffer.append("t_ov_devcollectiondata ");
        sqlBuffer.append("WHERE ");
        sqlBuffer.append("to_char(f_systime, 'yyyy-mm-dd HH24') ");
        sqlBuffer.append("=");
        sqlBuffer.append("to_char(sysdate - 1 / 24, 'yyyy-mm-dd HH24') ");
        sqlBuffer.append("and f_datatype = 'e0'");
        logger.info(sqlBuffer.toString());
        List<EnergyData> values = jdbcTemplate.query(sqlBuffer.toString(), new RowMapper() {
            @Override
            public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
                EnergyData energyData = new EnergyData();
                energyData.setMeterId(rs.getString("meterId"));
                energyData.setReadings(rs.getFloat("readings"));
                energyData.setTimestamp(rs.getTimestamp("datetime"));
                return energyData;
            }
        });
        logger.info("能源个数:"+values.size());
        return values;
    }



加载中
0
wenshao
wenshao
网络中断了?
famido
famido
t_ov_devcollectiondata 这个表里有很多数据,会不会是数据过多,查询的时间超时了?
0
famido
famido

分别是应用服务器和数据库服务器,两者通讯会有可能出现网络中断?这两台机器就是在同一个局域网下,问题有时有有时没有

0
常氏孤儿
常氏孤儿
您好,您这个问题最后怎么解决的?
famido
famido
没有解决
返回顶部
顶部