Announcement Announcement Module
Collapse
No announcement yet.
http 401 Error trying the step-by-step tutorial with eclipse 3.5 -- PLEASE HELP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • http 401 Error trying the step-by-step tutorial with eclipse 3.5 -- PLEASE HELP

    I've tried everything. I've looked at the numerous threads on this topic and none of them work. My build.xml and build.properties are exactly like the tutorial except for the tomcat path, which is correct.

    When i ant build with usage or deply target, it works correctly with no errors. however when i get to the ant build with list target i get the following error:
    C:\java\springapp\build.xml:133: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/list

    The usernames and passwords in the tomcat-users.xml and the build.properties are identical (with no extra space at the end as pointed out in all the other threads).

    I've pasted in the files below. If ANYONE can help me with this, i would really appreciate it. I'm using eclipse 3.5, tomcat 6.0.20, and ant 1.7.1.
    _____________________
    tomcat-users.xml
    _____________________

    <tomcat-users>
    <!--
    <role rolename="manager"/>
    <user username="tomcat" password="s3cret" roles="manager"/>
    -->
    </tomcat-users>
    _____________________________
    build.properties
    _____________________________

    appserver.home=C:/java/tomcat

    appserver.lib=${appserver.home}/lib

    deploy.path=${appserver.home}/webapps

    tomcat.manager.url=http://localhost:8080/manager
    tomcat.manager.username=tomcat
    tomcat.manager.password=s3cret
    ______________________________________________
    build.xml
    ______________________________________________
    <?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>

    Steve
    Last edited by enflation; Nov 20th, 2009, 05:46 PM.

  • #2
    Any luck?

    Same boat as you...

    Comment


    • #3
      same problem

      I have double checked I everything I feel like and I am still getting the 401 response code. If anyone has any ideas please help.

      I check the space after the username and everything else, as well as updated the tomcat-users.xml file to reflect the username and pw desired.

      Comment

      Working...
      X