The java.lang.NoClassDefFoundError problem of jdom parsing xml file

Source: Internet
Author: User
<?xml version= "1.0" encoding= "UTF-8"?> <beans> <bean id= "V" class= "Cn.establishing.factory.spring.Car "></bean> <!--collaborators and configuration for this bean go--> <!--v=" Cn.establishing.factory . Spring.
Car "--> </beans> java code is: import java.io.IOException;

Import java.util.List;
Import org.jdom.Document;
Import org.jdom.Element;
Import org.jdom.JDOMException;
Import Org.jdom.input.SAXBuilder;


Import Org.jdom.xpath.XPath;
        public class Sample1 {public static void main (String []args) {Saxbuilder sb=new saxbuilder ();
        Document Doc=null;
            
        try {doc = Sb.build ("Src/applicationcontext.xml");
        catch (Jdomexception e) {//TODO auto-generated catch block E.printstacktrace ();
        catch (IOException e) {//TODO auto-generated catch block E.printstacktrace ();
        System.out.println (DOC); Element Root=dOc.getrootelement ();
        System.out.println (root);
        try {List list=xpath.selectnodes (root, "/beans/bean");
        catch (Jdomexception e) {//TODO auto-generated catch block E.printstacktrace ();
    Why do the following problems always occur at run time: Exception in thread "main" java.lang.noclassdeffounderror:org/jaxen/jaxenexception At JAVA.LANG.CLASS.FORNAME0 (Native to Java.lang.Class.forName (Unknown Source) at Org.jdom.xpath.XPath.newI Nstance (xpath.java:134) at Org.jdom.xpath.XPath.selectNodes (xpath.java:345) at Cn.xml.jdom.demo.Sample1.main (Sampl
 E1.JAVA:33) Solution:
Package is not all caused by it, Jdom rely on 4 packets Jaxen.jar,xalan.jar,xerces.jar,xml-apis.jar, download jdom in the decompression after the Lib

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.