試圖連接到的Postgres數據庫,上下文參數情況如下:彈簧連接在Postgres數據庫
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
<property name="driverClassName" value="org.postgresql.Driver"/>
<property name="url" value="jdbc:postgresql://localhost:5432/****" />
<property name="username" value="****" />
<property name="password" value="****" />
</bean>
上下文裝載獲取例外:
重度:上下文初始化失敗 org.springframework。 beans.factory.BeanCreationException:錯誤 在ServletContext中定義了名稱爲'dataSource'的bean 資源[/WEB-INF/ApplicationContext.xml]:錯誤設置屬性 值;嵌套的異常是 org.springframework.beans.PropertyBatchUpdateException;嵌套0PropertyAccessExceptions(1):PropertyAccessException 1: org.springframework.beans.MethodInvocationException:屬性 'driverClassName'引發異常;嵌套的例外是 java.lang.IllegalStateException:無法加載JDBC驅動程序類 [org.postgresql.Driver]
我在該項目中的LIB Postgres的驅動程序,因爲我可以檢查類文件組織.postgresql.Driver。 Class.forName也給駕駛員級別帶來了積極的結果。 我試過所有版本的postgres驅動程序,但仍然沒有經過。
你使用的是maven/gradle嗎?你能發佈你的pom/build文件嗎? – Jigish 2014-11-22 01:37:25