Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

javax.xml.stream.FactoryConfigurationError: Provider  com.bea.xml.stream.MXParserFactory not found

Posted on 2004-11-02
6
Medium Priority
?
18,968 Views
Last Modified: 2011-08-18
import javax.xml.*;       
import javax.xml.namespace.*;       
import javax.xml.stream.*;       
import javax.xml.stream.events.*;       
import javax.xml.stream.util.*;       

import java.util.*;
import java.io.*;

class StaxExample1
{
      public static void main(String[] args)
                        throws FileNotFoundException, XMLStreamException {
      // Use the reference implementation for the XML input factory
      System.setProperty("javax.xml.stream.XMLInputFactory",
                                  "com.bea.xml.stream.MXParserFactory");
      // Create the XML input factory
      XMLInputFactory factory = XMLInputFactory.newInstance();
      // Create the XML event reader
      FileReader reader = new FileReader(args[0]);
      XMLEventReader r =
         factory.createXMLEventReader(reader);
      // Loop over XML input stream and process events
      while(r.hasNext()) {
         XMLEvent e = (XMLEvent)r.next();
         processEvent(e);
      }
   }
/**
 * Process a single XML event
 * @param e - the event to be processed
 */
  private static void processEvent(XMLEvent e) {
     if (e.isStartElement()) {
        QName qname = ((StartElement) e).getName();
        String namespaceURI = qname.getNamespaceURI();
        String localName = qname.getLocalPart();
        Iterator iter = ((StartElement) e).getAttributes();
        while (iter.hasNext()) {
           Attribute attr = (Attribute) iter.next();
           QName attributeName = attr.getName();
           String attributeValue = attr.getValue();
        }
     }
     if (e.isEndElement()) {
        QName qname = ((EndElement) e).getName();
     }
     if (e.isCharacters()) {
        String text = ((Characters) e).getData();
     }
     if (e.isStartDocument()) {
        String version = ((StartDocument) e).getVersion();
        String encoding = ((StartDocument) e).getCharacterEncodingScheme();
        boolean isStandAlone = ((StartDocument) e).isStandalone();
     }
  }
}



Here is an exception
Exception in thread "main" javax.xml.stream.FactoryConfigurationError: Provider
com.bea.xml.stream.MXParserFactory not found
        at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:120)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
        at StaxExample1.main(StaxExample1.java:22)



Please help me to resolve this problem

Thanks
Sudhakar  
0
Comment
Question by:sudhakar_koundinya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 13

Accepted Solution

by:
petmagdy earned 375 total points
ID: 12471194
is this "com.bea.xml.stream.MXParserFactory" in ur Classpath?
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12471195
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12471249
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:petmagdy
ID: 12471271
it is a jar called xbean.jar, I found this jar on my hard disk
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12471272
thanks I am able to resolve the issue

BTW,

will you have a glance on this link too

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21191121.html#12470383

0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12471287
I need to have following jars

http://dist.codehaus.org/stax/jars/

But I just download wls_stax.jar
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

618 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