【问题标题】:how to deploy Restful on Tomcat without IDE如何在没有 IDE 的情况下在 Tomcat 上部署 Restful
【发布时间】:2016-03-30 00:34:26
【问题描述】:

我使用Eclipse Maven Tomcat7 制作了Restful WS, 现在我有一个在线serverUbuntu,上面有Tomcat7。 我需要知道的是如何在没有EclipseMaven 的情况下部署我的Restful

【问题讨论】:

    标签: eclipse rest maven tomcat server


    【解决方案1】:

    假设你的tomcat7安装目录是~/Document/tomcat7,你要部署MyRestful.war

    1. 复制MyRestful.war到目录~/Document/tomcat7/webapps
    2. 查看文件~/Document/tomcat7/conf/server.xml 并找到这些行
    <Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
    

    通常端口号是8080,但值得仔细检查。

    1. 现在您可以通过以下方式访问您的 Restful

    http://your.server.url:8080/MyRestful/replace-with-your-rest-api

    【讨论】:

      【解决方案2】:

      您可以使用浏览器中的管理器应用程序将war 文件部署到正在运行的 Tomcat 实例。这是网址:http://your.server.intranet:8080/manager/html(或localhost:8080)。

      配置文件$CATALINA_BASE/conf/tomcat-users.xml 必须包含一个管理员用户和一个管理员角色。见Configuring_Manager_Application_Access

      示例:

      <tomcat-users xmlns="http://tomcat.apache.org/xml"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
                    version="1.0">
      <!--
        NOTE:  By default, no user is included in the "manager-gui" role required
        to operate the "/manager/html" web application.  If you wish to use this app,
        you must define such a user - the username and password are arbitrary.
      -->
          <role rolename="manager-gui" />
          <role rolename="manager-script" />
          <role rolename="manager-jmx" />
          <role rolename="manager-status" />
      
          <user username="admin" password="whoknows" roles="manager-gui" />
          <user username="adminScript" password="topsecret" roles="manager-script" />
      </tomcat-users>
      

      【讨论】:

        猜你喜欢
        • 2021-01-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-06-30
        • 2012-07-09
        • 2022-11-22
        • 2012-10-19
        • 1970-01-01
        相关资源
        最近更新 更多