1、添加完相关jar包,写完配置文件,写完测试类,运行提示

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

这个是因为jdbcurl配置要改为

jdbcUrl=jdbc:mysql://localhost:3306/gss?useUnicode=true&characterEncoding=utf8&useSSL=true

2、继续运行报如下错误:

org.hibernate.exception.GenericJDBCException: Cannot open connection
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!

Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.

网上大多解决方案都是检查数据库连接 驱动 用户名 密码是否正确 附上我的配置:

jdbcUrl=jdbc:mysql://localhost:3306/gss?useUnicode=true&characterEncoding=utf8&useSSL=true
driverClass=com.mysql.jdbc.Driver
user=root
password=root
initialPoolSize=10
maxPoolSize=30    

3、依然报上面的错误,N Hours后发现是mysql驱动jar包问题,用的6.0.2,换成5.1.32就可以了

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

4、解决Failed to load class "org.slf4j.impl.StaticLoggerBinder"

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
官网上刊登的解决办法是: 
      This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
其实就是添加一个叫做slf4j-log4j12-1.5.11.jar的包进行转换就可以了,注意版本号。
 

5、 Intellij配置完xml后找不到xml,但是按CTRL又能点击过去

ERROR [RMI TCP Connection(3)-127.0.0.1] ContextLoader:351 - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [cn/god/nsfw/user/conf/user-spring.xml]
Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file:/D:/javaCode/projects/tax/target/god/WEB-INF/classes/cn/god/nsfw/user/conf/user-spring.xml]; nested exception is java.io.FileNotFoundException: D:\javaCode\projects\tax\target\god\WEB-INF\classes\cn\god\nsfw\user\conf\user-spring.xml (系统找不到指定的路径。)

这个需要把xml所在文件夹设置成Resource就可以了。

6、测试hibernate自动建表,报错

       Hibernate: insert into news_table (title, content) values (?, ?)
       Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [org.crazyit.app.domain.News]

      …………此处省略
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hibernate.news_table' doesn't exist

      …………此处省略

<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>

把这行换成:

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

但是不知道为什么。。。。。

搭建SSH入过的那些坑的更多相关文章

  1. 在windows上搭建SSH服务踩过的坑

    前两天安装了windows操作系统,想在windows上做内网穿透,所以就想在windows下启用ssh服务,今天就来讲一下我在搭建ssh服务中遇到的坑. 我显示在Mac下搭建了ssh服务,并且测试通 ...

  2. Linux搭建SSH服务器

    Linux 远程登录服务:ssh ·SSH是标准的网络协议,可用于大多数UNIX操作系统,能够实现字符界面的远程登录管理,它默认使用22号端口,采用密文的形式在网络中传输数据,相对于通过明文传输的Te ...

  3. 搭建SSH环境之添加所需jar包

    一.首先介绍要添加框架环境: JUnit Struts2 Hibernate Spring (1)配置JUnit /**-------------------------添加JUnit-------- ...

  4. 搭建SSH

    搭建SSH详细步骤及相关说明   因为手里已有相关jar,为方便我搭建的是:Struts2.0+Hibernate3.3+Spring3.0,数据库:MySQL 如果想搭建最新的,在官网上下载最新ja ...

  5. Mac下maven工程的创建,并搭建SSH环境

    最近项目有用到maven,就特地学了一下.maven的一句话攻略就是,项目托管.帮你解决各种项目琐事:清理,导包....等等. 首先先到apach官网去下载一个maven的包,http://maven ...

  6. Eclipse搭建SSH(Struts2+Spring+Hibernate)框架教程

    | 版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 确实,刚创博客,对于这个陌生的东西还是有些许淡然.这是我的第一篇博文,希望能给你们有帮助,这就是我最大的乐趣! 好了下面进入正题: SS ...

  7. 用eclipse搭建SSH(struts+spring+hibernate)框架

    声明: 本文是个人对ssh框架的学习.理解而编辑出来的,可能有不足之处,请大家谅解,但希望能帮助到大家,一起探讨,一起学习! Struts + Spring + Hibernate三者各自的特点都是什 ...

  8. myeclipse搭建SSH框架

    搭建SSH框架 Struts+hibernater+spring架构(myeclipse) 右击,首先加入spring,加入hibernater,再加入struts2 复制jar包(把tomcat发布 ...

  9. MyEclipse8.5快速搭建SSH框架

    来源于:http://jingyan.baidu.com/article/a378c960a78125b3282830cc.html MyEclipse8.5快速搭建SSH框架 使用版本: Strut ...

随机推荐

  1. TI CC2541的GPIO引脚设置.

    P1SEL寄存器, 0xF4, 功能选择用的, 0表示GPIO口, 1表示外设.

  2. TI BLE CC2541的通讯协议.

    包类型: 01命令/02数据/03应答消息 开始标志FF/本数据包长度(注意是16进制)/校验码/包ID/包类型01: 表示是命令/01表示下面要开始传输/03字符串编号/字符串长度/结束位FEFF  ...

  3. Android 常用工具类之SPUtil,可以修改默认sp文件的路径

    参考: 1. 利用Java反射机制改变SharedPreferences存储路径    Singleton1900 2. Android快速开发系列 10个常用工具类 Hongyang import ...

  4. [PHP100] PHP如何防止注入及开发安全

    1.PHP注入的基本原理 程序员的水平及经验也参差不齐,相当大一部分程序员在编写代码的时候,没有对 用户输入数据的合法性进行判断,使应用程序存在安全隐患.用户可以提交一段数据 库查询代码,根据程序返回 ...

  5. Java学习网站

    黑马: http://bbs.itheima.com/forum.php 考试网站: http://www.nowcoder.com/ 牛客网 比较专业的学习技术网站: http://www.ibm. ...

  6. recyclview多条目布局

    多条目基础 http://blog.csdn.net/fangchao3652/article/details/43148871 添加底部加载更多 http://blog.csdn.net/fangc ...

  7. 利用反射及jdbc元数据实现通用的查询方法

    ---------------------------------------------------------------------------------------------------- ...

  8. poj2482 Stars in Your Window

    此题可用线段树或静态二叉树来做. 考虑用线段树: 很容易想到先限定矩形横轴范围再考虑在此纵轴上矩形内物品总价值的最大值. 那么枚举矩形横轴的复杂度是O(n)的,考虑如何快速获取纵轴上的最大值. 我们不 ...

  9. 使用opencv自带的融合函数

    [wiki,blog]使用opencv自带的融合函数 [wiki,blog]使用opencv自带的融合函数 /*M/////////////////////////////////////////// ...

  10. 查看Mac电脑的开机记录

    回家以后,发现电脑前的地面上有烟灰.我记不住是不是我抽烟时掉的了.当然,如果不是我掉的,就是别人掉的了.要是别人掉的,估计是坐在我这玩儿电脑的时候掉的了.查一下开机记录吧.打开终端,输入“last|g ...