Solved

SAXParserImpl.getXMLReader error

Posted on 2004-08-10
6
352 Views
Last Modified: 2008-02-01
I have 2 methods createFile() and addInfo() methods in my program. I call createFile() and addInfo() one after the other. I am getting exception only on one of my friend's PC. Does it have to do with the environment?

Code:
--------


      /**This method creates XML file with unique name       
       *
       */
      private void createFile() {
            try {
                  File xmlMDirectory = new File(MDIR);
                  if (!xmlMDirectory.exists()) {
                        xmlMDirectory.mkdirs();
                  }

                  File file = new File(_mFileName);
                  if (!file.exists()) {
                        PrintWriter fileOut;
                        fileOut = new PrintWriter(new FileWriter(_mFileName, false));
                        fileOut.write("<?xml version=\"1.0\"?>");
                        fileOut.write("<MOP/>");
                        fileOut.close();
                  } else {
                        System.out.println("The File already exists");
                  }
            } catch (Exception e) {
                  System.err.println(e);
            }
      }

      /**This method adds the user input to XML
       *       
       */
      private void addInfo() {

            File _mopFile = new File(_mFileName);
            System.out.println("I am fine at 1");
            SAXBuilder builder = new SAXBuilder();
            System.out.println("I am fine at 2");
            Document doc;
            System.out.println("I am fine at 3");

            try {
                  doc = builder.build(_mFile); //Loading the XML into memory
                  System.out.println("I am fine at 4");
----------------------------------------------

It throws xception at " doc = builder.build(_mFile); //Loading the XML into memory"

Exception:
----------------

java.lang.AbstractMethodError: org.apache.xerces.jaxp.SAXParserImpl.getXMLReader
()Lorg/xml/sax/XMLReader;
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:295)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:464)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:445)

Thanks.
0
Comment
Question by:Joegal
6 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 25 total points
ID: 11767109
Hi,
it seems llike problem occurs due yo usage of java1.4 which has included XML Parser (Apache xerces), but you are using JDom for xml parsing.
Two possibilities are available here:
1. Recompile your program before execution on your friends PC.
2. Add jdom jar files into  endorsed  directory of the JRE14 lib directory
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 25 total points
ID: 11770478
The getXMLReader () method seems to be abstract.
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 25 total points
ID: 11770499
Check what version of java both PCs have.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now