Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error while initializing hibernate: An AnnotationConfiguration instance is required t
12-14-2011, 05:15 PM
Post: #1
Smile Error while initializing hibernate: An AnnotationConfiguration instance is required t
When you get this Error "error while initializing hibernate: An AnnotationConfiguration instance is required to use
"

This error comes when we are using annotation instead of hibernate mapping xml file to create the table.
First check to make sure these two packages are importes
[java]import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;[/java]
And check the mapping class="filename.java" is correctly assigned in struts-config.xml
After checking these Go to your hibernate file where you are going to build the sessionFactory
And change the "Configuration configuration=null;
configuration = new Configuration().configure(configFileURL);" To
"AnnotationConfiguration configuration=null;
configuration = new AnnotationConfiguration().configure(configFileURL);" where configFileUrl assigns the path of hibernate.cfg.xml file and then you can build the sessionFactory.Any doubts ask us.

Happy coding.
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
Photo Simple Struts-Hibernate Integration tutorial to insert values rajasri 2 1,170 01-15-2012 06:10 PM
Last Post: mukesh1234
Question Hibernate Errors and Solutions rajasri 0 116 12-14-2011 03:49 PM
Last Post: rajasri
  Get start Hibernate admin 0 178 11-19-2011 01:35 AM
Last Post: admin

Forum Jump:


User(s) browsing this thread: 1 Guest(s)


WE will share important jobs and updates on facebook so like us to get updates