I run on Tomcat , NetBeans just downloaded, Java EE .

 NetBeans: Deploying on Apache Tomcat 8.0.15.0 profile mode: false debug mode: false force redeploy: true Отмена развертывания... undeploy?path=/calories-tracker OK - Undeployed application at context path /calories-tracker Развертывание на месте на C:\JavaLesson\HelloSpring\target\calories-tracker deploy?config=file%3A%2FC%3A%2FUsers%2FTimur%2FAppData%2FLocal%2FTemp%2Fcontext6254289419016115778.xml&path=/calories-tracker FAIL - Deployed application at context path /calories-tracker but context failed to start Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.security.SecurityUserDetailsService calories.tracker.config.root.AppSecurityConfig.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appSecurityConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.security.SecurityUserDetailsService calories.tracker.config.root.AppSecurityConfig.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.security.SecurityUserDetailsService calories.tracker.config.root.AppSecurityConfig.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined 

And in the end:

 28-Oct-2015 21:54:45.196 SEVERE [http-nio-8084-exec-7] org.apache.catalina.core.StandardContext.startInternal Error listenerStart 28-Oct-2015 21:54:45.197 SEVERE [http-nio-8084-exec-7] org.apache.catalina.core.StandardContext.startInternal Context [/calories-tracker] startup failed due to previous errors 

Update

web.xml:

 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <welcome-file-list> <welcome-file>/resources/calories-tracker.html</welcome-file> </welcome-file-list> </web-app> 

But what was relative to it during the build?

Warning: selected if you want to make it a problem, it can be ignored (attribute is defined as 'true')

  • I have never worked in NetBeans, but I think the problem can be found in the tomkata logs. - Vartlok
  • Try building on NetBeans and shake hands. - Evgenii Baulin
  • Then the counter question is where to look at them (I just started learning Java). Just build going successfully. - Timur Musharapov
  • @TimurMusharapov% Tomcat_dir% \ logs, see the logs for the current number. - andreycha
  • show web.xml - Saidolim pm

1 answer 1

The error is most likely due to the fact that Spring cannot find the required type of bean.

A javax.persistence.EntityManagerFactory type javax.persistence.EntityManagerFactory not found in the Spring context (when creating a bean with the name userRepository ).

This can be understood by reading the error message:

 Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.security.SecurityUserDetailsService calories.tracker.config.root.AppSecurityConfig.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private calories.tracker.app.dao.UserRepository calories.tracker.app.security.SecurityUserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined 
  • Tell me, how can this be corrected? - Timur Musharapov 1:19
  • Please provide the code for the class calories.tracker.app.security.SecurityUserDetailsService.userRepository . As well as the definition of your bins. Or give a link to the project, if it is in the public domain. - Alykoff Gali