When using a project constructed with both Hibernate and Spring integration I am finding that the following code produces an error
NoClassDefFoundError: org/apache/commons/logging/LogFactory
Here is the code
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.InputStreamResource;
public class RecPayable {
// Log4J entity
static Logger logger = Logger.getLogger(RecPayable.class);
/**
* @param args
*/
public static void main(String[] args) {
// Set up the log4j configuration from the properties file.
String directory = System.getProperty("user.dir");
PropertyConfigurator.configure(directory + "/RecPayable.properties");
// Initialize the bean factory with the worlds simplest bean
InputStream is = null;
logger.info("This is a test");
try {
is = new FileInputStream(directory + "/beans.xml");
} catch (FileNotFoundException e) {
logger.error(e.getMessage());
return;
}
InputStreamResource ris = new InputStreamResource(is);
XmlBeanFactory factory = new XmlBeanFactory(ris);
}
}
Note that the Apache Commons library is available to the project as well as the Log4J library. Any clues?
Thanks