试图连接到的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