需要工具:
Tomcat7
Eclipse
step1:Window--Preference--Server--Runtime Envirenment
step2:--Add--选择Apache Tomcat v7.0--next --
Name:Apache Tomcat v7.0
Tomcat Installation directory D:\soft\tomcat7(我的Tomcat安装路径)
JRE:选择jdk1.7.0.79(我的JDK版本)
--Finish
此时工程目录下会多出一个Servers文件夹里面就是刚才咱们新建的Tomcat服务器配置信息
step3:右键工程(要在浏览器访问的工程)--Run As --Run On Server--选择刚才新建的服务--Finish
查看eclipse console下的log信息
五月 06, 2016 4:01: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\Java7\jdk1.7.0_79\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java7/jdk1.7.0_79/bin/../jre/bin/client;C:/Program
Files/Java7/jdk1.7.0_79/bin/../jre/bin;C:/Program Files/Java7/jdk1.7.0_79/bin/../jre/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Java7\jdk1.7.0_79\bin;C:\Program
Files\Java7\jdk1.7.0_79\jre\bin;D:\Program Files\apache-maven-3.3.9\bin;D:\Program Files\nodejs\;D:\node\node-global;C:\Users\dhc-user\AppData\Roaming\npm;D:\Program Files\eclipse4.4;;.
五月 06, 2016 4:01:33 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source‘ to ‘org.eclipse.jst.j2ee.server:skt.testA‘ did not find a matching property.
五月 06, 2016 4:01:34 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
五月 06, 2016 4:01:34 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
五月 06, 2016 4:01:34 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2308 ms
五月 06, 2016 4:01:34 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
五月 06, 2016 4:01:34 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.47
五月 06, 2016 4:01:36 下午 org.apache.catalina.util.SessionIdGenerator createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [184] milliseconds.
五月 06, 2016 4:01:36 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
五月 06, 2016 4:01:36 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
五月 06, 2016 4:01:36 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 1373 ms
如果没有Error 则代表Tomcat服务器已启动成功
在浏览器中访问http://localhost:8080/{ProjectName}/
常见问题:
1、Multiple Contexts have a path of "/skt.testA".
解决办法:eclipse中打开Servers工程--当前报错使用的Server--打开Server.xml
找到重复的<Context docBase="skt.testA" path="/skt.testA" .................../〉删除多余的只保留一份