Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring with Hibernate Data-Driven Application Design Testing Our Service and DAO

Hugo Hayes
PLUS
Hugo Hayes
Courses Plus Student 13,146 Points

bootRun startup failed

I cannot startup the bootRun task. It was stopped by BeanCreationException. It says "Error creating bean with name 'categoryDaoImpl' : Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.teamtreehouse.giflib.dao.CategoryDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/teamtreehouse/giflib/config/DataConfig.class]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Unable to obtain JDBC Connection"

3 Answers

Anders Björkland
Anders Björkland
7,481 Points

For anyone still wondering about this, you need to start the server first. in the terminal type: java -cp h2-1.4.190.jar org.h2.tools.Server

TLDR: Upgrade Hibernate from "5.2.0Final" to "5.3.7.Final" (currently latest version)


There was a Bug in Hibernate Version 5.2.0 FINAL, wich causes this issue. This might caused by the useage of the upgarded code.

For this reason it is VERY important, to:

EITHER stick with the versions from this tutorial, and live in peace with the fact that your IDE marks some of the shown methods used in the tutorial as depricated,

OR use the newest versions and see this tutorial as a systematical guildeline.

While the first method is less frustrating and faster, the second method will make you a better developer, because you learn how to help yourself, dig through the mighty-mighty-internet to find solutions for your problems and loose the fear of situations when something didn't work.

greetings, /me

Kirill Pahl
Kirill Pahl
13,924 Points

I think you should start your dbase server first.