简体   繁体   English

同一台服务器中的多个jre和多个tomcat实例

[英]Multiple jre and multiple tomcat instances in same server

I have a requirement/situation where i need to deploy an application which runs in jre8 and tomcat8 in a server which already has jre6 and tomcat 6. 我有一个要求/情况,需要在已经具有jre6和tomcat 6的服务器中部署在jre8和tomcat8中运行的应用程序。

I don't want to make changes to the existing configuration(jre6 and tomcat 6) 我不想更改现有配置(jre6和tomcat 6)

Can i use server jre and configure it? 我可以使用服务器jre进行配置吗? Could you please detail it out? 您能详细说明一下吗? Please assist me on this. 请协助我。 Thanks a lot in advance. 非常感谢。

您可以尝试为Java 6 / Tomcat 6重新编译项目,但这只有在到目前为止没有使用Java 7/8和Tomcat 7/8功能的情况下才能成功。

You can have multiple JDK and JRE on same machine. 您可以在同一台计算机上拥有多个JDKJRE But, in your environment variable at a time, you will have one Java version to use (by default). 但是,一次要在您的环境变量中使用一个Java版本(默认情况下)。

You need to change the configuration file of specific server/application to use specific Java version. 您需要将特定服务器/应用程序的配置文件更改为使用特定Java版本。

I had a situation to configure an application that would run in Tomcat 8 and jre 9 in a windows server which already had a Tomcat 6 instance running with jre 6. I came across 2 possibilities and brought up both the applications. 我有一种情况,需要在Windows服务器中配置将在Tomcat 8和jre 9中运行的应用程序,而该服务器已经具有以jre 6运行的Tomcat 6实例。我遇到了两种可能性,并同时启动了这两个应用程序。

  1. To install tomcat as windows service 要将tomcat安装为Windows服务
  2. Copy another instance and configure 复制另一个实例并配置

If you would like to install the tomcat as windows service it makes it much simpler. 如果您想将tomcat作为Windows服务安装,它将使其更加简单。

1. To install tomcat as windows service 1.将tomcat安装为Windows服务

It is a better choice as it is not required to modify anything for the existing configuration and will not change default jre. 这是一个更好的选择,因为不需要为现有配置修改任何内容,并且不会更改默认jre。

  1. Download 'server jre' 下载“ server jre”
  2. Extract it and place it in a folder as below. 解压缩并将其放在如下所示的文件夹中。 D:\\Program Files\\Oracle Java Server\\jdk-9 D:\\ Program Files \\ Oracle Java服务器\\ jdk-9
  3. Download windows service installer 下载Windows服务安装程序
  4. Install the tomcat (8.5) downloaded and configure different ports from the existing of server 1(tomcat 6, check server.xml) 安装已下载的tomcat(8.5),并配置与服务器1的现有端口不同的端口(tomcat 6,请检查server.xml) 在此处输入图片说明
  5. Chose server jre while installing 安装时选择服务器JRE 在此处输入图片说明

2. Copy another instance and configure 2.复制另一个实例并配置

  1. Copy tomcat 6 and tomcat 8 in a folder 将tomcat 6和tomcat 8复制到一个文件夹中

  2. If JAVA_HOME and JRE_HOME were set, remove them. 如果设置了JAVA_HOME和JRE_HOME,请删除它们。

  3. Set path for jdk/jre in catalina.bat or add a file setenv.bat in the same location, something like, 在catalina.bat中设置jdk / jre的路径,或在同一位置添加文件setenv.bat,例如,

    set JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_131 and in another instance tomcat 6 设置JAVA_HOME = C:\\ Program Files \\ Java \\ jdk1.8.0_131并在另一个实例中设置tomcat 6

    set JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_45 设置JAVA_HOME = C:\\ Program Files \\ Java \\ jdk1.6.0_45

  4. Make sure both instances have different port configurations in server.xml 确保两个实例在server.xml中具有不同的端口配置

Different JREs and different Tomcat installations put aside. 不同的JRE和不同的Tomcat安装被搁置了。 If you have only one tomcat, you can run multiple instances by having separate CATALINA_BASE directories. 如果只有一个tomcat,则可以通过具有单独的CATALINA_BASE目录来运行多个实例。 (like so: tomcat - CATALINA_BASE and CATALINA_HOME variables ) (例如: tomcat-CATALINA_BASE和CATALINA_HOME变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM