2013年10月30日水曜日

Linux上でH2 Databaseが起動しない

概要

Linux上でH2 Databaseが起動しない
理由はホスト名が/etc/hostsに記述されていないためエラーが発生

詳細

実行

/h2-1.3.173.jar org.h2.tools.Server

エラー内容

Exception in thread "main" org.h2.jdbc.JdbcSQLException: 入出力例外: "java.net.UnknownHostException:
 XXXXXXX.local: XXXXXXX.local: 名前またはサービスが不明です"
IO Exception: "java.net.UnknownHostException: XXXXXXX.local: XXXXXXX.local: 名前またはサービスが不明です" [90028-173]
 at org.h2.message.DbException.getJdbcSQLException(DbException.java:331)
 at org.h2.message.DbException.get(DbException.java:160)
 at org.h2.message.DbException.convert(DbException.java:275)
 at org.h2.util.NetUtils.getLocalAddress(NetUtils.java:263)
 at org.h2.server.web.WebServer.updateURL(WebServer.java:328)
 at org.h2.server.web.WebServer.init(WebServer.java:317)
 at org.h2.tools.Server.<init>(Server.java:51)
 at org.h2.tools.Server.createWebServer(Server.java:413)
 at org.h2.tools.Server.runTool(Server.java:306)
 at org.h2.tools.Server.main(Server.java:117)
Caused by: java.net.UnknownHostException: XXXXXXX.local: XXXXXXX.local: 名前またはサービスが不明です
 at java.net.InetAddress.getLocalHost(InetAddress.java:1466)
 at org.h2.util.NetUtils.getLocalAddress(NetUtils.java:261)
 ... 6 more
Caused by: java.net.UnknownHostException: XXXXXXX.local: 名前またはサービスが不明です
 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
 at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:894)
 at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1286)
 at java.net.InetAddress.getLocalHost(InetAddress.java:1462)
 ... 7 more

解決方法

/etc/hostsに記述することで解決

hostsの確認

$ hostname
XXXXXXX.local
$ cat /etc/hosts
127.0.0.1 localhost

hostsの修正

$ vi /etc/hosts
127.0.0.1  XXXXXXX.local localhost

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。