hsdzhaodaiyang
hsdzhaodaiyang
2012-03-22 10:51

初学者开发的第一个Hibernate,如下错误%%%% Error Creating SessionFactory %%%%,求解

  • it技术
  • 互联网问答
  • IT行业问题
  • 编程语言问答
  • 计算机技术

%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: component class not found: vo.UserId
at org.hibernate.mapping.Component.getComponentClass(Component.java:105)
at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:155)
at org.hibernate.tuple.AbstractComponentTuplizer.(AbstractComponentTuplizer.java:40)
at org.hibernate.tuple.PojoComponentTuplizer.(PojoComponentTuplizer.java:43)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:126)
at org.hibernate.mapping.Component.getType(Component.java:160)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
at org.hibernate.cfg.Configuration.validate(Configuration.java:984)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
at org.HibernateSessionFactory.(HibernateSessionFactory.java:31)
at test.Test.main(Test.java:17)
Caused by: java.lang.ClassNotFoundException: vo.UserId
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.mapping.Component.getComponentClass(Component.java:102)
... 11 more
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Could not read mappings from resource: vo/User.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:69)
at org.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53)
at test.Test.main(Test.java:17)
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping vo.User
at org.hibernate.cfg.Mappings.addClass(Mappings.java:118)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:154)
at org.hibernate.cfg.Configuration.add(Configuration.java:386)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
... 8 more
Exception in thread "main" java.lang.NullPointerException
at test.Test.main(Test.java:18)

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐