tags:

views:

36

answers:

1

Hi, I am making a web application using spring mvc and hibernate and I am getting a very strange error from tomcat 7 console output stating this:

13-Sep-2010 08:27:18 org.apache.catalina.startup.HostConfig checkResources INFO: Undeploying context [/ZangV3Spring] 13-Sep-2010 08:27:18 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ZangV3Spring.war 13-Sep-2010 08:27:20 org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(C:\Users\xxxxx\Various stuff\apache-tomcat-7.0.0-windows-x86\apache-tomcat-7.0.0\webapps\ZangV3Spring\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 13-Sep-2010 08:27:21 org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart 13-Sep-2010 08:27:21 org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/ZangV3Spring] startup failed due to previous errors

Any ideas how to fix this error?

Here is my build.xml:

<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="ZangV3Spring"/>

<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="${deploy.path}/${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>
 <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}"
              password="${tomcat.manager.password}"/>
 </target>

And below is my build.properties file:

# Ant properties for building the springapp

appserver.home=C:/Users/xxxxx/Various stuff/apache-tomcat-7.0.0-windows-x86/apache-tomcat-7.0.0/
# 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
tomcat.manager.username=
tomcat.manager.password=

And here is my lib folder:

http://i.imgur.com/lI1qD.jpg

A: 

If i delete the servlett-api.jar file it wont build or compile as any code i use to refence a servlett breaks.

examples is that i can no longer use this:

import javax.servlet.http.HttpServletRequest;

this is the error im getting now [QUOTE]13-Sep-2010 12:22:45 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ZangV3Spring.war 13-Sep-2010 12:22:49 org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart 13-Sep-2010 12:22:49 org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/ZangV3Spring] startup failed due to previous errors 13-Sep-2010 12:22:49 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/ZangV3Spring] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 13-Sep-2010 12:22:59 org.apache.catalina.startup.HostConfig checkResources INFO: Undeploying context [/ZangV3Spring] 13-Sep-2010 12:22:59 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ZangV3Spring.war 13-Sep-2010 12:23:03 org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart 13-Sep-2010 12:23:03 org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/ZangV3Spring] startup failed due to previous errors [/QUOTE]

this is how my web.xml looks like

[QUOTE]

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>



<!-- -->

<!-- Register and setup my servlet xml files here -->

<servlet>
    <servlet-name>appStore</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value></param-value>
    </init-param>
</servlet>



<servlet-mapping>
    <servlet-name>appStore</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>



<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/zang-file-service.xml
    </param-value>
</context-param>

[/QUOTE]

jonney