环境:Tomcat6.0
######告警:INFO: validateJarFile(servlet-api.jar) - jar not loaded See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
解决:把/WEB-INF/lib/下的servlet-api.jar删除掉,Tomcat里面已经包含了servlet-api.jar了,重复。
环境:Hibernate 3.x
######错误:Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/Entity
解决:在Hibernate3.5以下,使用注解还需要添加hibernate-annotations-3.3.0.jar,hibernate-commons-annotations.jar和ejb3-persistence.jar等,Hibernate3.5版本已经包含了JPA相关的jar,所以直接导入hibernate3(3.5).jar即可
环境:Spring3.0.5 tiles2.2.1
######错误:Caused by: java.lang.ClassNotFoundException: org.apache.tiles.startup.BasicTilesInitializer
解决:原因是tiles-core2.2.1中该类BasicTilesInitializer已经deprecated了
使用如下配置:
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles2.TilesView
</value>
</property>
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-def.xml</value>
</list>
</property>
<property name="preparerFactoryClass" value="org.springframework.web.servlet.view.tiles2.SpringBeanPreparerFactory" />
</bean>
环境:SpringJUnit4ClassRunner.class
######错误:IOException parsing XML document from class path resource [applicationContext.xml]; 使用classpath:applicationContext.xml找不到XML文件
解决:把classpath换成file
file:WebRoot/WEB-INF/applicationContext.xml