SpringSource building a sample program
I just started to learning Java and get stucked at some simple point. I am suggested to use Spring framework and for that i downloaded SpringSource Tool Suite installer, double clicked and installed it.
When i run simple hello world application it works. But when i try to use one of spring frameworks' classes i got the error "Exception in thread main java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory..."
When i clicked to see the line where the error occured i got "The JAR File ... has no source attachment."
Where is the source?
My Code:
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;
import JavaBeanTest.Person;
public class ClassMain {
public static void main(String args[]) throws ClassNotFoundException {
try {
FileSystemResource resource = new FileSystemResource("c:/Person.xml");
BeanFactory factory = new XmlBeanFactory(resource);
Person person = (Person) factory.getBean("Person");
person.PrintName();
} catch (Exception err) {
System.out.println("mehmet");
System.out.println(err.getMessage());
}
}
}
i woul开发者_运维百科d really appreciate any help...
I'm not sure if you're still having this problem, but I would have a look at your java build path to make sure that the commons-logging jar is included. It's required directly by your project, so you are getting no compile time problems.
If you post your .classpath file here, I can have a look at it.
精彩评论