NotifyUtil::java.net.ConnectException: Connection refused: connect

By Ramlak Viewed: 31823 times Emailed: 271 times Printed: 295 times Bookmark and Share



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.

  1. Stop the Tomcat if it is running.
  2. 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.
  3. 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.
  4. Finally, you can restart Tomcat, and you will no longer see that error again.



Comments(3)


1. I am facing the same problem but org-netbeans-modules-web-httpmonitor.jar\". is already not added in my lib file so it is not working for me please tell if anybody have any others solution

Thanks

By: Anonymous at 2009-05-08 07:59:09
2. NICE SITE

By: MAEN ZIAD HUDAIB at 2009-07-01 01:55:28
3. I deploy a project in apache tomcat and backend to project is MS_Access.so when i tried to retrive the data it get error "java.rmi.connectionexception connection refused to local host" and "java.net.connectionexception".
please send the solution. It's very urgent i have to submit my academic project within 2days

By: satish at 2010-08-04 05:31:59

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:


Enter Code:
The Captcha image

Latest Tutorials

[2009-09-01]IIS and Tomcat - how to configure to work together
[2008-12-09]Drawbacks of the JSP Model 1 Architecture
[2008-12-09]What are the different scopes in JSP?
[2008-11-24]Using a DataSource from WebLogic in a JSP
[2008-11-24]Getting HTTP Request Headers in a JSP
[2008-11-24]Automatically Refreshing a JSP
[2008-11-24]Embedding a QuickTime movie in a JSP
[2008-11-24]Embedding MP3 audio file in a JSP
[2008-11-23]Writing your first JSP page
[2008-11-23]Deploying an Individual JSP on Tomcat
[2008-08-13]Using UTF-8 in JSP / ASP / HTML pages.
[2008-03-24]Calling JSP from a batch file
[2008-03-23]Sending Email using JSP
[2007-10-12]JSP Example to connect to MS SQL database and retrieve records
[2007-10-12]JSP Example to connect to MS SQL database using Tomcat Connection Pool

More Latest News

Most Viewed Articles (in last 30 days)
JSP Program for display Date
JSP Example to connect to MS SQL database and retrieve records
What are the different scopes in JSP?
NotifyUtil::java.net.ConnectException: Connection refused: connect
JSP Example to connect to MS SQL database using Tomcat Connection Pool
Sending Email using JSP
Getting Started with JSP
Comparison operators in JSP
Using a DataSource from WebLogic in a JSP
Writing your first JSP page
Form processing in JSP
Calling JSP from a batch file
The Advantages of JSP
What is JSP?
JSP Tags for SQL to connect to a database
Most Emailed Articles (in last 30 days)
Form Object
JSP Program for display Date
Click to Activate and Use this control
Sending Email using JSP
Example Using Initialization Parameters
Cookies using JSP or Java Bean
Sessions in JSP
JSP Example to connect to MS SQL database and retrieve records
The best way to avoid security vulnerabilities with new server
Retrieving a Portion of a String
Working with Status Bar Messages
NotifyUtil::java.net.ConnectException: Connection refused: connect
JavaScript Security
Server-side plug-Ins
What is JSP?