facebook

org/xml/sax/ErrorHandler problem with spring

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #242645 Reply

    vickyk24
    Member

    i’m new to spring and trying to configure using XML file:

    can anyone please let me know why iam getting the error below:
    java.lang.NoClassDefFoundError: org/xml/sax/ErrorHandler
    at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:47)
    at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:56)
    at com.apress.prospring.ch4.HelloWorldXml.getBeanFactory(HelloWorldXml.java:34)
    at com.apress.prospring.ch4.HelloWorldXml.main(HelloWorldXml.java:22)
    Exception in thread “main”

    class i’m using to run this file.

    package com.apress.prospring.ch4;

    import org.springframework.beans.factory.BeanFactory;
    import org.springframework.beans.factory.xml.XmlBeanFactory;
    import org.springframework.core.io.FileSystemResource;
    import org.springframework.core.io.Resource;

    import com.apress.prospring.ch2.MessageProvider;
    import com.apress.prospring.ch2.MessageRenderer;

    /**
    * @author robh
    */
    public class HelloWorldXml {

    public static void main(String[] args) throws Exception {

    // get the bean factory
    BeanFactory factory = getBeanFactory();

    MessageRenderer mr = (MessageRenderer) factory.getBean(“renderer”);
    MessageProvider mp = (MessageProvider) factory.getBean(“provider”);

    mr.setMessageProvider(mp);
    mr.render();
    }

    private static BeanFactory getBeanFactory() throws Exception {
    // get the bean factory
    Resource res = new FileSystemResource(“C:\\beans.xml”);
    BeanFactory factory = new XmlBeanFactory(res);
    return(cactory);
    }
    }

    #242661 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    Be sure to run your code with Java 1.4 or greater, that is where org.xml.sax package is comming from.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: org/xml/sax/ErrorHandler problem with spring

You must be logged in to post in the forum log in