Closed AshhadS closed 4 years ago
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in com.example.accessingdatamysql.UserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment
Works for me. Hard to tell what you did wrong with only a fragment of a stack trace. Is the database running? Did you set up the user account etc. as described in the tutorial?
@dsyer yes the user has been created following the same steps mentioned in the tutorial and I'm able to log in with those credentials as well. Here is the full stack trace of the error I'm getting when trying to run the AccessingDataMysqlApplication.java file Let me know if there is more information I could provide which would help you find what the actual issue is.
The stack trace suggests that hibernate can’t connect to the database. Check the URL and that you can connect from the same host/VM yourself?
@dsyer the database connections was the issue (I had the wrong port number in my db url). Greatly appreciate your prompt response on this!
If anyone else is having this same issue please check your db connections defined here src\main\resources\application.properties
I have cloned this repository and i get this error when trying to run the AccessingDataMysqlApplication.java file following your tutorial https://spring.io/guides/gs/accessing-data-mysql/