NotifyUtil::java.net.ConnectException: Connection refused: connect
By: Ramlak in JSP Tutorials on 2007-06-28
If you are seeing this 'NotifyUtil::java.net.ConnectException: Connection refused: connect' error in your tomcat stdout log file then I am sure it keeps repeating quite frequently and your log file grows tremendously due to this error.
This error may not be affecting the functionality of your webapps but it will affect the performance of the tomcat and slow it down. The main cause of this error is due to some sort of http monitor setting in your tomcat web.xml file. The complete error looks like this.
NotifyUtil::java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:237)
This happens as soon as you add an external server to Netbeans, and tell it to monitor the HTTP traffic, it will install a Filter to apply to all HTTP requests, to pass directly to Netbeans, so that it may show it in the Monitor. This is a good thing, when Netbeans is running. However, as soon as Netbeans isn't running, your performance will fall dramatically, as the Tomcat server tries to connect to a non existing Netbeans, and pay the penalty of waiting to find that out, for every single HTTP request.
Now you may tell me, I never did anything like that. I dont even know what netbeans is etc. etc. Whatever is the case, just follow the steps I have listed here and this problem will be resolved.
- Stop the Tomcat if it is running.
- Second goto the Tomcat Install Directory, and into the common directory, and then into libs. Inside here you will see a file called "org-netbeans-modules-web-httpmonitor.jar". Delete this or move it. It should not be in this directory.
- Third you need to edit the web.xml file inside the conf directory in the Tomcat Install Directory. You are looking for a block of XML that says something very similar to
<filter>
<filter-name>HTTPMonitorFilter</filter-name>
<filter-class>org.netbeans.modules.web.monitor.server.MonitorFilter</filter-class>
<init-param>
<param-name>netbeans.monitor.ide</param-name>
<param-value>127.0.0.1:8082</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>HTTPMonitorFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>Delete that block from the file, and save it.
- Finally, you can restart Tomcat, and you will no longer see that error
again.
Add Comment
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
- Data Science
- Android
- React Native
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
Comments (1)
I faced an exception "java.net.connectException: Connection refused", and the fix to my prob was:
Login using putty to the server IP with uid/pwd, go to root and hit ftp, at the ftp prompt, type the command "open" followed by <IP address> if this shows "connection refused" then it means we are not able to get connected to the server. Solution is at the OS level, one of the services vsftpd is not running because of the server which was abruptly shut down over the weekend . They restarted the service and now my app works fine.
Thanks,
Sandhya