2013-05-01 72 views
1

Windows 7中的Java jdk1.6.0_32,螞蟻1.9問題的Java運行Ant時:noclassdef

用戶&系統變量:

JAVA_HOME:C:\ Program Files文件\的Java \ jdk1.6.0_32

PATH:C:\ Program Files \ Java \ jdk1.6.0_32; c:\ ant \ bin;

ANT_HOME:c:\ANT 

Run command prompt as administrator 
Microsoft Windows [Version 6.1.7601] 
Copyright (c) 2009 Microsoft Corporation. All rights reserved. 

H:\>c: 

C:\>w: 

W:\>cd webadvisor 

W:\WebAdvisor>cd wasql* 

W:\WebAdvisor\WASQLTEST3>c:\ant\bin\ant 
Buildfile: W:\WebAdvisor\WASQLTEST3\build.xml 

init: 

prepare: 
[echo] Preparing Update... 
[copy] Copying 208 files to W:\WebAdvisor\WASQLTEST3\temp 
[copy] Copying 129 files to W:\WebAdvisor\WASQLTEST3\temp 
[copy] Copying 49 files to W:\WebAdvisor\WASQLTEST3\temp 

splitdocs: 

merge-cleanup: 
[delete] Deleting: W:\WebAdvisor\WASQLTEST3\custom\WEB-INF\web.xml 

findwebxml: 

merge: 

datatelxmloverride: 

mergeDefault: 

BUILD FAILED 
W:\WebAdvisor\WASQLTEST3\build.xml:112: The following error occurred while executing this line: 
W:\WebAdvisor\WASQLTEST3\build.xml:165: The following error occurred while executing this line: 
W:\WebAdvisor\WASQLTEST3\build.xml:173: java.lang.NoClassDefFoundError: org/apache/xml/serialize/OutputFormat 
     at org.codehaus.cargo.module.webapp.WebXmlIo.writeWebXml(WebXmlIo.java:256) 
     at org.codehaus.cargo.module.webapp.WebXmlIo.writeWebXml(WebXmlIo.java:225) 
     at org.apache.cactus.integration.ant.WebXmlMergeTask.execute(WebXmlMergeTask.java:120) 
     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
     at 

回答

0

類路徑中缺少

org/apache/xml/serialize/OutputFormat 

檢查所需的罐子,如果你在你的classpath中有xercesImpl.jar

編輯

這可以通過包括設置需要在ant編譯目標中放入jar,並將所有需要的jar放在lib文件夾中。

<target name="compile" depends="" description="compile the java source files"> 
<javac srcdir="." destdir="${build}"> 
    <classpath> 
     <fileset dir="${lib}"> 
      <include name="**/*.jar" /> 
     </fileset> 
    </classpath> 
</javac> 
+0

我找到了一個名爲xercesImpl-2.6.2.jar的文件,並將其放在c:\ CLASSPATH = .; C:\ xercesImpl-2.6.2.jar;我還需要做什麼? – ScottM 2013-05-02 14:40:54

+0

然後包含在ant編譯classpath中。編輯包含在antlib文件夾中的答案 – NullPointerException 2013-05-02 14:48:38

+0

,它的工作方式像魔術一樣。謝謝@nullpointerexception – ScottM 2013-05-02 14:50:08

1

組織/阿帕奇/ XML /串行/ OUTPUTFORMAT是Xerces的類...搜索系統中的Xerces的* .jar。這個文件存在嗎?它在你的類路徑中嗎?

+0

我發現了一個名爲xercesImpl-2.6.2.jar的文件,並將它放在c:\ CLASSPATH = .; C:\ xercesImpl-2.6.2.jar; 我還需要做什麼? – ScottM 2013-05-02 14:34:30