`

Spring3.x企业应用开发实战第二章程序在Eclipse下运行

 
阅读更多

不管是在Eclipse下导入项目还是自己新建立的项目,运行后种种异常.主要有:

2013-11-7 0:49:57 org.apache.catalina.core.StandardContext listenerStop
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener
	at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
	at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
	at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3947)
	at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:426)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1345)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
	at java.lang.Thread.run(Unknown Source)

 

最终还是跑起来了,总结如下:

  1. 要将所有用到的JAR文件放在WEB-INF/lib文件夹下面
  2. 原始的项目代码里缺少一个jstl-1.2.jar,需要将这个补上
  3. 原项目的Web根目录设置是WebRoot,Eclipse下默认新建的是WebContent,可以通过修改.mymetadata文件的如下部分为WebContent:
    <attributes>
        <attribute name="webrootdir" value="WebContent" />
    </attributes>
     

最后感叹一下这个helloworld居然用了将近30个JAR包,截图纪念一下:



 

  • 大小: 6 KB
0
4
分享到:
评论
2 楼 lijingshou 2014-02-07  
Tristan_S 写道
我也碰到这个问题, 后来发现要用myeclipse运行就ok 两者的目录结构不一样
这本书没想象中的好

个人感觉看过还是挺有收获的,虽然原理性的东西依然不是很明白
1 楼 Tristan_S 2014-02-04  
我也碰到这个问题, 后来发现要用myeclipse运行就ok 两者的目录结构不一样
这本书没想象中的好

相关推荐

Global site tag (gtag.js) - Google Analytics