环境:

idea ce 2018.1+maven3.5.3+mysql8.0.11+jdk1.8

spring4.3.7+spring mvc4.3.7+mybatis3.4.1+tomcat7.0.47(插件)

出现问题:

1、class path resource [xxxxxxxxx] cannot be opened because it does not exist(已经解决,下面见)

2、 No mapping found for HTTP request with URI [xxxxx] in DispatcherServlet with name 'DispatcherServlet'(问题未能复现,未能解决)

3、数据库连接池链接不上,具体描述如下:

Fri Jun 01 11:33:22 CST 2018 WARN:
Establishing SSL connection without server's identity verification is not recommended.
According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set.
For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'.
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

解决:

在高版本的mysql中需要使用SSL,在jdbc.url中加上"&useSSL=false"

4、java.sql.SQLException: Unknown system variable 'query_cache_size'

数据库版本和驱动版本不一致冲突

解决:

引入8.0.11的驱动包

    <!--mysql数据库驱动 -->
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
             <version>8.0.11</version>
         </dependency>

5、java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.

服务器时区没被识别或者多个时区同时存在

解决:

在jdbc.url加上"&serverTimezone=UTC"

备注:

utc 协调世界时

北京与UTC的时差均为+8,也就是UTC+8

jdbc url 完整写法

 jdbc.url&useSSL=false&serverTimezone=UTC

-----------------------------------------------------------分割线-----------------------------------------------------------

问题1和2:

src/main/resources ??????

classpath ??????

/WEB-INF/ ?????

描述:

1)、db.properties、applicationContext-mybatis.xml和applicationContext-springmvc.xml放在这里(src/main/resources)不起作用,

web.xml配置: classpath:applicationContext-mybatis.xml /  classpath:applicationContext-springmvc.xml /  classpath:db.properties

报错:class path resource [applicationContext-mybatis.xml] cannot be opened because it does not exist

说明idea没有扫描到以.properties和.xml结尾的文件

解决:

在pom.xml中加入下面代码:

  <build>
         <finalName>Idea</finalName>

             <!--扫描到xml文件-->
             <resources>
                 <resource>
                     <directory>src/main/java</directory>
                     <includes>
                         <include>**/*.xml</include>
                     </includes>
                 </resource>
                 <resource>
                     <directory>src/main/resources</directory>
                     <includes>
                         <include>**/*.xml</include>
                         <include>**/*.properties</include>
                     </includes>
                 </resource>
             </resources>
     </build>

可查看target文件下有相应的文件生成:

2)改变web.xml配置: classpath*:applicationContext-mybatis.xml /  classpath*:applicationContext-springmvc.xml /  classpath*:db.properties

上述文件位置还是放在src/main/resources中

idea有扫描到以.properties和.xml结尾的文件,但是报错:

org.springframework.web.servlet.PageNotFound noHandlerFound

警告: No mapping found for HTTP request with URI [/showUser/1] in DispatcherServlet with name 'DispatcherServlet'()(问题未能复现,未能解决)

3)、applicationContext-mybatis.xml和applicationContext-springmvc.xml放在/WEB-INF/ , db.properties放在src/main/resources中,以上能正常运行。

applicationContext-mybatis.xml中配置:

 <context:property-placeholder location="classpath*:db.properties"/>

或者:

 <context:property-placeholder location="classpath:db.properties"/>

maven工程用到的依赖:

     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <spring.version>4.3.7.RELEASE</spring.version>
         <mybatis.version>3.4.1</mybatis.version>
     </properties>

     <dependencies>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.11</version>
             <scope>test</scope>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-core</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-beans</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-jdbc</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-tx</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-webmvc</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-test</artifactId>
             <version>${spring.version}</version>
         </dependency>

         <dependency>
             <groupId>org.aspectj</groupId>
             <artifactId>aspectjweaver</artifactId>
             <version>1.8.9</version>
         </dependency>

         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
             <version>8.0.11</version>
         </dependency>

        <!-- <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
             <version>5.1.38</version>
         </dependency>-->

         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-core</artifactId>
             <version>2.6.1</version>
         </dependency>

         <dependency>
             <groupId>org.mybatis</groupId>
             <artifactId>mybatis</artifactId>
             <version>${mybatis.version}</version>
         </dependency>

         <dependency>
             <groupId>org.mybatis</groupId>
             <artifactId>mybatis-spring</artifactId>
             <version>1.3.1</version>
         </dependency>

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

         <!--<dependency>
             <groupId>javax</groupId>
             <artifactId>javaee-api</artifactId>
             <version>7.0</version>
         </dependency>-->

  <!--       <dependency>
             <groupId>jstl</groupId>
             <artifactId>jstl</artifactId>
             <version>1.2</version>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
             <version>3.0.1</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javax.servlet.jsp</groupId>
             <artifactId>jsp-api</artifactId>
             <version>2.1</version>
             <scope>provided</scope>
         </dependency>-->
     </dependencies>

备注:

有个问题未解决

spring ----> 搭建spring+springmvc+mybatis出现的几个问题的更多相关文章

  1. 使用intellij idea搭建MAVEN+springmvc+mybatis框架

    原文:使用intellij idea搭建MAVEN+springmvc+mybatis框架 1.首先使用idea创建一个maven项目 2.接着配置pom.xml,以下为我的配置 <projec ...

  2. spring boot整合 springmvc+mybatis

    需要以下依赖 <dependencies> <dependency> <groupId>org.springframework.boot</groupId&g ...

  3. 安装Spring+搭建Spring开发环境

    https://blog.csdn.net/csdnsjg/article/details/80152815 https://jingyan.baidu.com/article/219f4bf798e ...

  4. 记录:springmvc + mybatis + maven 搭建配置流程

    前言:不会配置 spring mvc,不知道为什么那样配置,也不知道从何下手,那么看这里就对了. 在 IDEA 中搭建 maven + springmvc + mybatis: 一.在 IDEA 中首 ...

  5. IDEA下使用maven构建web项目(SpringMVC+Mybatis整合)

    需求背景:由于最近总是接到一些需求,需要配合前端团队快速建设移动端UI应用或web应用及后台业务逻辑支撑的需求,若每次都复用之前复杂业务应用的项目代码,总会携带很多暂时不会用到的功能或组件,这样的初始 ...

  6. 基于Spring+SpringMVC+Mybatis的Web系统搭建

    系统搭建的配置大同小异,本文在前人的基础上做了些许的改动,重写数据库,增加依据权限的动态菜单的实现,也增加了后台返回json格式数据的配置,详细参见完整源码. 主要的后端架构:Spring+Sprin ...

  7. IDEA中maven搭建Spring+SpringMVC+mybatis项目

    一.介绍 使用IDEA搭建maven web项目,整合框架Spring+SpringMVC+mybatis 项目结构图:

  8. Spring+SpringMvc+Mybatis框架集成搭建教程

    一.背景 最近有很多同学由于没有过SSM(Spring+SpringMvc+Mybatis , 以下简称SSM)框架的搭建的经历,所以在自己搭建SSM框架集成的时候,出现了这样或者那样的问题,很是苦恼 ...

  9. spring+springMVC+mybatis的框架项目基础环境搭建

    上一个项目在后台用到spring+springMVC+mybatis的框架,先新项目初步需求也已经下来,不出意外的话,应该也是用这个框架组合. 虽然在之前activiti相关的学习中所用到的框架也是这 ...

随机推荐

  1. P3380 【模板】二逼平衡树(树套树)

    思路 若opt=1 则为操作1,之后有三个数l,r,k 表示查询k在区间[l,r]的排名 若opt=2 则为操作2,之后有三个数l,r,k 表示查询区间[l,r]内排名为k的数 若opt=3 则为操作 ...

  2. Newcoder Metropolis(多源最短路 + Dijkstra堆优化)题解

    题目链接:https://www.nowcoder.com/acm/contest/203/I?tdsourcetag=s_pcqq_aiomsg来源:牛客网 思路:我们用用fa[i]表示距离i最近的 ...

  3. JWT、OAUTH2与SSO资料补充

    JWT: 阮一峰:http://www.ruanyifeng.com/blog/2018/07/json_web_token-tutorial.html https://blog.csdn.net/q ...

  4. switch反汇编(C语言)

    在分支较多的时候,switch的效率比if高,在反汇编中我们即可看到效率高的原因 0x01分支结构不超过3个 #include <stdio.h> void main() { int x ...

  5. C#DataTable 使用GroupBy方法的lamda 表达式和Linq语句写法

    https://www.cnblogs.com/johnblogs/p/6006867.html DataTable ds = new DataTable(); //1.lamda 表达式写法(推荐) ...

  6. LOJ121 「离线可过」动态图连通性

    思路 动态图连通性的板子,可惜我不会在线算法 离线可以使用线段树分治,每个边按照存在的时间插入线段树的对应节点中,最后再dfs一下求出解即可,注意并查集按秩合并可以支持撤销操作 由于大量使用STL跑的 ...

  7. Deep Learning framework --- MexNet 安装,测试,以及相关问题总结

    Deep Learning framework --- MexNet 安装,测试,以及相关问题总结  一.安装:   参考博文:http://www.open-open.com/lib/view/op ...

  8. OAuth的MVC实现(微软)

    LoginController中: 第三方登陆 public ActionResult LogOn() { string liveUrl = string.Format( "https:// ...

  9. javascript创建函数的20种方式汇总

    http://www.jb51.net/article/68285.htm 工作中常常会创建一个函数来解决一些需求问题,以下是个人在工作中总结出来的创建函数20种方式,你知道多少? function ...

  10. HDU 4104 Discount(n个数不能构成的最小值)

    http://acm.hdu.edu.cn/showproblem.php?pid=4104 题意:给出n个数,每个数最多只能用一次,每次可以选任意个数相加,求不能相加得到的最小值是多少. 思路: 先 ...