[Grails] Can’t insert data

domain.save(flush:true)

When you save doesn’t work
or id or version dose not numberd.

Check errors fields on its domain object.

See the errors fields has the constraints error, you can check also check by hasErrors() method.




[Grails] ERROR ehcache.Cache – Unable to set localhost.

If you got following error when staring Grails application, especially running at linux.

ERROR ehcache.Cache - Unable to set localhost. This prevents creation of a GUID. Cause was: HostName: HostName:

org.h2.message.DbException: 入出力例外: "java.net.UnknownHostException: HostName: HostName: 名前またはサービスが不明です"
IO Exception: "java.net.UnknownHostException: HostName: HostName: 名前またはサービスが不明です" [90028-164]
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convert(DbException.java:273)
at org.h2.util.NetUtils.getLocalAddress(NetUtils.java:263)
at org.h2.server.web.WebServer.updateURL(WebServer.java:324)
at org.h2.server.web.WebServer.init(WebServer.java:314)
at org.h2.server.web.WebServlet.init(WebServlet.java:51)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

Wrote in italic HostName is in your host name.

Error means it can’t resolve HostName. So you need HostName in /etc/hosts where the localhost is written.

Like this.


127.0.0.1 localhost <em>HostName</em>