http://blog.csdn.net/sweblish/article/details/6686046
一直以来总是Eclipse创建maven工程的,突然有一天有个同事让我帮他建有个Dynamic Web工程,我说,好啊,这还不容易。于是我就建了一个,居然跑不起来。试了几次之后,都没有找到原因,我就郁闷了。编译的内容也没有到Tomcat下的webapp下,我就很奇怪,为什么就不编译过去呢。于是就百度、google了许多这方面的问题。得到下面的答案:
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\companyworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\LongLong does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:141)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3957)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4126)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2011-8-14 14:56:39 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2011-8-14 14:56:39 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2011-8-14 14:56:39 org.apache.catalina.core.StandardContext start
严重: Context [] startup failed due to previous error
产生问题是因为创建新的server和WEB项目后没有正确配置server服务,现正确配置如下
解决办法:
1.在servers中新建的SERVER上右击——属性的General项下右边Location属性点击SwitchLocation按钮,设置成/Servers/Tomcat v6.0 Server at localhost.server
(Server s : Properties -> General -> Location = /Servers/Tomcat v6.0 Server at localhost.server ;)
2.双击新建的server,修改Server Options设置:将Publish module contexts to separate XML files 打钩(最下面)
3. 配置WEB项目的server选项:右击WEB项目——属性(properties)——server(新建WEB项目后默
搜索到的相关解释:
(
Explaination :
?Tomcat of previous version doesn' t support the "source" attribute in the "Context" node of "server .xml" file.
Result :
?A separate XML file named "demo.xml" was created in the "$server path$\conf\Catalina\localhost\".
)
注意:【metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\t does not exist or is not a readable directory 】该问题是WEB项目作了不恰当的重命名相关文件夹,或则误删除某些目录又重新创建后导致eclipse无法在使用热部署时候自动同步相关配置。
此时:可手动部署方式将固定的WEB部署目录结构创建到metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\目录底下。如:mytest项目 可以创建结构如下:创建mytest目录,在mytest文件夹目录中创建META-INF、WEB-INF两个文件夹目录。配置到这,此两个
如果还有错误,那么在配置:项目--》左击--》Project Fracets进行如下配置。先选java 6.0 右下角apply,在选Dynamic Web 右下角apply就ok了。