0
我剛開始學習Java並在某個簡單的問題上陷入困境。 我建議使用Spring框架,爲此我下載了SpringSource Tool Suite安裝程序,雙擊並安裝它。SpringSource構建一個示例程序
當我運行簡單的hello世界應用程序它的作品。但是當我嘗試使用彈簧框架的類之一時,我得到了錯誤「線程主java.lang.NoClassDefFoundError異常:org/apache/commons/logging/LogFactory ...」
當我單擊以查看行發生錯誤我得到了「JAR文件...沒有源附件。」
來源在哪裏?
我的代碼:
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());
}
}
}
我真的很感激任何幫助......