can't we create multiple instances of tomcat7 in ubuntu?

June 12, 2016 397 views
Configuration Management Java Deployment DigitalOcean Articles DigitalOcean

I created duplicate instance of tomcat by creating a directory under /var/lib/tomcat7-a. Later i updated server.xml with new port i copied catalina.properties file and web.xml.

finally created init service for tomcat7-a and updated with defaults.
I tried to start the program when i pose a command like,
service tomcat7-a start
it gives "tomcat7-a not installed"
it stops at below script in init program,
if [ ! -f "$CATALINAHOME/bin/bootstrap.jar" ]; then
failure_msg "$NAME is not installed.... kjfkdj"
exit 1

what should i do now?

  • In your case, note that $CATALINA_BASE should be different from $CATALINA_HOME, where the former is where you created your instance and the latter is where tomcat7 is installed. Usually, $CATALINA_HOME is installed in /usr/share/tomcat7 on Ubuntu.

  • I configured the
    $ cd /var/lib/
    $ sudo mkdir tomcat7-a
    $ cd /var/lib/tomcat7-a
    $ sudo mkdir conf temp webapps work logs
    $ sudo mkdir conf temp webapps work logs
    $ cd ..

    $ sudo chown -R tomcat7:tomcat7 tomcat7-a
    $ sudo ln- s /var/lib/tomcat7/conf/catalina.properties /var/lib/tomcat7-a/conf

    $ sudo ln- s /var/lib/tomcat7/conf/web.xml /var/lib/tomcat7-a/conf

    $ sudo ln- s /var/lib/tomcat7/conf/policy.d/ /var/lib/tomcat7-a/conf

    $ sudo cp /var/lib/tomcat7/conf/server.xml /var/lib/tomcat7-a/conf/

    -->changed the port 8080 to 8081 in tomcat7-a server.xml
    $ cd /etc/init.d/
    $ sudo cp tomcat7 tomcat7-a

    DESC=”Tomcat servlet engine”
    $ sudo service tomcat7-a start

    $ sudo update -rc.d tomcat7-a defaults

    Now, when i try to start the new instance it kicks with an error like above what i mentioned. Now i changed the CATALINABASE=/var/lib/tomcat7-a and CATALINAHOME=/usr/share/tomcat7 in new instance init config.

    Now it is starting when i use service tomcat7-a start. But when i go to browser it kicks an error like,
    http://localhost:8081/ Failed to load resource: the server responded with a status of 404 (Not Found)

    am i did anything wrong in config? ratherthan displaying tomcat manager page it displaying blank screen.. when i go to console i see this error.

Be the first one to answer this question.