CX-开发环境配置

1.C:\Windows\System32\drivers\etc\hosts配置:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1          localhost
        192.168.168.86     maven.dev.chaoxing.com
        192.168.168.223    svn.dev.chaoxing.com
	127.0.0.1          shanxi.organization.com
#	::1                localhost
#http://maven.dev.chaoxing.com是maven私服nexus的访问地址,可用来查询依赖。
#https://svn.dev.chaoxing.com是SVN服务器地址,需要用使用https协议访问。



2.Eclipse项目列表的Server文件夹中Server.xml:
        <Host appBase="E:\WorkspaceCompany\oranization" autoDeploy="true" name="shanxi.organization.com" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">   
				<Context docBase="ROOT" path=""/>
	    </Host>
	    <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
	    
        </Host>


3.项目部署在哪个目录启动:
a.部署到本地Tomcat安装目录:
   D:\Tomcat6.0\conf\server.xml配置:
  
<Host appBase="E:\WorkspaceCompany\oranization" autoDeploy="true" name="shanxi.organization.com" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">   
				<Context docBase="ROOT" path=""/>
	    </Host>
	    <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
   


b.部署到Tomcat默认路径(E:\WorkspaceCompany\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\config\server.xml中配置):

<Host appBase="E:\WorkspaceCompany\oranization" autoDeploy="true" name="shanxi.organization.com" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">   
				<Context docBase="ROOT" path=""/>
	    </Host>
	    <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">




原理:
1.浏览器输入:shanxi.organization.com(浏览器只会在本地匹配地址,不会访问外网)
2.由于在hosts配置了:127.0.0.1 <==> shanxi.organization.com
  a.如果本地Tomcat服务器没启动,则访问失败
  b.如果本地Tomcat服务已启动,但Server.xml没配置对应的Host,则报404错误
  c.Tomcat启动和Server.xml也配置了Host:会访问127.0.0.1(本机服务器Tomcat)去寻找shanxi.organization.com
3.由于在Eclipse中的Server里和本地安装的Tomcat6.0的server.xml配置了项目,且name="shanxi.organization.com"  端口号也为80
4.所以当URL:输入shanxi.organization.com会默认跳到Tomcat部署的那个项目的ROOT路径(即项目主页)
5.Tomcat6.0的Server.xml里可以配置多个Host,但是这些项目中WEB-INF\web.xml中配置的<param-value>节点值不能一样,否则启动Tomcat会报项目路径覆盖的错误:
	<context-param>  
        <param-name>webAppRootKey</param-name>  
        <param-value>webapp.course</param-value>  
	</context-param> 


你可能感兴趣的:(环境配置)