MyEclipse6.5增加对Tomcat7的支持

MyEclipse6.5增加对Tomcat7的支持

最近在研究Servlet3.0,它是JavaEE6.0规范中的一部分

而Servlet3.0对服务器是有要求的,比如Tomcat7+(而Tomcat7.0要求JDK6+,即编译级别应该是6+)

但我一直使用的MyEclipse6.5不支持Tomcat7,可也不能为了这个就去装一个MyEclipse8.0啊

好吧,还是像当初我用TongWeb5.0的方式一样,自己DIY一下吧

 

1)下载Tomcat7
2)由于我已经配置了tomcat6,为了同时拥有tomcat6和tomcat7的环境,所有我们在MyEclipse的Tomcat5.x里配置tomcat7
  MyEclipse-->Window-->Preferences-->MyEclipse Enterprise Workbench-->Servers-->Tomcat-->Tomcat5.x
  Tomcat5.x-->Enable
  Tomcat5.x-->Tomcat home directory-->D:Developapache-tomcat-7.0.41
  Tomcat5.x-->JDK-->Tomcat JDK name-->jdk1.6.0_45
3)第二步配置完,在MyEclipse6.5的Servers视图里启动Tomcat5.x(实际为tomcat7.0.41)会发现弹出一个对话框
  Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.
  同时MyEclipse6.5控制台会输出下面的异常信息
  java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
  	  at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:60)
  Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
	  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	  at java.security.AccessController.doPrivileged(Native Method)
	  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	  ... 1 more
4)所以我们还要修改一下
  Tomcat5.x-->Paths-->Append to classpath-->把D:Developapache-tomcat-7.0.41bintomcat-juli.jar加进去-->Apply-->OK
  然后再启动Tomcat5.x(实际为tomcat7.0.41)会发现启动成功!!浏览器访问http://127.0.0.1:8080/成功!!

下面是控制台输出

2013-6-23 12:26:48 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:DevelopJavajdk1.6.0_45bin;D:Developapache-tomcat-7.0.41bin
2013-6-23 12:26:48 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
2013-6-23 12:26:48 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
2013-6-23 12:26:48 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 772 ms
2013-6-23 12:26:48 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2013-6-23 12:26:48 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.41
2013-6-23 12:26:48 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:Developapache-tomcat-7.0.41webappsdocs
2013-6-23 12:26:49 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:Developapache-tomcat-7.0.41webappsexamples
2013-6-23 12:26:49 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2013-6-23 12:26:49 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2013-6-23 12:26:49 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded(‘org.apache.jasper.compiler.TldLocationsCache‘,
      ‘org.apache.jasper.compiler.TldLocationsCache@6bdc64a5‘)
2013-6-23 12:26:49 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:Developapache-tomcat-7.0.41webappshost-manager
2013-6-23 12:26:49 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:Developapache-tomcat-7.0.41webappsmanager
2013-6-23 12:26:49 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:Developapache-tomcat-7.0.41webappsROOT
2013-6-23 12:26:49 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
2013-6-23 12:26:49 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
2013-6-23 12:26:49 org.apache.catalina.startup.Catalina start
信息: Server startup in 914 ms

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。