问题描述
本人刚自学了Struts2有些东西报错不知道怎么回事?请同行指点迷津Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'sessionFactory'definedinServletContextresource[/WEB-INF/applicationContext.xml]:Invocationofinitmethodfailed;nestedexceptionisorg.hibernate.HibernateException:Unabletoinstantiatedefaulttuplizer[org.hibernate.tuple.entity.PojoEntityTuplizer]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)web.xml的配置是这样写的吗?<context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/applicationContext.xml</param-value></context-param><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener></web-app>
解决方案
解决方案二:
<?xmlversion="1.0"encoding="UTF-8"?><web-appversion="2.5"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><!--web.xmlOrder:context-param=>listener=>filter=>servlet--><context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:applicationContext*.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>*.action</url-pattern></filter-mapping><filter><filter-name>encodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><servlet><servlet-name>JspSupportServlet</servlet-name><servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet><servlet-name>startup</servlet-name><servlet-class>com.yuanit.sys.util.StartupServlet</servlet-class><load-on-startup>2</load-on-startup></servlet><servlet><servlet-name>Image</servlet-name><servlet-class>com.yuanit.app.util.Image</servlet-class><init-param><param-name>type</param-name><param-value>1</param-value></init-param><init-param><param-name>length</param-name><param-value>4</param-value></init-param></servlet><servlet-mapping><servlet-name>Image</servlet-name><url-pattern>/Image</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list><session-config><session-timeout>30</session-timeout></session-config></web-app>
解决方案三:
和我的也没什么区别呀
解决方案四:
Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListener监听初始化错误。。。
解决方案五:
这是我的,差不多啊!<?xmlversion="1.0"encoding="UTF-8"?><web-appxmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"version="2.5"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/classes/applicationContext.xml</param-value></context-param><!--<filter><filter-name>FilterDispatcher</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter><filter-mapping><filter-name>FilterDispatcher</filter-name><url-pattern>/*</url-pattern></filter-mapping>--><servlet><servlet-name>FacesServlet</servlet-name><servlet-class>javax.faces.webapp.FacesServlet</servlet-class><load-on-startup>0</load-on-startup></servlet><servlet-mapping><servlet-name>FacesServlet</servlet-name><url-pattern>*.faces</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>