I installed two versions of the tomcat on my server, I followed the DigitalOcean Tutorial , that teaches how to install and configures upstart script, but I need have two versions of the Tomcat 7 and 8.
The Tomcat 8 was installed on following path:
/opt/tomcat
And Tomcat 7
/opt/tomcat7
I followed every step about installation. Tomcat 8 works fine on port 8080 but tomcat 7 don't works.
Edited
When I try to run the "sudo initctl start tomcat7"
the follow message is displayed "tomcat7 start/running, process 24621"
but when try restart "sudo initctl restart tomcat7"
the message is initctl: Unknown instance:
I Have been tested the script init-checkconf /etc/init/tomcat7.conf
and it is ok File /etc/init/tomcat7.conf: syntax ok
http://myIp:8080 tomcat 8 is ok
http://myIp:8081 tomcat 7 dont't open on browser
I believe that my config is not right.
Tomcat 8 config:
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
</Service>
</Server>
/etc/init/tomcat.conf
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid tomcat
setgid tomcat
env JAVA_HOME=/usr/lib/jvm/java-8-oracle
env CATALINA_HOME=/opt/tomcat
# Modify these options as needed
env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
rm -rf $CATALINA_HOME/temp/*
end script
And...
Tomcat 7 config:
<?xml version='1.0' encoding='utf-8'?>
<Server port="8006" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8444" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />
</Service>
</Server>
/etc/init/tomcat7.conf
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid tomcat
setgid tomcat
env JAVA_HOME=/usr/lib/jvm/java-8-oracle
env CATALINA_HOME=/opt/tomcat7
# Modify these options as needed
env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
rm -rf $CATALINA_HOME/temp/*
end script
Somebody know how to make the correctly installation, thanks in advance!
I ran the manual mode and work:
sudo /opt/tomcat7/bin/startup.sh
Using CATALINA_BASE: /opt/tomcat7 Using CATALINA_HOME: /opt/tomcat7 Using CATALINA_TMPDIR: /opt/tomcat7/temp Using JRE_HOME: /usr Using CLASSPATH: /opt/tomcat7/bin/bootstrap.jar:/opt/tomcat7/bin/tomcat-juli.jar Tomcat started.
feel free to reopen this question if necessary!
thanks!
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.