2010-07-30 57 views
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()); 

} 

} 
} 

我真的很感激任何幫助......

回答

0

我不知道如果你仍然有這個問題,但我想看看你的java建立路徑以確保包含commons-logging jar。它是您的項目直接需要的,所以您不會遇到編譯時問題。

如果你在這裏發佈.classpath文件,我可以看看它。