投稿者「wpepea」のアーカイブ

Spring Securityのユーザ認証でちょこっと躓いた

DB認証を設定しようとして

@Entity
public class User implements UserDetails {

private static final long serialVersionUID = 1L;

public enum Authority {ROLE_USER, ROLE_ADMIN}

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

@Column(nullable = false, unique = true)
private String username;

@Column(nullable = false)
private String password;

Userというクラス名でテーブルの生成をしようとしたら、以下のエラーが発生

Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near “user”Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near “user”  ポジション: 13 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7] at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7] at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7] at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7] at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]

Postgresの予約語とかさなったとのこと。リンク先のとりあえずの手段として以下のようにエスケープを二重にしたら動いた。(password列も必要とのこと)

@Entity
@Table(name = “`USER`”)
public class User implements UserDetails {

ただ、そもそも予約語と重ならないほうがよいよということなので後で変える

 

ng serveの起動オプション

Angularを少し触っておくかと思い開発機(CentOS)のVagrant上にインストール。
public network経由で作業端末(非力なWindows)からつなごうと思っても接続を拒否された。

このサイトにアクセスできません

192.168.1.108 で接続が拒否されました。
192 168 108 4200 を Google で検索してください
ERR_CONNECTION_REFUSED

pingは通るけど、開発機(Vagrantのホスト)からもcurlでつながらない。vagrantに入ってチェックするとlocalhostなら繋がる。

curl http://192.168.1.108:4200
curl: (7) Failed connect to 192.168.1.108:4200; 接続を拒否されました

[root@localhost log]# curl http://localhost:4200
<!doctype html>
<html>
<head>
 <meta charset="utf-8">
 <title>TestWeb</title>
 <base href="/">

 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
 <app-root>Loading...</app-root>
<script type="text/javascript" src="inline.bundle.js"></script><script type="text/javascript" src="polyfills.bundle.js"></script><script type="text/javascript" src="styles.bundle.js"></script><script type="text/javascript" src="vendor.bundle.js"></script><script type="text/javascript" src="main.bundle.js"></script></body>
</html>

ぐぐるとhostオプション付けないと、localhostしかlistenしないらしい

[root@localhost log]# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1201/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1719/master
tcp        0      0 127.0.0.1:4200          0.0.0.0:*               LISTEN      3792/@angular/cli

ng serve –host 192.168.1.108
としておいて確認

[root@localhost log]# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1201/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1719/master
tcp        0      0 192.168.1.108:4200      0.0.0.0:*               LISTEN      3827/@angular/cli

Local Addressに設定される。

調べる過程でSELinuxとFirewallとめた。

SELinuxは起動だけだとaudit.logに何もでていない。動作確認でハマりたくないのでpermissiveのまま時々auditみて確認ぐらいにしておく。

Firewallはportが空いていないので空けておく。(色々あける必要がでて面倒になったらFirewallとめたまま勉強する)

[vagrant@localhost ~]$ sudo firewall-cmd --list-ports --zone=public
(空欄)
[vagrant@localhost ~]$ sudo firewall-cmd --add-port=4200/tcp --zone=public --permanent
success
[vagrant@localhost ~]$ sudo firewall-cmd --reload
success
[vagrant@localhost ~]$ sudo firewall-cmd --list-ports --zone=public
4200/tcp

hostオプションのドキュメントはぱっとみ見つからなかったけど、いつものGoogleさんでドキュメントは無いものと考えたらいいのかな??

まだ動いてなかった

docker-machineでcreateしたdockerだけど、離席から帰ってきたら動いていなかった。

[yoshitake@localhost docker-repo]$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
testsv   -        generic      Stopped                                       Unknown

離席前にリモートのサーバrebootかけてたな。
いったんdocker-machine rmしてから作り直そうとしたけど繋がらなそう。
直に通常のssh接続しようとしても繋がらず。

単純にssh繋がらないだけっぽい。
ということでさくらVPSなので管理画面から接続。

やったことを改めて思い返すとdocker-machine入らなかったのでSELinux一時停止して試したままだった。んで、ssh port変更したけどSELinuxの設定していない。

(ここからVPNの管理コンソールなのでコピペはなし)
semanage port -l| grep ssh で新しいポート表示されず。
semanage port -a -t ssh_port_t -p tcp nnnnn もした履歴無し。
jarnalctl -xe にsshd上げるときにポートのパーミッションがなくてバインド失敗したメッセージが出ていました

docker-machineが古かった

docker-machineでCentOS7に入れたdockerが起動しなかった。

インストール元

Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with centos...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Error creating machine: Error running provisioning: exit status 5

インストール先

[root@testsv system]# systemctl status docker.service -l
 * docker.service - Docker Application Container Engine
 Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: disabled)
 Active: inactive (dead) since Wed 2017-05-10 18:15:08 JST; 28min ago
 Main PID: 13716 (code=exited, status=0/SUCCESS)

May 10 18:15:03 testsv dockerd[13716]: time="2017-05-10T18:15:03.609609938+09:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
 May 10 18:15:04 testsv dockerd[13716]: time="2017-05-10T18:15:04.102333287+09:00" level=info msg="Loading containers: done."
 May 10 18:15:04 testsv dockerd[13716]: time="2017-05-10T18:15:04.124630882+09:00" level=info msg="Daemon has completed initialization"
 May 10 18:15:04 testsv dockerd[13716]: time="2017-05-10T18:15:04.124714583+09:00" level=info msg="Docker daemon" commit=89658be graphdriver=overlay version=17.05.0-ce
 May 10 18:15:04 testsv dockerd[13716]: time="2017-05-10T18:15:04.146221898+09:00" level=info msg="API listen on /var/run/docker.sock"
 May 10 18:15:04 testsv systemd[1]: Started Docker Application Container Engine.
 May 10 18:15:07 testsv systemd[1]: Stopping Docker Application Container Engine...
 May 10 18:15:07 testsv dockerd[13716]: time="2017-05-10T18:15:07.527842954+09:00" level=info msg="Processing signal 'terminated'"
 May 10 18:15:07 testsv dockerd[13716]: time="2017-05-10T18:15:07.53054844+09:00" level=info msg="stopping containerd after receiving terminated"
 May 10 18:15:08 testsv systemd[1]: Stopped Docker Application Container Engine.

症状をみるとこれっぽい。日付けをみるとだいぶ古いけど、masterには取り込まれているから〜といっている。ちゅうことは、docker-machineが古いな。

日本語ドキュメントのワンライナー手順で入れたけど、リリースページを確認するとにほんご頁よりも大分バージョンが上がっている。
リリースページの手順で再インストール。

Provisioning with centos...
Error creating machine: Error running provisioning: something went wrong running an SSH command
command : sudo systemctl -f restart docker
err     : exit status 5
output  : Failed to restart docker.service: Unit not found.

そのままもう一回docker-machine rm -> docker-machine createは失敗。
インストール先で
rm /etc/systemd/system/docker.service

yum remove docker-engine
したら取り敢えず入った。

動作確認はこれから

Dockerの消せないイメージが残っていた

[root@localhost yoshitake]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest f753707788c5 6 months ago 127MB
[root@localhost yoshitake]# docker rmi ubuntu
Error response from daemon: No such image: ubuntu:latest
[root@localhost yoshitake]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              f753707788c5        6 months ago        127MB
[root@localhost yoshitake]# docker rmi f753707788c5
Error response from daemon: reference does not exist

何か消せないdocker imageがいた。こちらをみてファイルがあった/var/lib/docker/image/devicemapper/imagedb/contentのしただけ削除

rm /var/lib/docker/image/devicemapper/imagedb/content/sha256/f753707788c5c100f194ce0a73058faae1a457774efcda6c1469544a114f8644
rm: 通常ファイル `/var/lib/docker/image/devicemapper/imagedb/content/sha256/f753707788c5c100f194ce0a73058faae1a457774efcda6c1469544a114f8644' を削除しますか? y

とりあえず、消えてくれた。きちんと動くかな??

/etc/sudoers.dの#

vagrantのsudo設定
/etc/sudoers.d/vagrant
にしかなさそうだけど/etc/sudoersコメントアウトアウトされてるよねと必死に設定探していたら

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d

!! コメントじゃない。

これはみな一度は騙されるに違いない。。。。

 

knife zero移行でぼちぼちエラー

今迄、knife soloを使っていたけれどもメインサーバ移設に併せてknife zeroに移行しようと試験中。
基本はDockerになるのでDockerを動かす基盤としてのプロビジョニングのみ。なので、さくっと終わるかと思ったらそこそこてまどっています。簡単に解決できたものも含めてメモ。

 

ChefDKとrbenb併用しているとrubyのパスがrbenvを向いている(ことが多い)。knife zeloをgemで入れてもrbenvの方を向いてしまいknife zeroが動かない。
Knife-ZeroをマスターしてChef Soloの引退に備えよう!」を参考に修正。
自分はrubyの開発は今のところしないのでrbenvを削除。

knife zero bootstrap ホスト名 だとパーミッションではじかれる。

base7 and any other relevant details that might help us with troubleshooting.
base7 
base7 mkdir: ディレクトリ `/etc/chef' を作成できません: 許可がありません
base7 sh: 行 179: /etc/chef/validation.pem: そのようなファイルやディレクトリはありません

–sudoオプションが必要

 

vagrantで(名前解決しないで?)Nオプションをつけないと、nodes/localhost.jsonになる。名前解決できない状態では、host名をnode名.jsonから(?)逆引きする設定をしないと動かないようなのでlocalhostとしてしまうと2つvagfrantをあげると混乱する。

knife zero bootstrap base7 -N base7 --sudo

 

名前解決していない状態ではホスト名指定のconvergeでは動かない。

knife zero converge base7 --sudo
FATAL: No nodes returned from search

※ base7は~/.ssh/config に設定

knife soloではbase7はsshの接続情報だったが、knife zeloではデフォルトでは一度ホスト名として名前解決にいっているということか??

nodesのjsonを見てやるようにオプション指定をすることで回避

knife zero converge -a knife_zero.host "name:base7"   --sudo
base7 [2017-04-26T02:34:28+00:00] INFO: Forking chef instance to converge...
base7 Starting Chef Client, version 12.19.36

name:ホスト名でknife zeloで設定されているもの(node/json)を使用するらしい。
同じサーバに名前を付けてlocalhost.jsonとbase7_2.jsonがあった状態で”name:localhost”を指定したらbase7_2.jsonが読み込まれたと思われる動きをした。jsonファイル名を見ている訳ではなさそうなので注意。(いま深堀りする必要ないので、取り敢えず名前付きのみで運用)

 

[2017-04-26T02:47:09+00:00] INFO: Running queued delayed notifications before re-raising exception
base7 
base7 Running handlers:
base7 [2017-04-26T02:47:09+00:00] ERROR: Running exception handlers
base7 Running handlers complete
base7 [2017-04-26T02:47:09+00:00] ERROR: Exception handlers complete
base7 Chef Client failed. 0 resources updated in 13 seconds
base7 [2017-04-26T02:47:09+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
base7 [2017-04-26T02:47:09+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
base7 [2017-04-26T02:47:09+00:00] ERROR: yum_package[nginx] (nginx::default line 10) had an error: Chef::Exceptions::Package: No candidate version available for nginx
base7 [2017-04-26T02:47:09+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

パッケージない時のエラーメッセージ、結構下の方に出ているのでぱっとみ見落としやすい

 

 

 

 

Portが埋まっている。

SpringBootの勉強でSTSから出力したjarをWindowsのコマンドプロンプトから実行。

原因調査中だけどメモ代わりに

単に実行可能jarデスクトップ上でダブルクリックしていたのが残っていただけでした。。。。

java -jar C:\Users\epea.pc01\Desktop\mrs-0.0.1-SNAPSHOT.jar

すると、portが埋まっていると言われて起動できなかった。

2017-04-20 17:08:24.561 ERROR 10048 --- [           main] o.a.coyote.http11.Http11NioProtocol      : 
 Failed to start end point associated with ProtocolHandler [http-nio-8080]

java.net.BindException: Address already in use: bind
        at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_131]
        at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_131]
        at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_131]

確認すると確かに使用されている。

PS C:\Users\epea.pc01> netstat -oan|Select-String "8080"

  TCP         0.0.0.0:8080           0.0.0.0:0              LISTENING
  TCP         [::]:8080              [::]:0                 LISTENING


PS C:\Users\epea.pc01> Get-Process -Id "2664"

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    380      39   570384     365884      34.33   2664   1 javaw
PS C:\Users\epea.pc01>  Get-Process javaw | Form


Name                       : javaw
Id                         : 2664
PriorityClass              : Normal
FileVersion                : 8.0.1310.11
HandleCount                : 376
WorkingSet                 : 57143296
PagedMemorySize            : 588607488
PrivateMemorySize          : 588607488
VirtualMemorySize          : -427937792
TotalProcessorTime         : 00:00:34.5312500
SI                         : 1
Handles                    : 376
VM                         : 3867029504
WS                         : 57143296
PM                         : 588607488
NPM                        : 40056
Path                       : C:\Program Files\Ja
Company                    : Oracle Corporation
CPU                        : 34.53125
ProductVersion             : 8.0.1310.11
Description                : Java(TM) Platform S
Product                    : Java(TM) Platform S
__NounName                 : Process
BasePriority               : 8
ExitCode                   :
HasExited                  : False
ExitTime                   :
Handle                     : 1564
SafeHandle                 : Microsoft.Win32.Saf
MachineName                : .
MainWindowHandle           : 0
MainWindowTitle            :
MainModule                 : System.Diagnostics.
MaxWorkingSet              : 1413120
MinWorkingSet              : 204800
Modules                    : {System.Diagnostics
                             ), System.Diagnosti
                             ELBASE.dll)...}
NonpagedSystemMemorySize   : 40056
NonpagedSystemMemorySize64 : 40056
PagedMemorySize64          : 588607488
PagedSystemMemorySize      : 207872
PagedSystemMemorySize64    : 207872
PeakPagedMemorySize        : 668753920
PeakPagedMemorySize64      : 668753920
PeakWorkingSet             : 454303744
PeakWorkingSet64           : 454303744
PeakVirtualMemorySize      : -357683200
PeakVirtualMemorySize64    : 3937284096
PriorityBoostEnabled       : True
PrivateMemorySize64        : 588607488
PrivilegedProcessorTime    : 00:00:03.6250000
ProcessName                : javaw
ProcessorAffinity          : 15
Responding                 : True
SessionId                  : 1
StartInfo                  : System.Diagnostics.
StartTime                  : 2017/04/20 16:51:46
SynchronizingObject        :
Threads                    : {10604, 11860, 7328
UserProcessorTime          : 00:00:30.9062500
VirtualMemorySize64        : 3867029504
EnableRaisingEvents        : False
StandardInput              :
StandardOutput             :
StandardError              :
WorkingSet64               : 57143296
Site                       :
Container                  :

スレッドダンプ

2017-04-20 18:31:47
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode):

"DestroyJavaVM" #24 prio=5 os_prio=0 tid=0x000000001ac06000 nid=0x2e54 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"http-nio-8080-AsyncTimeout" #22 daemon prio=5 os_prio=0 tid=0x000000001ac09000 nid=0x1e0 waiting on condition [0x000000002459f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at org.apache.coyote.AbstractProtocol$AsyncTimeout.run(AbstractProtocol.java:1138)
	at java.lang.Thread.run(Unknown Source)

"http-nio-8080-Acceptor-0" #21 daemon prio=5 os_prio=0 tid=0x000000001ac08800 nid=0x2080 runnable [0x000000002449f000]
   java.lang.Thread.State: RUNNABLE
	at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
	at sun.nio.ch.ServerSocketChannelImpl.accept(Unknown Source)
	at sun.nio.ch.ServerSocketChannelImpl.accept(Unknown Source)
	- locked  (a java.lang.Object)
	at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:443)
	at java.lang.Thread.run(Unknown Source)

"http-nio-8080-ClientPoller-1" #20 daemon prio=5 os_prio=0 tid=0x000000001ac07800 nid=0x12b8 runnable [0x000000002439f000]
   java.lang.Thread.State: RUNNABLE
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
	at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
	at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
	- locked  (a sun.nio.ch.Util$3)
	- locked  (a java.util.Collections$UnmodifiableSet)
	- locked  (a sun.nio.ch.WindowsSelectorImpl)
	at sun.nio.ch.SelectorImpl.select(Unknown Source)
	at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:775)
	at java.lang.Thread.run(Unknown Source)

"http-nio-8080-ClientPoller-0" #19 daemon prio=5 os_prio=0 tid=0x000000001ac0d000 nid=0x2a8c runnable [0x000000002429f000]
   java.lang.Thread.State: RUNNABLE
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
	at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
	at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
	- locked  (a sun.nio.ch.Util$3)
	- locked  (a java.util.Collections$UnmodifiableSet)
	- locked  (a sun.nio.ch.WindowsSelectorImpl)
	at sun.nio.ch.SelectorImpl.select(Unknown Source)
	at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:775)
	at java.lang.Thread.run(Unknown Source)

"NioBlockingSelector.BlockPoller-1" #18 daemon prio=5 os_prio=0 tid=0x000000001ac0b800 nid=0x12a0 runnable [0x000000002419e000]
   java.lang.Thread.State: RUNNABLE
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
	at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
	at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
	at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
	- locked  (a sun.nio.ch.Util$3)
	- locked  (a java.util.Collections$UnmodifiableSet)
	- locked  (a sun.nio.ch.WindowsSelectorImpl)
	at sun.nio.ch.SelectorImpl.select(Unknown Source)
	at org.apache.tomcat.util.net.NioBlockingSelector$BlockPoller.run(NioBlockingSelector.java:339)

"Tomcat JDBC Pool Cleaner[791452441:1492674713173]" #17 daemon prio=5 os_prio=0 tid=0x000000001a5ec800 nid=0x2478 in Object.wait() [0x0000000020a1f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.util.TimerThread.mainLoop(Unknown Source)
	- locked  (a java.util.TaskQueue)
	at java.util.TimerThread.run(Unknown Source)

"container-0" #16 prio=5 os_prio=0 tid=0x0000000018f8e000 nid=0x1c9c waiting on condition [0x00000000207af000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at org.apache.catalina.core.StandardServer.await(StandardServer.java:427)
	at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer$1.run(TomcatEmbeddedServletContainer.java:174)

"ContainerBackgroundProcessor[StandardEngine[Tomcat]]" #15 daemon prio=5 os_prio=0 tid=0x0000000019690000 nid=0x15a4 waiting on condition [0x00000000206af000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1355)
	at java.lang.Thread.run(Unknown Source)

"Service Thread" #9 daemon prio=9 os_prio=0 tid=0x0000000018cf8800 nid=0x2500 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C1 CompilerThread2" #8 daemon prio=9 os_prio=2 tid=0x0000000018c86000 nid=0x275c waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x000000001766d800 nid=0x27e8 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x000000001766a800 nid=0x21e0 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x0000000017669000 nid=0x528 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x0000000017668800 nid=0x2a60 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x00000000175fa800 nid=0x1e6c in Object.wait() [0x000000001897f000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on  (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(Unknown Source)
	- locked  (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(Unknown Source)
	at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x00000000015bf000 nid=0x254c in Object.wait() [0x000000001887e000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on  (a java.lang.ref.Reference$Lock)
	at java.lang.Object.wait(Unknown Source)
	at java.lang.ref.Reference.tryHandlePending(Unknown Source)
	- locked  (a java.lang.ref.Reference$Lock)
	at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)

"VM Thread" os_prio=2 tid=0x00000000175d7800 nid=0x2600 runnable 

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00000000014e7000 nid=0x1ca0 runnable 

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00000000014e8800 nid=0x1428 runnable 

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00000000014ea000 nid=0x1950 runnable 

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x00000000014ec800 nid=0x10cc runnable 

"VM Periodic Task Thread" os_prio=2 tid=0x0000000018d55800 nid=0xaec waiting on condition 

JNI global references: 288

2017-04-20 18:31:47
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode):

"DestroyJavaVM" #24 prio=5 os_prio=0 tid=0x000000001ac06000 nid=0x2e54 waiting on condition [0x0000000000000000]
 java.lang.Thread.State: RUNNABLE

"http-nio-8080-AsyncTimeout" #22 daemon prio=5 os_prio=0 tid=0x000000001ac09000 nid=0x1e0 waiting on condition [0x000000002459f000]
 java.lang.Thread.State: TIMED_WAITING (sleeping)
 at java.lang.Thread.sleep(Native Method)
 at org.apache.coyote.AbstractProtocol$AsyncTimeout.run(AbstractProtocol.java:1138)
 at java.lang.Thread.run(Unknown Source)

"http-nio-8080-Acceptor-0" #21 daemon prio=5 os_prio=0 tid=0x000000001ac08800 nid=0x2080 runnable [0x000000002449f000]
 java.lang.Thread.State: RUNNABLE
 at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
 at sun.nio.ch.ServerSocketChannelImpl.accept(Unknown Source)
 at sun.nio.ch.ServerSocketChannelImpl.accept(Unknown Source)
 - locked <0x00000000e4d21c20> (a java.lang.Object)
 at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:443)
 at java.lang.Thread.run(Unknown Source)

"http-nio-8080-ClientPoller-1" #20 daemon prio=5 os_prio=0 tid=0x000000001ac07800 nid=0x12b8 runnable [0x000000002439f000]
 java.lang.Thread.State: RUNNABLE
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
 at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
 at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
 - locked <0x00000000e4d221b0> (a sun.nio.ch.Util$3)
 - locked <0x00000000e4d221a0> (a java.util.Collections$UnmodifiableSet)
 - locked <0x00000000e4d22040> (a sun.nio.ch.WindowsSelectorImpl)
 at sun.nio.ch.SelectorImpl.select(Unknown Source)
 at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:775)
 at java.lang.Thread.run(Unknown Source)

"http-nio-8080-ClientPoller-0" #19 daemon prio=5 os_prio=0 tid=0x000000001ac0d000 nid=0x2a8c runnable [0x000000002429f000]
 java.lang.Thread.State: RUNNABLE
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
 at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
 at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
 - locked <0x00000000e4d25e00> (a sun.nio.ch.Util$3)
 - locked <0x00000000e4d25df0> (a java.util.Collections$UnmodifiableSet)
 - locked <0x00000000e4d25c90> (a sun.nio.ch.WindowsSelectorImpl)
 at sun.nio.ch.SelectorImpl.select(Unknown Source)
 at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:775)
 at java.lang.Thread.run(Unknown Source)

"NioBlockingSelector.BlockPoller-1" #18 daemon prio=5 os_prio=0 tid=0x000000001ac0b800 nid=0x12a0 runnable [0x000000002419e000]
 java.lang.Thread.State: RUNNABLE
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
 at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
 at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
 at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
 - locked <0x00000000e4d2a6f0> (a sun.nio.ch.Util$3)
 - locked <0x00000000e4d2a6e0> (a java.util.Collections$UnmodifiableSet)
 - locked <0x00000000e4d2a590> (a sun.nio.ch.WindowsSelectorImpl)
 at sun.nio.ch.SelectorImpl.select(Unknown Source)
 at org.apache.tomcat.util.net.NioBlockingSelector$BlockPoller.run(NioBlockingSelector.java:339)

"Tomcat JDBC Pool Cleaner[791452441:1492674713173]" #17 daemon prio=5 os_prio=0 tid=0x000000001a5ec800 nid=0x2478 in Object.wait() [0x0000000020a1f000]
 java.lang.Thread.State: TIMED_WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 at java.util.TimerThread.mainLoop(Unknown Source)
 - locked <0x0000000081412b20> (a java.util.TaskQueue)
 at java.util.TimerThread.run(Unknown Source)

"container-0" #16 prio=5 os_prio=0 tid=0x0000000018f8e000 nid=0x1c9c waiting on condition [0x00000000207af000]
 java.lang.Thread.State: TIMED_WAITING (sleeping)
 at java.lang.Thread.sleep(Native Method)
 at org.apache.catalina.core.StandardServer.await(StandardServer.java:427)
 at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer$1.run(TomcatEmbeddedServletContainer.java:174)

"ContainerBackgroundProcessor[StandardEngine[Tomcat]]" #15 daemon prio=5 os_prio=0 tid=0x0000000019690000 nid=0x15a4 waiting on condition [0x00000000206af000]
 java.lang.Thread.State: TIMED_WAITING (sleeping)
 at java.lang.Thread.sleep(Native Method)
 at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1355)
 at java.lang.Thread.run(Unknown Source)

"Service Thread" #9 daemon prio=9 os_prio=0 tid=0x0000000018cf8800 nid=0x2500 runnable [0x0000000000000000]
 java.lang.Thread.State: RUNNABLE

"C1 CompilerThread2" #8 daemon prio=9 os_prio=2 tid=0x0000000018c86000 nid=0x275c waiting on condition [0x0000000000000000]
 java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x000000001766d800 nid=0x27e8 waiting on condition [0x0000000000000000]
 java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x000000001766a800 nid=0x21e0 waiting on condition [0x0000000000000000]
 java.lang.Thread.State: RUNNABLE

"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x0000000017669000 nid=0x528 waiting on condition [0x0000000000000000]
 java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x0000000017668800 nid=0x2a60 runnable [0x0000000000000000]
 java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x00000000175fa800 nid=0x1e6c in Object.wait() [0x000000001897f000]
 java.lang.Thread.State: WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 - waiting on <0x0000000080bbf448> (a java.lang.ref.ReferenceQueue$Lock)
 at java.lang.ref.ReferenceQueue.remove(Unknown Source)
 - locked <0x0000000080bbf448> (a java.lang.ref.ReferenceQueue$Lock)
 at java.lang.ref.ReferenceQueue.remove(Unknown Source)
 at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x00000000015bf000 nid=0x254c in Object.wait() [0x000000001887e000]
 java.lang.Thread.State: WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 - waiting on <0x0000000080b2dda8> (a java.lang.ref.Reference$Lock)
 at java.lang.Object.wait(Unknown Source)
 at java.lang.ref.Reference.tryHandlePending(Unknown Source)
 - locked <0x0000000080b2dda8> (a java.lang.ref.Reference$Lock)
 at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)

"VM Thread" os_prio=2 tid=0x00000000175d7800 nid=0x2600 runnable 

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00000000014e7000 nid=0x1ca0 runnable 

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00000000014e8800 nid=0x1428 runnable 

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00000000014ea000 nid=0x1950 runnable 

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x00000000014ec800 nid=0x10cc runnable 

"VM Periodic Task Thread" os_prio=2 tid=0x0000000018d55800 nid=0xaec waiting on condition 

JNI global references: 288

FinalizerとReference HandlerのオブジェクトIDが同じなのはそんなものらしい。

Springのエラー

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'reservationForm' available as request attribute
 at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:144) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
 at org.thymeleaf.spring4.util.FieldUtils.getBindStatusFromParsedExpression(FieldUtils.java:401) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
 at org.thymeleaf.spring4.util.FieldUtils.getBindStatus(FieldUtils.java:328) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
 at org.thymeleaf.spring4.util.FieldUtils.getBindStatus(FieldUtils.java:294) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
 
Spring徹底入門の写経をしていたら上記のエラー。
reservationFormがAttributeとしてバインドできないといっているっぽい。

見直すとコントローラーでの@ModelAttributeの設定漏れ。


Dockerサポート外

会社用メインサーバは秘伝のたれが詰まったCentOS6でミドルも都度都度足していったもので構成よくわからなくなっている。取りあえず、よく使うやつらだけでもDockerに切り出しておこうかと思ったらCentOS6系はもうサポート対象外なのね。昔からあるサーバは特にいじっていなかったから知らなかった。

このまま使い続けるのもより、いっそのこと今OSもCentOS7にあげてしまった方がいいかな。Docker用OSも考えたけど、何かあったときにミドルをコンテナでなくホストに慌ててインストールとか時間かかりそうなので、メインサーバは無難にCentOSにしとく。