引起条件: SpringBoot+JPA插入包含自增字段的对象 @Id @GeneratedValue private Integer id; 解决方法: 给注解添加属性 @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; Hibernate: select next_val as id_val from hibernate_sequence for update 2019-01-09 15:44…
spring+struts2+hibernate 运行报错 Table 'jiang.hibernate_sequence' doesn't exist 解决方法 一. 在hibernate.cfg.xml中添加配置信息 <property name="hibernate.id.new_generator_mappings">false</property> 二. 将id的生成策略设置成@GeneratedValue(strategy = GenerationT…
错误信息:Table 'sell.hibernate_sequence' doesn't exist 错误原因:实体主键没有配置主键自增长 完整配置如下 /**主键id*/ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id;…
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'xxx.hibernate_sequence' doesn't exist 背景: springboot 1.5.9.RELEASE 升级至 2.0.5.RELEASE时,spring-boot-starter-data-jpa使用了hibernate5: 解决方法: spring.jpa.hibernate.use-new-id-genera…
最近几天几天做项目用到了Spring Data JPA,确实是个好东西,省了很多力气.但是由于刚开始用,也遇到不少头疼的问题,如下,调用JpaRepository接口的save方法保存一个对象到数据库中的时候出错: ERROR: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'portal.hibernate_sequence' doesn't exist,  wqee 对这个问题可以说是几经磨难,一直想不通为何…
引起条件: WebSocket+单元测试,单元测试报错! 解决方法: SpringBootTest增加webEnvironment参数. https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html#boot-features-testing-spring-boot-applications @SpringBootTest(webEnvironment = SpringBootT…
错误:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String; 最近刚刚开始用SpringBoot做项目,之前项目跑得好好的,就启动不起来了,后来终于解决了这个错误,这种错误出现原因很多吧,我这只能算一种原因. 直接进入正题,我遇到的导致出现这个报错的原因:maven项目中引入了多个版本的servlet-api的jar包,项目加载时候加载错了类(加载到ser…
第一次使用springboot没有问题.隔了两天继续看.一直报错Whitelabel Error Page. 重新搭建试了任何方法都错了. 报的就是一个404错误,犯了一个习惯性错误,一般都是localhost:8080/工程名字/requestMapping路径名 实际是: localhost:8080/requestMapping路径名 .不需要工程名字就可以访问了.…
springboot项目在启动时需要把servlet容器编译进去,这时候如果你的maven依赖里面没有配置jetty或者tomcat相关依赖就会报错. 解决方法: jetty添加 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> <scope>provided</s…
前言 记录SpringBoot的相关报错信息 错误 无法引入@ResponseBody和@RequestMapping("/") <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> Failed to configure…