简体   繁体   中英

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.

I don't want to make changes to the existing configuration(jre6 and tomcat 6)

Can i use server jre and configure it? 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. But, in your environment variable at a time, you will have one Java version to use (by default).

You need to change the configuration file of specific server/application to use specific Java version.

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.

  1. To install tomcat as windows service
  2. Copy another instance and configure

If you would like to install the tomcat as windows service it makes it much simpler.

1. To install tomcat as windows service

It is a better choice as it is not required to modify anything for the existing configuration and will not change default jre.

  1. Download 'server jre'
  2. Extract it and place it in a folder as below. D:\\Program Files\\Oracle Java Server\\jdk-9
  3. Download windows service installer
  4. Install the tomcat (8.5) downloaded and configure different ports from the existing of server 1(tomcat 6, check server.xml) 在此处输入图片说明
  5. Chose server jre while installing 在此处输入图片说明

2. Copy another instance and configure

  1. Copy tomcat 6 and tomcat 8 in a folder

  2. If JAVA_HOME and JRE_HOME were set, remove them.

  3. Set path for jdk/jre in catalina.bat or add a file setenv.bat in the same location, something like,

    set JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_131 and in another instance tomcat 6

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

  4. Make sure both instances have different port configurations in server.xml

Different JREs and different Tomcat installations put aside. If you have only one tomcat, you can run multiple instances by having separate CATALINA_BASE directories. (like so: tomcat - CATALINA_BASE and CATALINA_HOME variables )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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