Announcement Announcement Module
Collapse
No announcement yet.
New - problem with Spring tutorial Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • New - problem with Spring tutorial

    Hi,

    I am new to Spring, and I am trying to follow the online tutorial at http://static.springsource.org/docs/...tep/part1.html. I have successfully done everything up to step 1.4. That is, I have the 'ant' command working properly, as well as the 'ant deploy'. However, when I attempt to run 'ant list', I get the following error:


    Buildfile: C:\Users\Jacob\workspace\springapp\build.xml

    list:

    BUILD FAILED
    C:\Users\Jacob\workspace\springapp\build.xml:133: java.io.IOException: Server re
    turned HTTP response code: 401 for URL: http://localhost:8080/manager/list
    at sun.net.http://www.protocol.http.HttpURLConn...eam(HttpURLCon
    nection.java:1313)
    at org.apache.catalina.ant.AbstractCatalinaTask.execu te(AbstractCatalina
    Task.java:225)
    at org.apache.catalina.ant.AbstractCatalinaTask.execu te(AbstractCatalina
    Task.java:146)
    at org.apache.catalina.ant.ListTask.execute(ListTask. java:50)
    at org.apache.tools.ant.UnknownElement.execute(Unknow nElement.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execut e(DispatchUtils.jav
    a:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:39 0)
    at org.apache.tools.ant.Target.performTasks(Target.ja va:411)
    at org.apache.tools.ant.Project.executeSortedTargets( Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project .java:1366)
    at org.apache.tools.ant.helper.DefaultExecutor.execut eTargets(DefaultExe
    cutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Projec t.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher. java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher .java:109)



    All the files I am using are identical to those in the tutorial with the exception of build.properties. I altered that file to the following:



    appserver.home=${user.home}/apache-tomcat-6.0.14
    appserver.lib=C:/Program Files/Apache Software Foundation/Tomcat 6.0/lib

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

    tomcat.manager.url=http://localhost:8080/manager
    tomcat.manager.username=someone
    tomcat.manager.password=something



    My username and password correspond to the username/password in tomcat-users.xml (which has roles="admin,manager").

    What am I doing wrong?

  • #2
    That's quite strange that you were able to deploy you app but not perform list action. Server returned HTTP response code: 401, unauthorized access.
    Is you app really successfully deployed?

    Comment


    • #3
      I believe so. After running "ant deploy" I get this message:

      C:\Users\Jacob\workspace\springapp>ant deploy
      Buildfile: C:\Users\Jacob\workspace\springapp\build.xml

      build:
      [javac] C:\Users\Jacob\workspace\springapp\build.xml:45: warning: 'includean
      truntime' was not set, defaulting to build.sysclasspath=last; set to false for r
      epeatable builds

      deploy:
      [copy] Copying 2 files to C:\Users\Jacob\apache-tomcat-6.0.14\webapps\sprin
      gapp

      BUILD SUCCESSFUL
      Total time: 0 seconds




      The created webapps/springapp folder shows up in my apache-tomcat-6.0.14 folder.

      The only alteration I made from the tutorial code was changing my username/password, and overriding appserver.lib, setting it equal to
      appserver.lib=C:/Program Files/Apache Software Foundation/Tomcat 6.0/lib.

      I don't think that is related as this is a permissions error right?

      Comment


      • #4
        Ok, I see. The deployment performs direct copy to webapps directory so no credentials are needed for that. Are you able to login to:
        http://localhost:8080/manager/html
        from the browser? (Or http://localhost:8080 and in the panel on the left link "Tomcat Administration"). Using your username and password? Ant script uses exacty the same mechanism to perform management actions. Please be minded that tomcat-users.xml has to contain the user with manager role, in your case:
        <user name="someone" password="something" roles="manager" />
        But as I wrote before, you have to be able to login from browser. Also check tha you have manager directory in you webapps (I assume you do, just to make sure):
        C:\Users\Jacob\apache-tomcat-6.0.14\webapps\manager

        Comment


        • #5
          Yes, I can log into Tomcat's homepage at http://localhost:8080/manager/html. I'm prompted for my username/password, which does work.

          My tomcat-users.xml file does contain the manager role:
          <user name="someone" password="something" roles="admin,manager" />

          The manager directory does exist in C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/.

          However, there is no manager directory in my deployment directory:
          C:/users/me/apache-tomcat-6.0.14/webapps.
          I don't know if that matters?

          Comment


          • #6
            so it looks like you're using 2 instances of Apache Tomcat. First is located in C:/Program Files/Apache Software Foundation/Tomcat 6.0/ and second in C:/users/me/apache-tomcat-6.0.14/
            Which one are you running? You should consolidate your apache tomcat instances on your machine first.

            Comment

            Working...
            X