Boot startup settings for Tomcat in Ubuntu 14

Source: Internet
Author: User
Tags locale posix

On boot, the statement that will be executed is written to/etc/rc.local.

#!/bin/SH-e## rc.local## This script was executed at the end of all multiuser runlevel.# make sure that the script would"Exit 0"On success or any other# value on error.## in order to enable or disable this script just change the execution# bits. # # By default this script does nothing.# source/etc/Environmentsource/etc/Profilelocale>>/home/cnic/locale. txt/usr/tomcat/apache-tomcat-8.0. -/bin/startup.SHEcho "Tomcat started--."Exit0

If you do not add/etc/profile, you will not be able to start Tomcat without the necessary environment variables.

To analyze whether the rc.local is running successfully, you can view the output information at boot-up in/var/log/boot.log.

As set up, the boot started Tomcat, but the page of Chinese is all garbled, in the rc.local add the statement

Locale >>/home/cnic/locale.txt

Let the language configuration information output to the file at boot, you can see the locate output at boot:

lang=LANGUAGE=lc_ctype="POSIX"lc_numeric="POSIX"Lc_time="POSIX"lc_collate="POSIX"lc_monetary="POSIX"lc_messages="POSIX"Lc_paper="POSIX"Lc_name="POSIX"lc_address="POSIX"Lc_telephone="POSIX"lc_measurement="POSIX"lc_identification="POSIX"Lc_all=

Manually enter locate to output the content:

Lang=en_us. utf-8LANGUAGE=lc_ctype=en_us. utf-8lc_numeric=en_us. utf-8Lc_time=en_us. utf-8lc_collate=en_us. utf-8lc_monetary=en_us. utf-8lc_messages=en_us. utf-8Lc_paper=en_us. utf-8Lc_name=en_us. utf-8lc_address=en_us. utf-8Lc_telephone=en_us. utf-8lc_measurement=en_us. utf-8lc_identification=en_us. utf-8Lc_all=

Can be seen in the rc.local run, there is no language encoding related settings, resulting in Chinese output garbled.

How to set parameters such as Lc_all when the rc.local is running, no workaround is found.

Refer to the relevant literature on the Internet to add the following statement in tomcat/bin/catalina.sh:

... export java_opts="-dfile.encoding=utf-8-duser.language=en_us"... 

After restarting, Tomcat boots up and the Chinese display is normal.

The system environment is: Ubuntu 14, English

Boot startup settings for Tomcat in Ubuntu 14

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.