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);
}
}