1:Errorcreatingbeanwithname'sessionFactory'definedinServletContext.......
到WebApp的lib目录底下,把属于Hibernate3.2Core的"asm.jar"、"asm-attrs.jar"和"cglib-2.1.3.jar"都删掉或者把属于SpringAOPCore的"asm-2.2.3.jar"、"asm-commons-2.2.3.jar"、"asm-util-2.232.jar"和"cglib-nodep-2.1_3.jar"都删掉。任意删除其中一个组合都可以解决问题,不过我留意到Spring引用的jar比较新,要删就删Hibernate3.2Core的组合(其实我试过,直接删cglib-2.1.3.jar就OK了,原因不明)。
2:NoWebApplicationContextfound:noContextLoaderListenerregistered?
说法1:
spring中提供ContextLoaderListenter类,用来加载context的xml文件。
spring为struts提供ContextLoaderPlugIn类,此类也可以加载context的xml文件。
区别在于,两种方式加载的WebApplicationContext,以不同的Key存放在ServletContext中。而如果你定义了HibernateFilter的话,spring会利用WebApplicationContextUtils来获取WebApplicationContext,而此类并不识别ContextLoaderPlugIn类所加载的上下文,此时便会抛出异常:NoWebApplicationContextfound:noContextLoaderListenerregistered?
利用ContextLoaderListenter来加载dao、service级别的context,而对于struts的action,用ContextLoaderPlugIn加载。
出现了NoWebApplicationContextfound:noContextLoaderListener
registered异常,此问题产生的原因是因他的资源文件没加载进来所以找不到文件引起,于是我在web.xml中加入了如下语句:
<!--SpringApplicationContext配置文件的路径,可使用通配符,多个路径用,号分隔此参数用于后面的Spring-Contextloader-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>说法2:
配置监听,也是没有加载到这个类,原理都一样,可能不太清楚怎么配置,也不起作用
<listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener>
说法3:
看你报错应该是spring没正常工作,web.xml里要配的
<servlet> <servlet-name>SpringContextServlet </servlet-name> <servlet-class> org.springframework.web.context.ContextLoaderServlet </servlet-class> <load-on-startup>1 </load-on-startup> </servlet>
3.严重:ErrorlistenerStart
2010-4-1414:31:10org.apache.catalina.core.StandardContextstart
严重:Context[/testSSH1]startupfailedduetopreviouserrors
cglib-2.1.3.jar删掉