I have upgraded my J2EE web application from jdk6,tomcat6 to jdk7 and tomcat7 but while deploying teamcity is giving following error.
[xmltask] java.lang.NoClassDefFoundError: org/apache/xpath/XPathAPI
java.lang.NoClassDefFoundError: org/apache/xpath/XPathAPI
at com.oopsconsultancy.xmltask.jdk14.XPathAnalyser14.analyse(XPathAnalyser14.java:29)
at com.oopsconsultancy.xmltask.XmlReplace.apply(XmlReplace.java:72)
at com.oopsconsultancy.xmltask.XmlReplacement.apply(XmlReplacement.java:61)
at com.oopsconsultancy.xmltask.ant.XmlTask.processDoc(XmlTask.java:707)
at com.oopsconsultancy.xmltask.ant.XmlTask.execute(XmlTask.java:676)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.ClassNotFoundException: org.apache.xpath.XPathAPI
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 25 more
The missing class is contained in xalan-2.7.0 (See Maven central). So I think the problem is how your classpath has been set.
Considering that this appears to be an error reported by the xmltask task, does this mean the error is being thrown by ANT?
Google found the following example which might be the answer to your problems:
Add the xalan jar to the classpath of your taskdef:
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath>
<pathelement path="${common.lib.dir}/xmltask-1.15.1.jar" />
<pathelement path="${common.lib.dir}/xalan-2.7.1.jar"/>
</classpath>
</taskdef>
if using maven add this to your dependencies section:
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With