使用Struts 2时Tomcat启动出错。
我用的是Myeclipse 10,Tomcat 7,启动Tomcat(不管是在Myeclipse中还是直接启动Tomcat)时会出现以下错误:
2012-3-14 20:45:06 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@197ebe66: defining beans [commodityClassAddAction,commodityClassListAction,commodityAddtAction,commodityListAction,commodityDeleteAction,goIndexAction,showImgAction,ShowByClassAction,ShowCommodityAction,AddToCarAction,DeleteFromCar,commodityClassDAO,commodityClassService,commodityDAO,commodityService,sessionFactory,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,allManagerMethod,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor]; root of factory hierarchy
2012-3-14 20:45:06 org.springframework.web.context.ContextLoader initWebApplicationContext
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commodityClassDAO' defined in ServletContext resource [/WEB-INF/applicationContext-beans.xml]: Instantiation of bean failed;
nested exception is java.lang.NoClassDefFoundError: org/hibernate/SessionFactory
Caused by: java.lang.
NoClassDefFoundError: org/hibernate/SessionFactory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.privateGetPublicMethods(Class.java:2547)
at java.lang.Class.getMethods(Class.java:1410)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1284)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1158)
at java.beans.Introspector.getBeanInfo(Introspector.java:408)
at java.beans.Introspector.getBeanInfo(Introspector.java:167)
at java.beans.Introspector.getBeanInfo(Introspector.java:230)
at java.beans.Introspector.<init>(Introspector.java:389)
at java.beans.Introspector.getBeanInfo(Introspector.java:167)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:244)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:143)
at org.springframework.beans.BeanWrapperImpl.setIntrospectionClass(BeanWrapperImpl.java:236)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:194)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:177)
at org.springframework.beans.BeanWrapperImpl.<init>(BeanWrapperImpl.java:130)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean
哪位朋友也遇到过这个情况,给在下说下,万分感谢。
------解决方案--------------------应该是没引入hibernate的jar包。
------解决方案--------------------配置文件贴下