微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.net.socketexception权限被拒绝 – 服务器窒息

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

我查看了所有通过stackoverflow和谷歌search结果,而不是build议的解决scheme之一或调查path导致我解决这个问题。

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

我已经使用“netstat -ano”build议在stackoverflow.com上的答案 – 我缺less的参考,对此感到遗憾 – 检查我的应用程序是否泄漏连接,我寻找CLOSE_WAIT状态连接,似乎没有泄漏,具有CLOSE_WAIT状态的连接不会长时间生存,大部分时间是0,最多1或2。

将单个JAR文件正确打包为RPM

使用指定path的Java JDK无提示安装

如何pipe理应用程序级别的只读数据库连接

编写简单的cron作业来运行java类

在运行窗口中调用一个命令

我已经成功设置了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

在计算机Windows 7上计数login和注销

如何从命令行Java应用程序更改命令提示符(控制台)窗口标题

Java平台中的哪些Java文件在Windows和Mac中有所不同?

如何为特定目录创build监视器?

Linux中的Java应用程序使用IKVM调用.NET Mono

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐