2017-07-29 82 views
-1
org.apache.catalina.core.StandardContext listenerStart 
    SEVERE: Exception sending context initialized event to listener instance of 
    class org.springframework.web.context.ContextLoaderListener 
    java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration 

我瞪大眼睛我的問題,但都被給予同樣的解決方案,以增加休眠罐子在webapp庫的構建路徑,其首先我完成了。仍然沒有解決。我嘗試過不同版本的罐子。但問題依然存在。我得到拋出java.lang.ClassNotFoundException:org.hibernate.cfg.Configuration例外

請找web應用程序庫屏幕在這裏拍攝

WebApp library

添加更新部署大會

Updated Deployment Assembly

+0

你正在使用什麼構建工具? – emotionlessbananas

+0

我沒有使用任何。我正在使用Eclipse IDE。服務器 - Tomcat –

+0

如果是'動態web項目,那麼'右鍵單擊項目 - > Build Path - > Configure Build Path'然後在左邊的列表中點擊Deployment Assembly。點擊「添加」按鈕。選擇「Java Build Path Entries」並點擊下一步。現在選擇您的hibernate jar文件或庫。點擊完成。點擊確定 – emotionlessbananas

回答

1

你需要添加hibernate依賴關係,您可以在下面找到它:

<dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>ejb3-persistence</artifactId> 
     <version>1.0.2.GA</version> 
    </dependency> 

    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-annotations</artifactId> 
     <version>3.5.6-Final</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-commons-annotations</artifactId> 
     <version>3.2.0.Final</version> 
    </dependency> 
    <dependency> 

     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-entitymanager</artifactId> 
     <version>5.1.0.Final</version> 
    </dependency> 
+0

我沒有使用任何構建工具。我只使用Eclipse IDE並在tomcat –

+0

上運行應用程序,然後手動下載jar文件。將jar文件放入WEB-INF> lib文件夾並添加到builtpath中,轉到項目屬性> java built path> libraries>添加外部jar文件 –

+0

我已經添加了jar文件。我附上了我的構建路徑的屏幕截圖。請看一看。 –

相關問題