SSM(SpringMVC+Spring+Mybatis)框架程序on IDEA

有了之前文章搭建的SSH框架之后,现在搭建基于Mybatis的框架。主要基于如下这篇文章:

http://blog.csdn.net/gallenzhang/article/details/51932152

同时也下载了源代码,放在:/Users/baidu/Documents/Data/Interview/Java/SSM in IDEA/web-ssm

在创建项目的时候,记得加上properties里的archetypeCatalog=internal

按照文章中的处理配置和coding之后,发现怎么都部署不了,主要报的错是:

mybatis sqlSessionFactory  Initialization of bean failed

以及

NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

开始以为是Spring配置哪里不对,折腾了很久,没有解决。

然后把源代码部署之后,一下子就可以了。

把源代码目录和文件拷贝到新的工程,又不可以。

非常诡异的问题。

后来搜索之后,觉得可能是缺少某个依赖:commons-pool,于是加上了:

<!-- https://mvnrepository.com/artifact/commons-pool/commons-pool -->
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
</dependency>

能够看到依赖jar包有更新,然后就可以通过了。

不过奇怪的是为什么源代码里没有添加这个依赖,也是可以的。

一些源码位置:

/Users/baidu/Documents/Data/Work/Code/Self/web-ssm/

原文地址:https://www.cnblogs.com/charlesblc/p/5906431.html