Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3318084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:39:50+00:00 2026-05-17T22:39:50+00:00

Could anybody tell me why I’m getting this error, and how to fix the

  • 0

Could anybody tell me why I’m getting this error, and how to fix the problem?

Exception in thread “main” java.lang.NoClassDefFoundError: org/codehaus/stax2/ri/Stax2ReaderAdapter
at org.codehaus.staxmate.dom.DOMConverter._build(DOMConverter.java:188)
at org.codehaus.staxmate.dom.DOMConverter.buildDocument(DOMConverter.java:171)
at org.codehaus.staxmate.dom.DOMConverter.buildDocument(DOMConverter.java:152)
at org.codehaus.staxmate.dom.DOMConverter.buildDocument(DOMConverter.java:131)
at xmlprocessing.api.STAXModifyCV.main(STAXModifyCV.java:68)
Caused by: java.lang.ClassNotFoundException: org.codehaus.stax2.ri.Stax2ReaderAdapter
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
… 5 more
Java Result: 1

I wrote the code below:

    //-*-*-
    FileInputStream input = new FileInputStream("cv.xml");
    XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(input);
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    //-*-*- get new entries from input stream
    System.out.println("<< Sahar CV >>\n -> Modify the first reference\n    ** Modify The Name **");
    System.out.print("    Enter degree : ");
    String degree = in.readLine();
    System.out.print("    Enter first name : ");
    String fName = in.readLine();
    System.out.print("    Enter last name : ");
    String lName = in.readLine();
    System.out.println("    ** Modify The Address ** ");
    System.out.print("    Enter new city : ");
    String newCity = in.readLine();
    System.out.print("    Enter new country : ");
    String newCountry = in.readLine();

    //-*-*- let the reader point at the first "reference" element
    int eventType;
    boolean ref = false, fname = false;
    while (!ref && reader.hasNext()) {
        eventType = reader.next();
        switch (eventType) {
            case XMLEvent.START_ELEMENT:
                if (reader.getLocalName().equalsIgnoreCase("references")) {
                    ref = true;
                    break;
                }
        }
    }
    System.out.println("I am here");

    //-*-*- start modification
    Document doc = new DOMConverter().buildDocument(reader);
    Element firstRef = (Element)doc.getElementsByTagName("reference").item(0);
    NodeList name = (NodeList)firstRef.getElementsByTagName("name");
    //-*-*- modify the degree (Dr. , Eng. , Dev. ,etc)
    Attr att = (Attr)name.item(0).getAttributes().item(0);
    ((Node)att).setNodeValue(degree);
    //-*-*- modify first name
    NodeList firstName = (NodeList)firstRef.getElementsByTagName("fname");
    NodeList firstNameChilds = (NodeList)firstName.item(0).getChildNodes();
    ((Node)firstNameChilds.item(0)).setNodeValue(fName);
    //-*-*- modify last name
    NodeList lastName = (NodeList)firstRef.getElementsByTagName("lname");
    NodeList lastNameChilds = (NodeList)lastName.item(0).getChildNodes();
    ((Node)lastNameChilds.item(0)).setNodeValue(lName);
    //-*-*- modify city
    NodeList city = (NodeList)firstRef.getElementsByTagName("city");
    NodeList cityChilds = (NodeList)city.item(0).getChildNodes();
    ((Node)cityChilds.item(0)).setNodeValue(newCity);
    //-*-*- modify country
    NodeList country = (NodeList)firstRef.getElementsByTagName("country");
    NodeList countryChilds = (NodeList)country.item(0).getChildNodes();
    ((Node)countryChilds.item(0)).setNodeValue(newCountry);

    reader.close();
    input.close();
    //-*-*- write DOM document
    FileOutputStream out = new FileOutputStream("cv.xml");
    XMLStreamWriter sw = XMLOutputFactory.newInstance().createXMLStreamWriter(out);

    new DOMConverter().writeDocument(doc, sw);
    sw.close();
    out.close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:39:51+00:00Added an answer on May 17, 2026 at 10:39 pm

    Sorry I voted down on the 3 answers but suddenly had a doubt and needed to double check what I thought … and it ended up being more complex than I thought. However I found a very complete answer for you here:
    http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could anybody tell me what is wrong with this code ?? jQuery(document).ready(function(){ var val
Can anybody please explain how this could possibly happen? I am completely aware of
Could anybody tell me some simple and practical Single Sign-On and Single Sign-Off solutions
Could anybody tell me how I can override HashSet's contains() method to use a
Could anybody tell me how to create something like the hint/labels on Apple's MobileMe
Could anybody tell me with the pseudo class :active from css only works in
Could anybody tell me how it is possible in perl to go one line
Could anybody tell me about webservice or any RSS feed which wil return Latitude
Could anybody explain in plain words how Cloud computing works? I have read the
Could anybody explain what is the cause of the following: >>> from M2Crypto import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.