blueloveypx 2017-11-24 02:50 采纳率: 0%
浏览 872

想要进行spring+springMVC+Hibernate整合,启动tomcat的时候发生了错误

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentController': Unsatisfied dependency expressed through field 'studentService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentService': Unsatisfied dependency expressed through field 'studentDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDAO': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]

  • 写回答

3条回答 默认 最新

  • HryReal 2017-11-24 03:00
    关注

    下面说Could not load JDBC driver class [com.mysql.jdbc.Driver]
    可能是你的mysql连接的包没有导进来

    1.在项目properties->buildPath 的library中看看有没有mysql-connector-java-x.x.x-bin.jar

    2.如果没有就下载mysql-connector-java-x.x.x-bin.jar

    3. properties->buildPath 的library,在“库”选项卡中,选择“添加外部JAR”,找到下载的mysql-connector-java-5.1.22-bin.jar文件,将其添加进项目。
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用