Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: java.net.ConnectException

  1. #1
    Join Date
    Sep 2008
    Location
    India
    Posts
    12

    Default java.net.ConnectException

    Hi,

    I am following the below link for developing sample spring application.

    springframework.org/docs/Spring-MVC-step-by-step/part1.html#step1.2

    I run the "build.xml" file by Ant Build. It displays the following in the console..

    Buildfile: D:\Ramesh\WorkSpace\springapp\build.xml
    usage:
    [echo] springapp build file
    [echo] -----------------------------------
    [echo] Available targets are:
    [echo] build --> Build the application
    [echo] deploy --> Deploy application as directory
    [echo] deploywar --> Deploy application as a WAR file
    [echo] install --> Install application in Tomcat
    [echo] reload --> Reload application in Tomcat
    [echo] start --> Start Tomcat application
    [echo] stop --> Stop Tomcat application
    [echo] list --> List Tomcat applications
    build:
    build:
    deploy:
    build:
    deploywar:
    reload:

    BUILD FAILED
    D:\Ramesh\WorkSpace\springapp\build.xml:113: java.net.ConnectException: Connection refused: connect

    Total time: 2 seconds

    Any one give me the solution.....

  2. #2

    Default

    Quote Originally Posted by ram2206 View Post
    Hi,

    I am following the below link for developing sample spring application.

    springframework.org/docs/Spring-MVC-step-by-step/part1.html#step1.2

    I run the "build.xml" file by Ant Build. It displays the following in the console..

    Buildfile: D:\Ramesh\WorkSpace\springapp\build.xml
    usage:
    [echo] springapp build file
    [echo] -----------------------------------
    [echo] Available targets are:
    [echo] build --> Build the application
    [echo] deploy --> Deploy application as directory
    [echo] deploywar --> Deploy application as a WAR file
    [echo] install --> Install application in Tomcat
    [echo] reload --> Reload application in Tomcat
    [echo] start --> Start Tomcat application
    [echo] stop --> Stop Tomcat application
    [echo] list --> List Tomcat applications
    build:
    build:
    deploy:
    build:
    deploywar:
    reload:

    BUILD FAILED
    D:\Ramesh\WorkSpace\springapp\build.xml:113: java.net.ConnectException: Connection refused: connect

    Total time: 2 seconds

    Any one give me the solution.....
    check build.properties file
    It seems like your settings are incorrect. Most likely this is something to do with your web server. Check your configuration

  3. #3
    Join Date
    Sep 2008
    Location
    India
    Posts
    12

    Default

    Quote Originally Posted by anurudda_spring View Post
    check build.properties file
    It seems like your settings are incorrect. Most likely this is something to do with your web server. Check your configuration
    Thank you for your reply...

    The build.properties file contains the following contents..

    appserver.home=D:/apache-tomcat-6.0.18
    appserver.lib=${appserver.home}/lib
    deploy.path=${appserver.home}/webapps

    tomcat.manager.url=localhost:8080/manager #url with protocol
    tomcat.manager.username=tomcat
    tomcat.manager.password=s3cret
    -----------

    Is there any more configuration file required?

    Still I'm having the same problem...

  4. #4

    Default

    Quote Originally Posted by ram2206 View Post
    Thank you for your reply...

    The build.properties file contains the following contents..

    appserver.home=D:/apache-tomcat-6.0.18
    appserver.lib=${appserver.home}/lib
    deploy.path=${appserver.home}/webapps

    tomcat.manager.url=localhost:8080/manager #url with protocol
    tomcat.manager.username=tomcat
    tomcat.manager.password=s3cret
    -----------

    Is there any more configuration file required?

    Still I'm having the same problem...
    Are you sure your tomcat manager username and passwords are correct?
    check inside D:/apache-tomcat-6.0.18/conf/tomcat-users.xml

  5. #5
    Join Date
    Sep 2008
    Location
    India
    Posts
    12

    Default

    Thank you for your quick reply...
    Yes, I am sure...

    D:\apache-tomcat-6.0.18\conf\tomcat-users.xml contains the following...

    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    <role rolename="manager"/>
    <user username="tomcat" password="s3cret" roles="manager"/>

    </tomcat-users>

  6. #6
    Join Date
    Sep 2008
    Location
    India
    Posts
    12

    Default

    Still I'm having the same problem...

  7. #7

    Default

    Quote Originally Posted by ram2206 View Post
    Thank you for your quick reply...
    Yes, I am sure...

    D:\apache-tomcat-6.0.18\conf\tomcat-users.xml contains the following...

    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    <role rolename="manager"/>
    <user username="tomcat" password="s3cret" roles="manager"/>

    </tomcat-users>
    Can u show us the build.xml file?

  8. #8
    Join Date
    Sep 2008
    Location
    India
    Posts
    12

    Default

    <?xml version="1.0"?>

    <project name="springapp" basedir="." default="usage">
    <property file="build.properties"/>

    <property name="src.dir" value="src"/>
    <property name="web.dir" value="war"/>
    <property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
    <property name="name" value="springapp"/>

    <path id="master-classpath">
    <fileset dir="${web.dir}/WEB-INF/lib">
    <include name="*.jar"/>
    </fileset>
    <!-- We need the servlet API classes: -->
    <!-- * for Tomcat 5/6 use servlet-api.jar -->
    <!-- * for other app servers - check the docs -->
    <fileset dir="${appserver.lib}">
    <include name="servlet*.jar"/>
    </fileset>
    <pathelement path="${build.dir}"/>
    </path>

    <target name="usage">
    <echo message=""/>
    <echo message="${name} build file"/>
    <echo message="-----------------------------------"/>
    <echo message=""/>
    <echo message="Available targets are:"/>
    <echo message=""/>
    <echo message="build --> Build the application"/>
    <echo message="deploy --> Deploy application as directory"/>
    <echo message="deploywar --> Deploy application as a WAR file"/>
    <echo message="install --> Install application in Tomcat"/>
    <echo message="reload --> Reload application in Tomcat"/>
    <echo message="start --> Start Tomcat application"/>
    <echo message="stop --> Stop Tomcat application"/>
    <echo message="list --> List Tomcat applications"/>
    <echo message=""/>
    </target>

    <target name="build" description="Compile main source tree java files">
    <mkdir dir="${build.dir}"/>
    <javac destdir="${build.dir}" source="1.5" target="1.5" debug="true"
    deprecation="false" optimize="false" failonerror="true">
    <src path="${src.dir}"/>
    <classpath refid="master-classpath"/>
    </javac>
    </target>

    <target name="deploy" depends="build" description="Deploy application">
    <copy todir="${deploy.path}/${name}" preservelastmodified="true">
    <fileset dir="${web.dir}">
    <include name="**/*.*"/>
    </fileset>
    </copy>
    </target>

    <target name="deploywar" depends="build" description="Deploy application as a WAR file">
    <war destfile="${name}.war"
    webxml="${web.dir}/WEB-INF/web.xml">
    <fileset dir="${web.dir}">
    <include name="**/*.*"/>
    </fileset>
    </war>
    <copy todir="${deploy.path}" preservelastmodified="true">
    <fileset dir=".">
    <include name="*.war"/>
    </fileset>
    </copy>
    </target>

    <!-- ================================================== ============ -->
    <!-- Tomcat tasks - remove these if you don't have Tomcat installed -->
    <!-- ================================================== ============ -->

    <path id="catalina-ant-classpath">
    <!-- We need the Catalina jars for Tomcat -->
    <!-- * for other app servers - check the docs -->
    <fileset dir="${appserver.lib}">
    <include name="catalina-ant.jar"/>
    </fileset>
    </path>

    <taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
    <classpath refid="catalina-ant-classpath"/>
    </taskdef>
    <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
    <classpath refid="catalina-ant-classpath"/>
    </taskdef>
    <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
    <classpath refid="catalina-ant-classpath"/>
    </taskdef>
    <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
    <classpath refid="catalina-ant-classpath"/>
    </taskdef>
    <taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
    <classpath refid="catalina-ant-classpath"/>
    </taskdef>

    <target name="install" description="Install application in Tomcat">
    <install url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="/${name}"
    war="${name}"/>
    </target>

    <target name="reload" description="Reload application in Tomcat">
    <reload url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="/${name}"/>
    </target>

    <target name="start" description="Start Tomcat application">
    <start url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="/${name}"/>
    </target>

    <target name="stop" description="Stop Tomcat application">
    <stop url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="/${name}"/>
    </target>

    <target name="list" description="List Tomcat applications">
    <list url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"/>
    </target>

    <!-- End Tomcat tasks -->

    </project>

  9. #9
    Join Date
    Sep 2008
    Location
    India
    Posts
    12

    Default

    I couldn't find out the problem.....

    I run the build.xml file. It gves the following.....

    Buildfile: D:\Ramesh\WorkSpace\springapp\build.xml
    usage:
    [echo] springapp build file
    [echo] -----------------------------------
    [echo] Available targets are:
    [echo] build --> Build the application
    [echo] deploy --> Deploy application as directory
    [echo] deploywar --> Deploy application as a WAR file
    [echo] install --> Install application in Tomcat
    [echo] reload --> Reload application in Tomcat
    [echo] start --> Start Tomcat application
    [echo] stop --> Stop Tomcat application
    [echo] list --> List Tomcat applications
    build:
    build:
    deploy:
    build:
    deploywar:
    reload:

    BUILD FAILED
    D:\Ramesh\WorkSpace\springapp\build.xml:113: java.net.ConnectException: Connection refused: connect

    Total time: 8 seconds
    --------------
    Please give me the solution.....

  10. #10

    Default

    There is an error in your build.properties file

    change ur tomcat manager url to include the protocol like

    tomcat.manager.url=http://localhost:8080/manager


    Currently you have not mentioned the protocol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •