java.net.socketexception权限被拒绝 - 服务器阻塞

时间:2015-05-20 15:40:03

标签: java windows tomcat

我们最近开始在我们的生产服务器上遇到问题,应用程序突然开始失败所有出站请求(调用公共API /本地数据库)一段时间,然后请求再次成功完成,然后过了一会儿他们又开始失败了。每次重新启动Tomcat时,问题都会消失一段时间,然后重新出现,并且每次重启tomcat时,问题都会在较短的时间内开始出现,直到我必须重新启动整个服务器以保证长时间的稳定性。 / p>

我通过stackoverflow和谷歌搜索结果四处查看,而不是建议的解决方案或调查路径之一让我解决了这个问题。

我的服务器设置是: - Windows server 2008 R2 - Tomcat 7.0.59 - JRE 7

我用过" netstat -ano"正如在stackoverflow.com上的答案中所建议的那样 - 我错过了参考,抱歉 - 要检查我的应用程序是否泄漏连接,我查找了CLOSE_WAIT状态连接并且似乎没有泄漏,与CLOSE_WAIT状态的连接不在&# 39; t长寿他们大多数时间是0,最多是1或2。

我已成功设置preferIPv4Stack java选项setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true,但它没有成功。我想它无论如何都与它无关,因为我的服务器无法发送任何成功的请求,如果是的话,对吧?在我的情况下,重新启动Tomcat之后,服务器成功发送 x 小时的请求,然后开始随机失败,直到所有请求都失败。

有人能指出我在调查此问题时的某个方向吗?我应该寻找什么?

感谢任何帮助。

编辑:

记录:

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://MYURL.COM": Permission denied: connect; nested exception is java.net.SocketException: Permission denied: connect
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:524) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:472) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:420) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at model.RestTemplateClient.AbstractRestClient.doRequest(AbstractRestClient.java:50) [OutswitchCore.jar:?]
    at clients.KigoRestClient.doRequest(KigoRestClient.java:57) [KigoAdapter.jar:?]
    at controller.KigoController.getProperty(KigoController.java:673) [KigoAdapter.jar:?]
    at controller.KigoController.getProperty(KigoController.java:1) [KigoAdapter.jar:?]
    at KigoAdapter.getProperty(KigoAdapter.java:108) [KigoAdapter.jar:?]
    at com.codefish.pcms.channel.processors.PmsActionExecutor.execute(PmsActionExecutor.java:73) [OutswitchCore.jar:?]
    at com.codefish.hibernate.HibernateThread.run(HibernateThread.java:27) [FishTankJava.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.7.0_76]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.7.0_76]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_76]
Caused by: java.net.SocketException: Permission denied: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[?:1.7.0_76]
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[?:1.7.0_76]
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.7.0_76]
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.7.0_76]
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at java.net.PlainSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at java.net.Socket.connect(Unknown Source) ~[?:1.7.0_76]
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at sun.net.NetworkClient.doConnect(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.protocol.https.HttpsClient.New(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.7.0_76]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:76) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49) ~[spring-web-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:509)

另一个日志部分:

ERROR org.quartz.core.ErrorLogger - An error occurred while scanning for the next triggers to fire.
org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'springNonTxDataSource.quartzJob': 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 org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:168) ~[quartz-2.2.0.jar:?]
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3774) ~[quartz-2.2.0.jar:?]
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2759) ~[quartz-2.2.0.jar:?]
    at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264) [quartz-2.2.0.jar:?]
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) ~[?:1.7.0_76]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_76]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_76]
    at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.7.0_76]
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1036) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:338) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at sun.reflect.GeneratedConstructorAccessor54.newInstance(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_76]
    at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.7.0_76]
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at org.springframework.jdbc.datasource.SimpleDriverDataSource.getConnectionFromDriver(SimpleDriverDataSource.java:140) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:153) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.scheduling.quartz.LocalDataSourceJobStore$2.getConnection(LocalDataSourceJobStore.java:131) ~[spring-context-support-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) ~[quartz-2.2.0.jar:?]
    at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:165) ~[quartz-2.2.0.jar:?]
    ... 3 more
Caused by: java.net.SocketException: Permission denied: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[?:1.7.0_76]
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[?:1.7.0_76]
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.7.0_76]
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.7.0_76]
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at java.net.PlainSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.7.0_76]
    at java.net.Socket.connect(Unknown Source) ~[?:1.7.0_76]
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:213) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:297) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at sun.reflect.GeneratedConstructorAccessor54.newInstance(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_76]
    at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.7.0_76]
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) ~[mysql-connector-java-5.1.34-bin.jar:5.1.34]
    at org.springframework.jdbc.datasource.SimpleDriverDataSource.getConnectionFromDriver(SimpleDriverDataSource.java:140) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:153) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119) ~[spring-jdbc-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.springframework.scheduling.quartz.LocalDataSourceJobStore$2.getConnection(LocalDataSourceJobStore.java:131) ~[spring-context-support-3.2.8.RELEASE.jar:3.2.8.RELEASE]
    at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) ~[quartz-2.2.0.jar:?]
    at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:165) ~[quartz-2.2.0.jar:?]

编辑(NETSTAT -ANO结果在pastebin.com链接中):

http://pastebin.com/JDnizrAs

0 个答案:

没有答案