Try   HackMD

c3p0報ComboPooledDataSource的錯誤

tags: Spring-錯誤紀錄

在進行springmvc的整合練習中,會顯示500錯誤
檢查Output跳出一條錯誤

Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.mchange.v2.c3p0.ComboPooledDataSource] from ClassLoader 

顯然是有關c3p0資源池的問題,因此紀錄有關解決的過程

1.更新c3p0到最新版

<dependency>
    <groupId>com.mchange</groupId>
    <artifactId>c3p0</artifactId>
    <version>0.9.5.5</version>
</dependency>

2.重新放入jar包

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

3.添加下面的代碼

<dependency>
    <groupId>com.mchange</groupId>
    <artifactId>mchange-commons-java</artifactId>
    <version>0.2.20</version>
</dependency>

解決

後來發現問題點在於兩點

1.重複安裝com.mchange

原先就已經安裝了0.2.11版,但沒有留意到,又安裝了0.2.20版

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

將其中一個刪除,只保留一個

2.安裝特定版本的com.mchange的jar包

安裝完0.2.20版的com.mchange後,檢查lib中是否是對應版本的jar包

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →