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 File Uploads and Entity Updates in Spring + Hibernate Persisting a GIF From the Controller

Matt Malone
Matt Malone
11,437 Points

In this giflib-hibernate app, I'm getting: Error creating bean with name 'categoryDaoImpl'

Here is the full error:
org.springframework.beans.factory.BeanCreationException: 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

I'm not sure if this is a compiler error or a run-time error.

It seems similar to this Stack Overflow entry: https://stackoverflow.com/questions/45750727/exception-encountered-during-context-initialization-cancelling-refresh-attempt

I went back through many previous lessons attempting to open the app from an earlier git repository, but I would still get this same error. I'm not sure how it even began to happen.

Any help on this would be much appreciated.

Seth Kroger
Seth Kroger
56,414 Points

The part at the end that says "nested exception ... Unable to obtain JDBC Connection" suggests there is an earlier issue in connecting to the database. Are you sure the database is running and there aren't any errors connecting to it with Hibernate?

1 Answer

Matt Malone
Matt Malone
11,437 Points

You're right. My database was not running! Thanks!