Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build error: NoClassDefFoundError: org/apache/xpath/XPathAPI [duplicate]

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
like image 901
Divya Avatar asked May 01 '14 10:05

Divya


2 Answers

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:

  • https://wiki.nci.nih.gov/display/NBIA/Migration+to+Java+7

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>
like image 66
Mark O'Connor Avatar answered Sep 19 '22 08:09

Mark O'Connor


if using maven add this to your dependencies section:

<dependency>
    <groupId>xalan</groupId>
    <artifactId>xalan</artifactId>
    <version>2.7.0</version>
</dependency>
like image 34
StarCrafter Avatar answered Sep 19 '22 08:09

StarCrafter