当前位置: 代码迷 >> J2EE >> SSH中Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]有关问题
  详细解决方案

SSH中Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]有关问题

热度:627   发布时间:2016-04-22 00:38:45.0
SSH中Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]问题
貌似主要是找不到Hbm文件,但是我已经建好了,


错误:
Java code
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPassCaused by: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass    at java.lang.ClassLoader.defineClass1(Native Method)    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)    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)    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:1325)    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:661)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1198)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)    at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:353)    at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:296)    at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:225)    at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)    at javax.servlet.GenericServlet.init(GenericServlet.java:212)    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)    at org.apache.catalina.core.StandardService.start(StandardService.java:516)    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)    at org.apache.catalina.startup.Catalina.start(Catalina.java:566)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)    at java.lang.reflect.Method.invoke(Method.java:585)    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
  相关解决方案