Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,405 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!