Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have done a small web development project using eclipse. It runs well when I try running it on browser with url localhost:8080/myproject/home.html. But if I want to access it on another machine (laptop, mobile, etc. using the same wifi) it is not possible; it is not able to connect.

After Googling for a while found out that I have to use the IP address instead of 'localhost'. So I tried, but still does not work. In fact i am unable to open that url on the same machine (where localhost:8080/myproject/home.html works fine). I also added a new Inbound rule in control panel firewall settings, allowing access to all ports for protocol TCP. Still have problem in running application with the url (both on same machine as well as laptop and mobile).

FYI i am using Eclipse Indigo, Apache tomcat 6.0 and server.xml file contents is as below:

    <?xml version="1.0" encoding="UTF-8"?>
      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    --><!-- Note:  A "Server" is not itself a "Container", so you may not
         define subcomponents such as "Valves" at this level.
         Documentation at /docs/config/server.html
     --><Server port="8005" shutdown="SHUTDOWN">

      <!--APR library loader. Documentation at /docs/apr.html -->
      <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
      <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
      <Listener className="org.apache.catalina.core.JasperListener"/>
      <!-- Prevent memory leaks due to use of particular java/javax APIs-->
      <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
      <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>

      <!-- Global JNDI resources
           Documentation at /docs/jndi-resources-howto.html
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users
        <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>

      <!-- A "Service" is a collection of one or more "Connectors" that share
           a single "Container" Note:  A "Service" is not itself a "Container", 
           so you may not define subcomponents such as "Valves" at this level.
           Documentation at /docs/config/service.html
      <Service name="Catalina">

        <!--The connectors can use a shared executor, you can define one or more named thread pools-->
        <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
            maxThreads="150" minSpareThreads="4"/>

        <!-- A "Connector" represents an endpoint by which requests are received
             and responses are returned. Documentation at :
             Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
             Java AJP  Connector: /docs/config/ajp.html
             APR (HTTP/AJP) Connector: /docs/apr.html
             Define a non-SSL HTTP/1.1 Connector on port 8080
        <!-- A "Connector" using the shared thread pool-->
        <Connector executor="tomcatThreadPool"
                   port="8080" protocol="HTTP/1.1" 
                   redirectPort="8443" />
        <!-- Define a SSL HTTP/1.1 Connector on port 8443
             This connector uses the JSSE configuration, when using APR, the 
             connector should be using the OpenSSL style configuration
             described in the APR documentation -->
        <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                   maxThreads="150" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" />

        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>

        <!-- An Engine represents the entry point (within Catalina) that processes
             every request.  The Engine implementation for Tomcat stand alone
             analyzes the HTTP headers included with the request, and passes them
             on to the appropriate Host (virtual host).
             Documentation at /docs/config/engine.html -->

        <!-- You should set jvmRoute to support load-balancing via AJP ie :
        <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">         
        <Engine defaultHost="localhost" name="Catalina">

          <!--For clustering, please take a look at documentation at:
              /docs/cluster-howto.html  (simple how to)
              /docs/config/cluster.html (reference documentation) -->
          <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

          <!-- The request dumper valve dumps useful debugging information about
               the request and response data received and sent by Tomcat.
               Documentation at: /docs/config/valve.html -->
          <Valve className="org.apache.catalina.valves.RequestDumperValve"/>

          <!-- This Realm uses the UserDatabase configured in the global JNDI
               resources under the key "UserDatabase".  Any edits
               that are performed against this UserDatabase are immediately
               available for use by the Realm.  -->
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

          <!-- Define the default virtual host
               Note: XML Schema validation will not work with Xerces 2.2.
          <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">

            <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />

            <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html -->
            <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
                   prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>

          <Context docBase="myproject" path="/myproject" reloadable="true" source="org.eclipse.jst.jee.server:myproject"/></Host>
share|improve this question

migrated from Dec 10 '12 at 4:54

This question came from our site for professional and enthusiast programmers.

Maybe you should bind your server to not

share|improve this answer
hi @aisensiy thanks for quick reply,... can u plz guide how do i bind it to – Robert Dec 9 '12 at 9:18

The local tomcat server running from eclipse binds to localhost ( by default, which means it will only accept requests at that address.

When you try accessing it from the machine's IP address, it is rejected because the request is for, which the server is not bound to. This explains why you cannot access it at that IP on the same machine.

This should explain how to bind to another IP address.

share|improve this answer
i tried adding the value for 'address', but still same problem. i tried values of the dev machine) and but still cannot open on browser with url can you plz check the contents of server.xml and let me if there are any errors in it. (i have edited the question and added it there..) – Robert Dec 10 '12 at 3:25
First try address= Make sure port 8080 is unblocked in your machine's firewall, or perhaps temporarily disable it. Also read this:… – computmaxer Dec 10 '12 at 5:14
i tried with address= and my windows firewall is off for domain, home/work, public.. still not working.. as i said earlier it is not opening in the same dev machine as well.. – Robert Dec 10 '12 at 5:42

protected by JakeGould Oct 12 '15 at 6:46

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.