简体   繁体   中英

Ant javac: package does not exist

Trying to compile a Web Project here but I keep on getting package does not exist exception for tens of classes. Everything seems to be in classpath and yet it can't find it. Any hint on debugging this issue?

Exception:

 [javac] Compiling 73 source files to C:\workspace\SalesWeb\WebContent\WEB-INF\classes
 [javac] C:\workspace\SalesWeb\src\java\com\abc\xyz\supplier\interceptor\InfoInterceptor.java:8: package org.springframework.web.servlet does not exist
 [javac] import org.springframework.web.servlet.HandlerInterceptor;

Build.xml:

<?xml version="1.0" encoding="UTF-8"?>

<project basedir="." default="build" name="SalesWeb">
<property environment="env"/>
<property name="SalesWebTest.location" value="../SalesWebTest"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Web App Libraries.libraryclasspath">
    <pathelement location="WebContent/WEB-INF/lib/backport-util-concurrent-2.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/cxf-2.2.5.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/displaytag-1.1.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/dwr.3.rc1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/abc-frameworkx-web.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/abc-svc-framework-web-2008.1.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/ehcache-1.4.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/ezmorph-1.0.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/fdsapi-1.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/freemarker-2.3.8.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/jakarta-oro.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/jaxb-impl-2.1.13.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/joda-time-1.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/json-lib-2.4-jdk15.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/org.springframework.config.java-1.0.0.M4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/org.springframework.js-2.0.6.RELEASE.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/org.springframework.webflow-2.0.6.RELEASE.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/oscache-2.3.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/poi-3.5-FINAL-20090928.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/sitemesh-2.4.2.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/spring-security-taglibs-2.0.4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/spring-web.2.5.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/spring-webmvc.2.5.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/standard-1.1.2.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/urlrewritefilter-3.0.4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/velocity-1.4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/velocity-tools-view-1.0.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/wsdl4j-1.6.2.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/xwork-2.0.4.jar"/>
</path>
<path id="EAR Libraries.libraryclasspath">
    <pathelement location="../../../SalesWeb_C"/>
    <pathelement location="../../../SalesWeb_D"/>
    <pathelement location="../../../SalesWeb_J"/>
    <pathelement location="../../../SalesWeb_S"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-beanutils-1.8.0.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-collections-3.2.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-dbcp-1.2.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-digester-1.7.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-lang-2.5.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-logging-1.1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-pool-1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/aspectj/cglib-nodep-2.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/db/db2jcc.jar"/>
    <pathelement location="../SalesWeb_ear/lib/db/db2jcc_license_cisuz.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/JAMon.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/cryptix32.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/dsclass.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-framework-2008.1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-mid-2008.1.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-security-impl-2008.1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-security-impl-multitree-2008.1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/fdsapi-1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jce1_2-do.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jcert.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jnet.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jsse.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/providerutil.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/signon.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/xsdbeans-5.0.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/ldap40.jar"/>
    <pathelement location="../SalesWeb_ear/lib/logging/log4j-1.2.15.jar"/>
    <pathelement location="../SalesWeb_ear/lib/neethi-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/saaj-api-1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/saaj-impl-1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring.2.5.6.jar"/>
    <pathelement location="../SalesWeb_ear/lib/stax-utils-20060502.jar"/>
    <pathelement location="../SalesWeb_ear/lib/webservice/jaxws-api.jar"/>
    <pathelement location="../SalesWeb_ear/lib/webservice/wsdl4j-1.6.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/wstx-asl-3.2.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xml/XmlSchema-1.4.5.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xml/dom4j-1.6.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xml/xml-resolver-1.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring-security-core-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring-security-core-tiger-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring-security-taglibs-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-io-1.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/javassist-3.9.0.GA.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/jsr173_1.0_api.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/resolver.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xbean.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xbean_xpath.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xmlbeans-qname.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xmlpublic.jar"/>
    <pathelement location="../SalesWeb_ear/lib/commons-net-2.0.jar"/>
    <pathelement location="../../../SalesWeb_I"/>
    <pathelement location="../../../SalesWeb_RC"/>
    <pathelement location="../../../SalesWeb_R"/>
</path>

<path id="SalesWeb.classpath">
    <pathelement location="WebContent/WEB-INF/classes"/>
    <path refid="Web App Libraries.libraryclasspath"/>
    <path refid="EAR Libraries.libraryclasspath"/>

</path>


<target name="init">
    <mkdir dir="WebContent/WEB-INF/classes"/>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir="src/java" excludes="**/*.launch, **/*.java"/>
    </copy>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir="src/config" excludes="**/*.launch, **/*.java"/>
    </copy>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir="src/resources" excludes="**/*.launch, **/*.java"/>
    </copy>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir=".apt_generated" excludes="**/*.launch, **/*.java"/>
    </copy> 
</target>
<target name="clean">
    <delete dir="WebContent/WEB-INF/classes"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
    <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path="src/java"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
    <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path="src/config"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
    <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path="src/resources"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
    <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path=".apt_generated"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
</target>

Everything seems to be in classpath and yet it can't find it.

The key word there is "seems". The exception tells you that they're not.

I'd create an Ant CLASSPATH that includes what you need and try again.

http://ant.apache.org/manual/develop.html

Is the Spring JAR file in your WEB-INF/lib folder?

Everything should "just work" in this case...

Is it assumed to be packaged with your server?

You may have to add the path to the Spring JAR in your Eclipse project / ANT file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM