spring - java.io.FileNotFoundException: http://localhost:8080/manager/text/list -
i'm learning spring mvc http://docs.spring.io/docs/spring-mvc-step-by-step/part1.html. there's error when executing "ant list":
picked java_tool_options: -javaagent:/usr/share/java/jayatanaag.jar buildfile: /home/mycityofsky/java_workspace/springapp/build.xml trying override old definition of task javac list: build failed /home/mycityofsky/java_workspace/springapp/build.xml:142: java.io.filenotfoundexception: http://localhost:8080/manager/text/list @ sun.net.www.protocol.http.httpurlconnection.getinputstream0(httpurlconnection.java:1835) @ sun.net.www.protocol.http.httpurlconnection.getinputstream(httpurlconnection.java:1440) @ org.apache.catalina.ant.abstractcatalinatask.execute(abstractcatalinatask.java:228) @ org.apache.catalina.ant.abstractcatalinatask.execute(abstractcatalinatask.java:148) @ org.apache.catalina.ant.listtask.execute(listtask.java:50) @ org.apache.tools.ant.unknownelement.execute(unknownelement.java:292) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ org.apache.tools.ant.dispatch.dispatchutils.execute(dispatchutils.java:106) @ org.apache.tools.ant.task.perform(task.java:348) @ org.apache.tools.ant.target.execute(target.java:435) @ org.apache.tools.ant.target.performtasks(target.java:456) @ org.apache.tools.ant.project.executesortedtargets(project.java:1393) @ org.apache.tools.ant.project.executetarget(project.java:1364) @ org.apache.tools.ant.helper.defaultexecutor.executetargets(defaultexecutor.java:41) @ org.apache.tools.ant.project.executetargets(project.java:1248) @ org.apache.tools.ant.main.runbuild(main.java:851) @ org.apache.tools.ant.main.startant(main.java:235) @ org.apache.tools.ant.launch.launcher.run(launcher.java:280) @ org.apache.tools.ant.launch.launcher.main(launcher.java:109) total time: 0 seconds
some of files follows.
build.xml:
<?xml version="1.0"?> <project name="springapp" basedir="." default="usage"> <presetdef name="javac"> <javac includeantruntime="false" /> </presetdef> <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> <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 application"/> <echo message="deploy --> deploy application directory"/> <echo message="deploywar --> deploy application 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 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 don't have tomcat installed --> <!-- ============================================================== --> <path id="catalina-ant-classpath"> <!-- need catalina jars tomcat --> <!-- * other app servers - check docs --> <fileset dir="${appserver.lib}"> <include name="catalina-ant.jar"/> <include name="tomcat-coyote.jar"/> <include name="tomcat-util.jar"/> </fileset> <fileset dir="${appserver.home}/bin"> <include name="tomcat-juli.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}/text" username="${tomcat.manager.username}" password="${tomcat.manager.password}"/> </target> <!-- end tomcat tasks --> </project>
build.properties:
# ant properties building springapp appserver.home=/usr/share/tomcat7 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
how solve problem?
you need start tomcat before try access resources, , possibly need deploy application well
Comments
Post a Comment