Eclipseee 开发 maven 的web工程的调试和部署

1.调试过程
1.1.从 svn 上把 maven 工程下载下来。
1.2.把工程转换为 maven 工程,右键单击项目选择 Configure -> Convert to Maven Project。
1.3.配置自己的 tomcat,把当前的项目放入到 tomcat 中去。
1.4.调试项目,第一次调试的时候,Eclipse 可能会提示你找不到要调试的工程,这个时候你只要把你需要调试的项目 add 进入 调试列表里面就行了。

1.5.配置文件示例
一个完整的 Eclipse 开发环境里面的 Servers 工程里面的 server.xml 文件的配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">

  <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
  <Listener className="org.apache.catalina.core.JasperListener"/>
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <GlobalNamingResources>
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
  </GlobalNamingResources>

  <Service name="Catalina">
    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
    <Engine defaultHost="localhost" name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
	  <!-- 配置 webapp 位置 -->
      <Context docBase="E:\eclipse-ee-projects\test\src\main\webapp" path="/" reloadable="false"/>
      
</Host>
    </Engine>
  </Service>
</Server>


2.部署过程
2.1.修改端口:如果你是在一个服务器上放置了多个 tomcat,那么你就需要修改 /conf/server.xml 文件里面的如下两个 Http Shutdown 端口(注意有时候 如果 Ajp 对应的端口也被占用了话,你也需要把 Ajp 的端口给修改一下)。
2.2.在 server.xml 文件的<Host></Host> 标签中添加 <Context /> 标签,如下
<Context docBase="404Server" path="" reloadable="true"/>

2.3.配置文件示例

<?xml version='1.0' encoding='utf-8'?>
<Server port="8013" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">
    <Connector port="8093" protocol="HTTP/1.1"
               connectionTimeout="20000" 
               redirectPort="8443" />
    <Connector port="8039" protocol="AJP/1.3" redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

	<Context docBase="404Web" path="" reloadable="true"/>
      </Host>
    </Engine>
  </Service>
</Server>

3.注意:

如果上面的都做好了,但是启动还是报错,而且报错的内容是 

org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart

那么轻参考如下文章:

http://blog.csdn.net/tengdazhang770960436/article/details/38422185

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值