Solved

SAXParserImpl.getXMLReader error

Posted on 2004-08-10
6
356 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:Mayank S
Mayank S 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Facing this issue for maven proxy setting 2 20
java example issue 3 23
restrict decimal places for double datatype 10 19
passing enum to a method 4 20
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

856 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