这两天看到Eclipse 3.7(代号Indigo) 正式版发布了,于是心想也试试看最新版有什么变动,于是就开始准备尝试下,终于在今天下载好也解压完,一切很正常,随便写了个web工程,在server中添加了个tomcat服务,将工程部署上去,启动tomcat,控制台打印出启动信息,这一切都是平常见的,启动正常。
tomcat log:
2011-6-26 13:05:23 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: D:\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/bin/../jre/bin/client;D:/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/bin/../jre/bin;D:/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/bin/../jre/lib/i386;F:\oracle\product\10.2.0\db_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files\SinoVoice\jTTS 5.0 Desktop\Bin;D:\MinGW\bin;D:\Djgpp\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;D:\Program Files\IDM Computer Solutions\UltraEdit\;D:\Program Files\ICYPlayer\Codecs\;D:\eclipse-jee-indigo-win32\eclipse;
2011-6-26 13:05:23 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:web' did not find a matching property.
2011-6-26 13:05:24 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
2011-6-26 13:05:24 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
2011-6-26 13:05:24 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1273 ms
2011-6-26 13:05:24 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2011-6-26 13:05:24 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.16
2011-6-26 13:05:24 org.apache.catalina.util.SessionIdGenerator createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [172] milliseconds.
2011-6-26 13:05:24 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2011-6-26 13:05:25 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2011-6-26 13:05:25 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2011-6-26 13:05:25 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2011-6-26 13:05:25 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache','org.apache.jasper.compiler.TldLocationsCache@1867df9')
2011-6-26 13:05:25 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory host-manager
2011-6-26 13:05:26 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory manager
2011-6-26 13:05:26 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2011-6-26 13:05:26 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
2011-6-26 13:05:26 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
2011-6-26 13:05:26 org.apache.catalina.startup.Catalina start
信息: Server startup in 2085 ms
当我打开IE时,输入http://localhost:8080/ 想不到的是,却报了404的错。
这想不至于吧,于时要重复了好几遍操作,结果都一样,很是奇怪,我想是不是tomcat 有什么问题,于是我是脱离eclipse,单独启动tomcat,启动完,刷新了页面,正常的tomcat页面出来了。
到此得出个问题,肯定是eclipse的问题了,应该不是软件的什么bug,可能是在某个地方设置有问题,从这个角度找下去,后来发现,原来在eclipse中的server中添加一个新的服务时,eclipse默认值有点小问题,
具体操作如下:
1、找到server操作窗口,双击下面的tomcat服务
2、在打开的设置中,将Server Locations的选项选成第二个“Use Tomcat installation (takes control of .........)”
现在刷新页面已经好了,能够正常出现大家熟悉的页面,接下你要做的,你懂的。
结束语:要是这个选项是灰的,不能够改,请删除,再重新试试,不要启动服务,刚添加tomcat时就切换到该窗口进行以下两步,就可以了。eclipse 将这项默认值选成第一个选项了。导致了今天的问题,希望能够给出现相同问题的人有所帮助
转自: http://hi.baidu.com/%D7%CF%DC%B0%B7%C9%BA%E8/blog/item/bf4ce61d6f4d64ed1ad57665.html#0