Eclipse3.x中热部署项目,启动错误问题:
2009-4-14 22:12:33 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:t' did not find a matching property.2009-4-14 22:12:33 org.apache.catalina.core.AprLifecycleListener init信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;.;F:\apache-tomcat-6.0.16\bin;F:\mysql\mysql-5.1.32-win32\bin;F:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_02\bin;F:\SVNclient\TortoiseSVN\bin;C:\Program Files\StormII\Codec;C:\Program Files\StormII2009-4-14 22:12:33 org.apache.coyote.http11.Http11Protocol init信息: Initializing Coyote HTTP/1.1 on http-88882009-4-14 22:12:33 org.apache.catalina.startup.Catalina load信息: Initialization processed in 729 ms2009-4-14 22:12:33 org.apache.catalina.core.StandardService start信息: Starting service Catalina2009-4-14 22:12:33 org.apache.catalina.core.StandardEngine start信息: Starting Servlet Engine: Apache Tomcat/6.0.162009-4-14 22:12:34 org.apache.catalina.core.StandardContext resourcesStart严重: Error starting static Resourcesjava.lang.IllegalArgumentException: Document base F:\myproject\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\t 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.start(ContainerBase.java:1045) 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)2009-4-14 22:12:34 org.apache.catalina.core.StandardContext start严重: Error in resourceStart()2009-4-14 22:12:34 org.apache.catalina.core.StandardContext start严重: Error getConfigured2009-4-14 22:12:34 org.apache.catalina.core.StandardContext start严重: Context [/t] startup failed due to previous errors2009-4-14 22:12:34 org.apache.catalina.core.StandardContext stop信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/t] has not been started2009-4-14 22:12:34 org.apache.coyote.http11.Http11Protocol start信息: Starting Coyote HTTP/1.1 on http-88882009-4-14 22:12:34 org.apache.jk.common.ChannelSocket init信息: JK: ajp13 listening on /0.0.0.0:80092009-4-14 22:12:34 org.apache.jk.server.JkMain start信息: Jk running ID=0 time=0/47 config=null2009-4-14 22:12:34 org.apache.catalina.startup.Catalina start信息: Server startup in 497 ms
产生问题是因为创建新的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项目后默认是none)选中里面您servers热部署中创建的server(我的是Tomcat v6.0 Server at localhost.server )。
搜索到的相关解释:
(
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两个文件夹目录。配置到这,此两个文件夹目录底下应该放些什么内容,大家应该都清楚了。正常项目tomcat中结构。如果是新建项目啥都还没写的话建议删除重新创建一个WEB项目,此时ECLIPSE会自动感应。
到此配置完毕,重新启动吧。应该没问题了。
(
启动正确输出信息:
2009-4-14 22:35:40 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;.;F:\apache-tomcat-6.0.16\bin;F:\mysql\mysql-5.1.32-win32\bin;F:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_02\bin;F:\SVNclient\TortoiseSVN\bin;C:\Program Files\StormII\Codec;C:\Program Files\StormII2009-4-14 22:35:40 org.apache.coyote.http11.Http11Protocol init信息: Initializing Coyote HTTP/1.1 on http-88882009-4-14 22:35:40 org.apache.catalina.startup.Catalina load信息: Initialization processed in 594 ms2009-4-14 22:35:40 org.apache.catalina.core.StandardService start信息: Starting service Catalina2009-4-14 22:35:40 org.apache.catalina.core.StandardEngine start信息: Starting Servlet Engine: Apache Tomcat/6.0.162009-4-14 22:35:40 org.apache.coyote.http11.Http11Protocol start信息: Starting Coyote HTTP/1.1 on http-88882009-4-14 22:35:40 org.apache.jk.common.ChannelSocket init信息: JK: ajp13 listening on /0.0.0.0:80092009-4-14 22:35:40 org.apache.jk.server.JkMain start信息: Jk running ID=0 time=0/31 config=null2009-4-14 22:35:40 org.apache.catalina.startup.Catalina start信息: Server startup in 439 ms
)