Click here to Skip to main content
15,885,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to run a Spring application with Apache Tomcat and I get the following exception in the server log:
[Apache Log] org.springframework.beans.factory.BeanCreationException: Error creating bean wi - Pastebin.com[^]

In the log it says at the end that it is caused by entity Assignment not being a managed type.

Here is the entity:
[Java] package com.mihaib.springmvc.entities; import javax.persistence.*; import ja - Pastebin.com[^]

I am using Hibernate for database mapping.
I saw on another forum that someone said that it was due to a missing @Entity annotation on the class. I have the annotation, but I still get the exception.

How can I make the entity be a managed type or what else I can do to resolve this exception.
Posted
Updated 13-Jan-16 9:38am
v5

1 solution

I think the problem is while injecting. you can see in log
Error creating bean with name 'assignmentController': Injection of autowired dependencies failed;

may be you are trying to injecting service class to controller class there you are getting a problem, problem is not in DAO class see your log clearly.

Caused by: Could not autowire field: private com.mihaib.springmvc.services.AssignmentService com.mihaib.springmvc.controller.AssignmentController.


If possible post your controller and service class, problem with @autowired i.e injection problem
 
Share this answer
 
v4
Comments
mihaib27 13-Jan-16 15:34pm    
Thanks a lot, but I have solved that problem earlier this day. It was something sort of like you said. I had a wrong path towards the entities in factory.setPackagesToScan from ApplicationConfig. Do you happen to have a general idea as of why I get this exception: "Caused by: org.springframework.data.mapping.PropertyReferenceException: No property id found for type Assignment!", even though I have the @Id annotation and the @Column annotation with the necessary attributes? The entity Assignment in the exception is the same as the one from the link above.
Member 11406049 14-Jan-16 6:32am    
post your code. if property name in you 'domain' class and column name in db are same no need of @column annotation. is possible post your code with full stack error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900