• Register
0 votes
6.1k views

Problem :

I am developing the application in Spring, using a Tomcat, Mysql5, Java8... My problem is that I cannot deploy it, due to the "required bean 'entityManagerFactory' not found" problem. I have developed my project with the coworkers but they can perfectly deploy it without any problems and even if I copy-paste a same project in Spring Tool Suite I get below error. How it can be possible? Error as below :

***************************
APPLICATION FAILED TO START
***************************
Description:

Field usuarioDao in es.uc3m.tiw.Controladores.Controlador required a bean named 'entityManagerFactory' that could not be found.

Action:

Consider defining a bean named 'entityManagerFactory' in your configuration.

 

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

You must be missing the repository configuration, as you have to configure it using the @Repository,

Following code is incorrect,

public interface UsuarioRepository  extends JpaRepository<Usuario, Long> {

Rather it should be configured as the repository as below,

@Repository
public interface UsuarioRepository  extends JpaRepository<Usuario, Long> {

This code will make it the bean to be scanned and treat it as the repository and then your below code should work as expected by you,

@Autowired
private UsuarioRepository usuarioDao;

 OR

Check the persistence-api in your pom file and try to change it with hibernate-jpa-2.1 which is the part of spring-boot-started-data-jpa jar

9 7 4
38,600 points

Related questions

0 votes
1 answer 39 views
39 views
Problem : any help with this: Consider defining a bean named 'entitymanagerfactory' in your configuration..
asked Mar 6 Wafa Abu Yousef 6.1k points
1 vote
1 answer 4.5K views
4.5K views
Problem : When I try to compile my spring project, I always face the below error : Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed I have the ... >1.4.1.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> . . .
asked Dec 12, 2019 alecxe 7.5k points
0 votes
1 answer 18 views
18 views
Problem: HELP! I need help understanding this error: Error creating bean with name 'entitymanagerfactory' defined in class path resource.
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
2 answers 715 views
715 views
Problem : I am new to the Spring and JPA, wasted 10 days and no result with the searching on internet. I want to save the object to SQL SERVER, my connection is correct but when I write .flush() I get below exception &ldquo;nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress&rdquo;
asked Jan 21, 2020 jwilliam 3.9k points
0 votes
1 answer 388 views
388 views
Problem : I am new to Spring and JPA I want to save object to SQL SERVER, connection is correct but when I write .flush() I get the exception as below javax.persistence.TransactionRequiredException: no transaction is in progress
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
2 answers 288 views
288 views
Problem : I have created entities, services and JUnit tests for services using Spring and Hibernate for my project. All of these are working. After that I added spring-mvc to it to make this web application but while trying to make ... follows ..Could not autowire field: public pl.com.radzikowski.webmail.service.IMailManager pl.com.radzikowski.webmail.controller.HomeController.mailManager...
asked Nov 20, 2019 peterlaw 6.9k points
0 votes
1 answer 67 views
67 views
Problem : For many days I am trying to create Spring CRUD application but getting following error org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean with name
asked Nov 13, 2019 peterlaw 6.9k points
0 votes
1 answer 78 views
78 views
Problem unable to process parts as no multi-part configuration has been provided
asked Feb 9 charles mathews 5.5k points
0 votes
1 answer 3 views
3 views
Problem: Spring-boot-configuration-processor.
asked Mar 22 Dan phillip 4.7k points
0 votes
2 answers 580 views
580 views
Problem : I want to run the spring-boot application which uses thre hibernate via spring-jpa, but i am facing below error: Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo ... .AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:345) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:308)
asked Jan 3, 2020 alecxe 7.5k points