找不到类[org.springframework.orm.hibernate.LocalSessionFactoryBean]

时间:2012-07-05 18:49:16

标签: spring hibernate

我遇到过spring hibernate的问题,有些人可以帮我吗?我想我的项目中包含了所有库:sping-orm ......

  

2012年7月5日下午2:13:58 org.springframework.context.support.AbstractApplicationContext prepareRefresh   信息:刷新org.springframework.context.support.ClassPathXmlApplicationContext@4e3eca90:启动日期[Thu Jul 05 14:13:58 EDT 2012];上下文层次结构的根   2012年7月5日下午2:13:58 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions   信息:从类路径资源[spring.xml]加载XML bean定义   2012年7月5日下午2:13:59 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons   信息:在org.springframework.beans.factory.support.DefaultListableBeanFactory@d576e70中预先实例化单例:定义bean [myDataSource,mySessionFactory,hibernateTemplate,expertiseDao];工厂层级的根   2012年7月5日下午2:13:59 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons   信息:在org.springframework.beans.factory.support.DefaultListableBeanFactory@d576e70中销毁单例:定义bean [myDataSource,mySessionFactory,hibernateTemplate,expertiseDao];工厂层级的根   线程“main”org.springframework.beans.factory.CannotLoadBeanClassException中的异常:找不到类路径资源[spring.xml]中定义的名为“mySessionFactory”的bean的类[org.springframework.orm.hibernate.LocalSessionFactoryBean];嵌套异常是java.lang.ClassNotFoundException:org.springframework.orm.hibernate.LocalSessionFactoryBean       在org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)       在org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)       在org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)       在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)       在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)       在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)       在org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:139)       在org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:93)       在com.gs.project1.main.TestRun.main(TestRun.java:17)   引起:java.lang.ClassNotFoundException:org.springframework.orm.hibernate.LocalSessionFactoryBean       在java.net.URLClassLoader $ 1.run(URLClassLoader.java:202)       at java.security.AccessController.doPrivileged(Native Method)       在java.net.URLClassLoader.findClass(URLClassLoader.java:190)       at java.lang.ClassLoader.loadClass(ClassLoader.java:307)       在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:301)       在java.lang.ClassLoader.loadClass(ClassLoader.java:248)       在org.springframework.util.ClassUtils.forName(ClassUtils.java:257)       在org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)       在org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)       在org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)       ... 9更多

1 个答案:

答案 0 :(得分:0)

似乎没有提供正确的包名称。我快速搜索了LocalSessionFactoryBean类,并意识到它在同一个包中不可用。可能是构建它的Spring框架版本和可用的运行时库的区别。