0 0

ubuntu server 部署多个tomcat问题5

第一个能启动也能访问 第二个访问不了
/etc/profile 里的内容

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi
export JAVA_HOME=/usr/lib/jdk1.6.0_07
export JRE_HOME=/usr/lib/jdk1.6.0_07/jre
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
JAVA_HOME=/usr/lib/jdk1.6.0_07
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JAVA_HOME/bin
export JAVA_HOME CLASSPATH
CATALINA_BASE=/usr/lib/pache-tomcat-6.0.36
CATALINA_HOME=/usr/lib/pache-tomcat-6.0.36
export CATALINA_BASE CATALINA_HOME
CATALINA_2_BASE=/usr/lib/tomcat/pache-tomcat-6.0.36
CATALINA_2_HOME=/usr/lib/tomcat/pache-tomcat-6.0.36
export CATALINA_2_BASE CATALINA_2_HOME
TOMCAT_HOME=/usr/lib/pache-tomcat-6.0.36
export TOMCAT_HOME
TOMCAT_2_HOME=/usr/lib/tomcat/pache-tomcat-6.0.36
export TOMCAT_2_HOME


第二个tomcat 启动文件的内容
#!/bin/sh

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# -----------------------------------------------------------------------------
# Stop script for the CATALINA Server
#
# $Id: shutdown.sh 1130937 2011-06-03 08:27:13Z markt $
# -----------------------------------------------------------------------------

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh

# Check that target executable exists
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
  echo "Cannot find $PRGDIR/$EXECUTABLE"
  echo "The file is absent or does not have execute permission"
  echo "This file is needed to run this program"
  exit 1
fi
export JAVA_HOME=/usr/lib/jdk1.6.0_37
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_2_HOME
export CATALINA_BASE=$CATALINA_2_BASE
exec "$PRGDIR"/"$EXECUTABLE" stop "$@"


第二个tomcat的server.xml里的内容
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
-->
<!--Server port="9005" shutdown="SHUTDOWN--">
<Server port="9005" shutdown="SHUTDOWN" debug="0">


  <!--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" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <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>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">
 
    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->
   
   
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <!--Connector port="9080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="9443" /-->
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
  <Connector port="9080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 
               enableLookups="false" redirectPort="8443" acceptCount="100" 
               connectionTimeout="20000" disableUploadTimeout="true" /> 
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->          
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
     <Connector port="9009"
    enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> 



    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">        
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->       

      <!-- The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->
      </Host>
    </Engine>
  </Service>
</Server>


2012年11月30日 15:37

1个答案 按时间排序 按投票排序

0 0

第二个可以正常启动是吧?访问的时候报什么错?访问的url是什么?
两个server.xml中的端口号没有冲突吧?

2012年11月30日 21:02

相关推荐

    ubuntu配置多个tomcat方法

    在Linux环境下,特别是Ubuntu操作系统中,有时我们需要在同一台服务器上部署多个Tomcat实例来满足不同的应用需求或进行负载均衡等操作。本文将详细介绍如何在Ubuntu系统下配置并运行多个Tomcat服务。 #### 二、配置...

    linux安装多个tomcat

    在Linux系统中安装多个Tomcat服务器是常见的需求,特别是在开发和测试环境中,为了隔离不同的项目或者版本,每个项目可能需要独立的Tomcat实例。本文将详细介绍如何在Linux上安装和管理多个Tomcat。 首先,我们需要...

    Ubuntu16集成nginx+多个tomcat+memcached文档

    本文档主要介绍如何在Ubuntu 16.04系统上集成部署Nginx、多个Tomcat以及Memcached。这是一套常用的Web服务器集群方案,其中Nginx作为反向代理服务器,用于负载均衡;Tomcat作为应用服务器,运行Java Web应用程序;而...

    Linux(Ubuntu)系统部署web项目

    需要注意的是,实际部署时还需要考虑防火墙设置、用户权限、日志监控等多个方面,确保应用的稳定运行。此外,对于生产环境,推荐使用更高级的部署工具,如Jenkins、Docker等,以提高自动化程度和可维护性。

    同一台机不同IP不同tomcat.zip_boarddua_tomcat 多IP_tomcat绑定ip

    在IT行业中,尤其是在服务器部署和管理领域,有时候我们需要在一台物理服务器上运行多个Tomcat实例,以便为不同的项目或服务提供隔离的运行环境。标题"同一台机不同IP不同tomcat.zip_boarddua_tomcat 多IP_tomcat...

    Linux开发机上使用tomcat管理多个应用

    本篇文章将深入探讨如何在Linux开发机上高效地管理和部署多个应用程序。 首先,安装Tomcat是第一步。在Linux上,可以通过包管理器如`apt` (Ubuntu/Debian) 或 `yum` (CentOS/RHEL) 来安装。例如,对于Ubuntu: ```...

    apache-tomcat-8.5.61

    Apache Tomcat 8.5是Java Servlet和JavaServer Pages(JSP)的开源Web应用程序服务器,由Apache软件基金会开发和维护。它是一个轻量级应用服务器,特别适用于部署Java EE Web应用程序。Tomcat 8.5是8.x系列的一个...

    ubuntu server最佳方案 PDF带图缺字版

    - **OpenVZ虚拟化技术**:介绍了OpenVZ虚拟化技术,这是一种高效的容器化解决方案,能够实现在单一物理服务器上运行多个隔离的虚拟系统实例。 #### 六、DNS和DHCP服务器 - **Bind9 DNS服务器**:本节重点讲述了...

    Nginx tomcat mybatis 集群部署

    由于每个Tomcat实例都独立存储Session数据,当用户在不同节点间切换时可能会遇到Session丢失的问题。为了解决这个问题,可以采用以下几种方案实现Session共享: - **Memcached**:通过使用Memcached等缓存工具实现...

    Ubuntu系统JDK开发环境搭建安装包合集,内含tomcat7、8、9, JDK1.8.0_31, maven-3.5.4

    这个压缩包文件包含了所有必要的组件,包括Tomcat服务器的多个版本(7、8、9)以及JDK 1.8.0_31,还有Maven构建工具3.5.4,这些都是Java开发和部署的关键工具。下面我们将详细探讨如何利用这些资源在Ubuntu上建立一...

    Tomcat8 源码,可以在eclipse中直接运行

    4. **Cluster**:提供集群功能,使得多个Tomcat实例可以协同工作,提高系统的可用性和可伸缩性。 5. **Connector**:Tomcat与外部世界的连接器,如Coyote处理HTTP连接,而AJP(Apache JServ Protocol)连接器则用于...

    android 如何使用tomcat搭建服务器

    - `ubuntu中tomcat更改80端口(tomcat修改port 为 80 后 无法访问) - 编程自动化 - C++博客.mht`:此文档可能解决了在Ubuntu上将Tomcat端口改为80后遇到的问题。 - `Android 中tomcat搭建本地服務器 - Tomcat小站.mht...

    基于Xen虚拟机实现Apache tomcat 集群搭建

    7. Tomcat集群构建:Tomcat集群是多个Tomcat服务器的集合,它们协同工作,以提供更高的性能和更好的容错性。在集群环境中,Tomcat实例之间的session数据需要同步,以确保用户会话的连续性。 8. Session同步:在多...

    apache+tomcat整合配置

    如果需要更高可用性,可以将多个Tomcat实例配置成集群,通过Apache的mod_proxy_balancer模块进行负载均衡。这将提高服务的容错能力和扩展性。 8. **日志管理** 考虑将Apache和Tomcat的日志分开管理,以便更好地...

    apache-tomcat-7.0.79 下载

    8. **多平台兼容**:Apache Tomcat 7.0.79能在各种操作系统上运行,包括Unix、Ubuntu和Windows,这使得开发者和管理员可以在不同的环境中无缝迁移和部署应用。 9. **社区支持**:作为开源项目,Apache Tomcat拥有...

    Ubuntu 16.04安装Apache Tomcat的方法

    在Ubuntu 16.04上安装和配置Apache Tomcat是一个基本的步骤,但实际部署和管理Java应用可能涉及更多的配置和优化工作,例如调整内存分配、设置虚拟主机、配置SSL支持等。理解这些概念和命令对于任何Java开发者或系统...

    tomcat8.0.36linux版zip

    配合负载均衡器,可以将请求分发到多个Tomcat实例,提高系统的整体处理能力。 总之,"Tomcat 8.0.36 Linux版ZIP"是一个强大的、开源的Java Web服务器,适用于Linux环境,提供了丰富的功能和高度的可定制性,是开发...

    阿里云搭建tomcat/php 环境一键安装包

    阿里云搭建Tomcat和PHP环境一键安装包是一个高效便捷的方法,尤其适合...不过,需要注意的是,虽然一键安装简化了流程,但在生产环境中,还需要考虑安全、性能优化、日志监控等多个方面,确保服务的稳定性和安全性。

Global site tag (gtag.js) - Google Analytics