在整合ssm框架的時候出現了一些錯誤,在這裏記錄一下解決方法 。以供參考:
1.Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountService': Initialization of bean failed; nested exception is java.lang.AbstractMethodError
2.Handler dispatch failed; nested exception is java.lang.AbstractMethodError: Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.isClosed()Z is abstract
3.
The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml or the jar files deployed with this application
錯誤1:sqlsessionfactory 創建失敗無法注入
應該是配置文件出現問題
我在檢查之後,發現在applicationContextxml文件中配置工廠出現錯誤
在引入連接池配置的時候,把標籤名寫成value 所以總是創建失敗
<!--配置SqlSessionFactory工廠-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- <property name="dataSource" value="dataSource"-->
錯誤2:c3p0連接池錯誤,這個原因是由於版本太低導致的
我使用的數據庫是8.0版本,把數據庫連接池版本調整到0.9.5.1 發現還是這個錯,
於是去maven官網發現最高版本是0.9.5.4 改用此版本,問題解決
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.4</version>
</dependency>
錯誤3:[http://java.sun.com/jsp/jstl/core 在jsp文件中共引入,但是pom.xml中沒有進行相應配置,所以報錯
需要配置jstl
<!--jstl 配置-->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
</dependency>
修改後,運行成功!