Java开发--页面无法显示

报错如下:

 Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!] 




以上问题可能有一下原因造成:

1,驱动配置有误:driver=com.mysql.jdbc.Driver
2,数据库连接地址有误:url=jdbc:mysql://localhost:3306/test?3useUnicode=true&characterEncoding=utf8
3,密码或帐号有误:username=root
      password=root

4,数据库未启动或无权访问

5,项目未引入对应的驱动jar包mysql-connector-java-5.1.6-bin.jar

6,mysql root没有远程访问的权限,需要增加权限,增加权限的步骤如下:


通常呢,我们会有以上一些原因导致这个报错,但是通过排查,发现并没有这样的错误。之后,通过调用debug模式,发现查询的数据,已经拿去到,但是页面却没法显示出来,这就很奇怪了。

于是查看controller ,要返回的页面jsp,发现jsp中,有之前注释掉的代码,导致页面无法显示。这里是因为jstl十分严格,页面不能有注释<!-- --> 的情况,去掉注释后,问题完美解决。

7. jsp页面存在<!-- -->代码。

猜你喜欢

转载自blog.csdn.net/supper_me/article/details/80600780
今日推荐