最近在用spring2结合hibernate3构建应用,pojo使用了hibernate-annotations,但在启动tomcat的过程中抛出了如下的异常:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory ' defined in file [E:\CVSWork\yskmusic\WebRootV1.0\build\www\WEB-INF\classes\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class= "com.po.Member "/>
Caused by:
org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class= "com.po.Member "/>
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1600)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1443)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:557)
不知道哪位有碰到过类似问题?
------解决方法--------------------------------------------------------
你是从CVS 服务器上下下来的吧,你自己建个工程在尝试哈,它的提示是你applicationContext.xml 中没有那个 **.hb.xml < **.hb.xml > 这个里面有bean sessionFaction 你有吗?Hibercate 自动生成的(from ,dao,sessionFaction)