'debug' enabled in Spring boot

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: con.mysql.jdbc.Driver


—Please help me guys

As per the log showed, you got the issue when creating the HibernateJpaConfiguration bean. Sounds like you initialize the dataSource incorrectly.

Error creating bean with name ‘dataSource’ defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:

I cannot say anything since I don’t have any information, so I suggest you should take a look at the dataSource configuration part in your code. You can consider enabling the debug option, but I don’t think you can find more information than the log which you got.
If you still need our help, I strongly suggest you should create a minimal reproducible example, which helps us to reproduce your problem and share it with us (a GitHub repository would be perfect).

3 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?