如果把
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
去掉,运行就不会出错。错误是这样的:
五月 19, 2014 2:04:15 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: could not instantiate id generator [entity-name=po.TabPm]
could not instantiate id generator [entity-name=po.TabPm], id generator配置有问题了 你配置的什么数据库Caused by: org.hibernate.MappingException: Dialect does not support sequences,这个没使用oracle的方言吗 ContextLoaderListener会读取你配置的contextConfigLocation中定义的xml 文件,肯定是不能去掉的。
多尝试搜索自己解决下,实在不行可以把你的POJO和映射文件(如果注解方式就算了)贴出来看看。 用的mysql的怎么用sequences去实现主键策略,应该把po.TabPm的主键策略GenerationType.SEQUENCE改成GenerationType.Auto