LoginSignup
1
2

More than 5 years have passed since last update.

自分用のTomcatインストールから設定までの確認資料

Last updated at Posted at 2016-05-18

Tomcatについての備忘録

インストール

$ sudo apt-get install tomcat7 tomcat7-admin tomcat7-common tomcat7-docs tomcat7-examples tomcat7-user

サービスの起動・終了

sudo /etc/init.d/tomcat start
sudo /etc/init.d/tomcat stop
sudo /etc/init.d/tomcat restart

開発環境のTomcat作成

tomcat7-instance-create [direcotoryname]

上記を実行すると以下のようなディレクトリ構成が作成されます

.
└── tomcat
├── bin
│   ├── setenv.sh
│   ├── shutdown.sh
│   └── startup.sh
├── conf
│   ├── Catalina
│   │   └── localhost
│   ├── catalina.properties
│   ├── context.xml
│   ├── logging.properties
│   ├── server.xml
│   ├── tomcat-users.xml
│   └── web.xml
├── logs
│   ├── catalina.2016-05-18.log
│   ├── catalina.out
│   ├── localhost.2016-05-18.log
│   └── localhost_access_log.2016-05-18.txt
├── temp
├── webapps
└── work
└── Catalina
└── localhost
└── _

上記のwebappsに以下のようにディレクトリを作成し、index.htmlファイルを設定するとサーバーが稼働しているのが確認できる。

├── webapps
│   └── ROOT
│   └── index.html

開発環境のTomcat起動・終了

開発環境内のTomcatについては、起動・終了は、上記tree上のbin配下にある、startup.shとshutdown.shを利用する。

./startup.sh
./shutdown.sh

上記までできれば各開発環境内でのTomcatを設定できると思われます。

追加バグ情報

http://askubuntu.com/questions/313103/cannot-start-tomcat-after-installing-a-private-instance

Eclipseで利用する場合は、抜けているファイルがあるので、tomcat7-instance-create [directoryname]
でできたものに対して、以下の事を実行する事。

// Eclipseで使用するのに足りないファイルがあるので、リンクを作成しておく。
ln -s /usr/share/tomcat7/lib [directoryname]/lib
ln -s /usr/share/tomcat7/bin/bootstrap.jar [directoryname]/bin/bootstrap.jar

// curlはデフォルトで入っていないので、必要に応じて、[sudo apt-get install curl]でインストール
curl http://bazaar.launchpad.net/\~ubuntu-branches/ubuntu/precise/tomcat7/precise/view/head:/conf/catalina.policy > [directoryname]/conf/catalina.policy

Eclipseでサーバ追加をしようとした際に、ブランクでキー入力が効かない場合。
http://stackoverflow.com/questions/14791843/eclipse-add-tomcat-7-blank-server-name
上記を読めばわかる。

追加情報

Tomcatバージョン確認方法

sinaku:bash-4.3$pwd
/usr/share/tomcat7/bin
sinaku:bash-4.3$ls
bootstrap.jar configtest.sh setclasspath.sh tomcat-juli.jar
catalina-tasks.xml daemon.sh shutdown.sh tool-wrapper.sh
catalina.sh digest.sh startup.sh version.sh
sinaku:bash-4.3$./version.sh
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr/lib/jvm/java-8-oracle
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.52 (Ubuntu)
Server built: Jun 19 2015 08:54:46
Server number: 7.0.52.0
OS Name: Linux
OS Version: 3.13.0-86-generic
Architecture: amd64
JVM Version: 1.8.0_91-b14
JVM Vendor: Oracle Corporation

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2