搭建SSH入过的那些坑
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.
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入过的那些坑的更多相关文章
- 在windows上搭建SSH服务踩过的坑
前两天安装了windows操作系统,想在windows上做内网穿透,所以就想在windows下启用ssh服务,今天就来讲一下我在搭建ssh服务中遇到的坑. 我显示在Mac下搭建了ssh服务,并且测试通 ...
- Linux搭建SSH服务器
Linux 远程登录服务:ssh ·SSH是标准的网络协议,可用于大多数UNIX操作系统,能够实现字符界面的远程登录管理,它默认使用22号端口,采用密文的形式在网络中传输数据,相对于通过明文传输的Te ...
- 搭建SSH环境之添加所需jar包
一.首先介绍要添加框架环境: JUnit Struts2 Hibernate Spring (1)配置JUnit /**-------------------------添加JUnit-------- ...
- 搭建SSH
搭建SSH详细步骤及相关说明 因为手里已有相关jar,为方便我搭建的是:Struts2.0+Hibernate3.3+Spring3.0,数据库:MySQL 如果想搭建最新的,在官网上下载最新ja ...
- Mac下maven工程的创建,并搭建SSH环境
最近项目有用到maven,就特地学了一下.maven的一句话攻略就是,项目托管.帮你解决各种项目琐事:清理,导包....等等. 首先先到apach官网去下载一个maven的包,http://maven ...
- Eclipse搭建SSH(Struts2+Spring+Hibernate)框架教程
| 版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 确实,刚创博客,对于这个陌生的东西还是有些许淡然.这是我的第一篇博文,希望能给你们有帮助,这就是我最大的乐趣! 好了下面进入正题: SS ...
- 用eclipse搭建SSH(struts+spring+hibernate)框架
声明: 本文是个人对ssh框架的学习.理解而编辑出来的,可能有不足之处,请大家谅解,但希望能帮助到大家,一起探讨,一起学习! Struts + Spring + Hibernate三者各自的特点都是什 ...
- myeclipse搭建SSH框架
搭建SSH框架 Struts+hibernater+spring架构(myeclipse) 右击,首先加入spring,加入hibernater,再加入struts2 复制jar包(把tomcat发布 ...
- MyEclipse8.5快速搭建SSH框架
来源于:http://jingyan.baidu.com/article/a378c960a78125b3282830cc.html MyEclipse8.5快速搭建SSH框架 使用版本: Strut ...
随机推荐
- NXP QN9020
NXP的这个BLE蓝牙方案也很有趣, 一起研究. 这个函数在app_gpa_task.c里面 ***************************************************** ...
- n阶乘 尾数0的个数
class Solution {public: int trailingZeroes(int n) { if(n<=0) return 0; int i=0; ...
- Hibernate,Session清理缓存时间点
当应用程序调用org.hibernate.Transaction的commit()的时候,commit()方法先清理缓存,然后再向数据库提交事务. 当应用程序显示调用Session.flush()方法 ...
- js笔记---封装自己的Ajax方法
//地址 成功方法 失败方法function Ajax(url, funsucc, funfial) { var oAjax = null; if (window.XMLHttpRequest) { ...
- 链接注入(便于跨站请求伪造)(AppScan扫描结果)
最近工作要求解决下web的项目的漏洞问题,扫描漏洞是用的AppScan工具,其中此篇文章是关于链接注入问题的.下面就把这块东西分享出来. 原创文章,转载请注明 -------------------- ...
- python学习笔记-day4笔记 常用内置函数与装饰器
1.常用的python函数 abs 求绝对值 all 判断迭代器中所有的数据是否为真或者可迭代数据为空,返回真,否则返回假 any ...
- ip地址定位库
ip2region 1.2.1 发布了,新增 Python 内存查询+数据文件更新. 准确率99.9%的ip地址定位库,0.0x毫秒级查询,数据库文件大小只有1.5M,提供了java, php, c, ...
- 检索COM类工厂中CLSID为{000209FF-0000-0000-C000-000000000046}的组件时失败,原因是出现以下错误: 80070005
检索COM类工厂中CLSID为{000209FF-0000-0000-C000-000000000046}的组件时失败,原因是出现以下错误: 80070005 http://blog.csdn.net ...
- 如何实现百度外卖APP个人中心头像"浪"起来的动画效果
作为一个中午下班不肯离开工作岗位且勤奋工作的骚年来说,叫外卖就成了不可或缺的习惯.某日瞬间发现百度外卖的APP波浪效果很是吸引人.相比较其他的外卖APP,颜值略高些.(淘宝也有波浪的效果),遂就思考如 ...
- EF中限制字段显示长度
在EF中有些添加的字段 文本显示超多文字,想截取显示又没有截取功能. 怎么办? 我们可以在EF中类的属性中设置 你想限制这个用户名只能有10个字符长度 public String UserName { ...