Announcement Announcement Module
Collapse
No announcement yet.
Spring Tutorial Build Failed on list and reload targets using eclipse Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Tutorial Build Failed on list and reload targets using eclipse

    Hi,

    I am following this tutorial http://static.springsource.org/docs/...tep/part1.html. I am using tomcat 7. The problem is that everything works fine until I build from eclipse the list or reload targets. I can reload/list without any problem from the tomcat manager but it fails for eclipse.

    Below is the console output for list target:


    Buildfile: /Volumes/Data/thebeginner/workspace/springapp/build.xml

    list:[list] <html>[list] <head>[list] <style>

    ...

    [list] </style>[list] <title>/manager</title>[list] </head>[list] <body bgcolor="#FFFFFF">

    ...
    [list] </body>[list] </html>

    BUILD FAILED
    /Volumes/Data/thebeginner/workspace/springapp/build.xml:137: <html>

    Total time: 309 milliseconds


    The build.xml is as follows:

    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <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" />
    	</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.DeployTask"> 
    		<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}"
    		[COLOR="red"]password="${tomcat.manager.password}" />[/COLOR]
    	</target>
    	<!-- End Tomcat tasks -->
    		
    	<!-- Configuration for HelloControllerTest >
    		
    	<property name="test.dir" value="test" />
    		
    	<target name="buildtests" description="Compile test 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="${test.dir}"/> 
    			<classpath refid="master-classpath"/>
    		</javac> 
    	</target>
    	
    	<target name="tests" depends="build, buildtests" description="Run tests"> 
    		<junit printsummary="on"
    				fork="false" 
    				haltonfailure="false" 
    				failureproperty="tests.failed" 
    				showoutput="true"> 
    			<classpath refid="master-classpath"/> 
    			<formatter type="brief" usefile="false"/>
    				
    			<batchtest> 
    				<fileset dir="${build.dir}">
    					<include name="**/*Tests.*"/> 
    				</fileset>
    			</batchtest> 
    		</junit>
    
    		<fail if="tests.failed"> 
    			tests.failed=${tests.failed} 
    					
    			*********************************************************** 
    			*********************************************************** 
    			****   One or more tests failed! Check the output ...  **** 
    			*********************************************************** 
    			***********************************************************
    			
    		</fail> 
    	</target-->
    </project>

    and the build.properties file is as follows:

    # Ant properties for building the springapp
    user.home=~
    appserver.home=${user.home}/tomcat
    #appserver.home=${user.home}/tomcat
    # for Tomcat 5 use $appserver.home}/server/lib
    # for Tomcat 6 use $appserver.home}/lib
    appserver.lib=${appserver.home}/lib
    deploy.path=${appserver.home}/webapps
    tomcat.manager.url=http://localhost:8080/manager/html
    tomcat.manager.username=tomcat
    tomcat.manager.password=s3cret



    I am developing the application on MacOSX (Snow Leopard), if that helps.
    I had to shorten the console output because of the restriction of text length.
    It prints out a lot of html. It seems like the entire html for the tomcat manager page.

    Please help!

  • #2
    tomcat-users.xml

    The tomcat-users.xml file is as below. I have modified the file in both locations tomcat/conf/tomcat-users.xml as well as the tomcat-users.xml file in the servers folder in the eclipse workspace. I have also tried with only the "manager-gui" role, but it doesn't make any difference.

    HTML Code:
    <role rolename="admin-gui"/>
    <role rolename="manager-gui"/>
    <role rolename="manager"/>
    <role rolename="admin"/>
    <user username="tomcat" password="s3cret" roles="admin,manager,admin-gui,manager-gui"/>

    Comment


    • #3
      Another problem that I have noticed now is that after following through the steps 1.5 - 1.12, now the application isn't starting from the tomcat manager. It gives the following message:

      FAIL - Application at context path /springapp could not be started

      Comment

      Working...
      X