Meaningless Drivel is fun!
The moose likes Spring and the fly likes spring + hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "spring + hibernate" Watch "spring + hibernate" New topic

spring + hibernate

bornto pass

Joined: Jun 23, 2012
Posts: 2
I am trying to execute the example from this website: with postgresql database. but it doesn't work. This is errors:

23.06.2012 16:51:29 org.springframework.web.servlet.FrameworkServlet initServletBean
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.AnnotationConfiguration]: Constructor threw exception; nested exception is java.lang.ClassCastException: cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector
at Method)

there are libraries in springhib\WebContent\WEB-INF\lib

i am looking this topic
but there are only typo mistake

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

OK. first off, looking at that tutorial link. I recommend NOT using that tutorial. It looks like a very recent post, and most of it is using recent stuff.

But his Spring MVC is old style, which is NOT recommended to use.

In his code he extends a Spring controller class, this is a really bad design because now your Controller is tightly couple with Spring. Your Controller should be a POJO.

So while I am ok with most of their middle tier code, He uses the term DAO, most Spring people call it a Repository.

But the MVC stuff is NOT TO BE followed. Please try to find another tutorial to follow.

As far as your error, it is a Hibernate error trying to do some cast.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
It is sorta covered in the JavaRanch Style Guide.
subject: spring + hibernate
It's not a secret anymore!