09

resin.propertiesの残像に惑わされる

e-Builder からresinを起動してhttp://localhost:8080/imart/loginをたたくと以下のような例外。

net.sf.ehcache.config.InvalidConfigurationException: There is one error in your configuration: 
    * CacheManager configuration: You've assigned more memory to the on-heap than the VM can sustain, please adjust your -Xmx setting accordingly


    at net.sf.ehcache.config.CacheConfiguration.setupFor(CacheConfiguration.java:1555) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1277) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1329) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:750) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.doInit(CacheManager.java:451) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.init(CacheManager.java:374) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:259) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:1029) ~[ehcache-core-2.6.0.jar:na]
    at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:1005) ~[ehcache-core-2.6.0.jar:na]
    at jp.co.intra_mart.system.cache.ehcache.EhcacheManagerProvider.getCacheManager(EhcacheManagerProvider.java:58) ~[im_cache_impl-8.0.12-main.jar:na]
    at jp.co.intra_mart.foundation.cache.CacheManagerFactory.getCacheManager(CacheManagerFactory.java:96) ~[im_cache_base-8.0.12-main.jar:na]
    at jp.co.intra_mart.foundation.cache.CacheManagerFactory.getCacheManager(CacheManagerFactory.java:62) ~[im_cache_base-8.0.12-main.jar:na]
    at jp.co.intra_mart.foundation.authz.services.admin.impl.dao.ImazSubjectDAO.getCache(ImazSubjectDAO.java:173) ~[im_authz_impl-8.0.13-main.jar:na]
    at jp.co.intra_mart.foundation.authz.services.admin.impl.dao.ImazSubjectDAO.find(ImazSubjectDAO.java:66) ~[im_authz_impl-8.0.13-main.jar:na]
    at jp.co.intra_mart.foundation.authz.services.admin.impl.InHouseSubjectManager.mergeSubject(InHouseSubjectManager.java:1135) ~[im_authz_impl-8.0.13-main.jar:na]
    at jp.co.intra_mart.foundation.authz.services.admin.impl.InHouseSubjectManager.registerSubject(InHouseSubjectManager.java:1176) ~[im_authz_impl-8.0.13-main.jar:na]
    at jp.co.intra_mart.foundation.authz.services.admin.impl.InHouseSubjectManager.registerAsSubject(InHouseSubjectManager.java:650) ~[im_authz_impl-8.0.13-main.jar:na]
    at jp.co.intra_mart.foundation.authz.services.admin.impl.InHouseSubjectManager.registerAsSubject(InHouseSubjectManager.java:89) ~[im_authz_impl-8.0.13-main.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]

... あまりにも長いので省略 ...

どうやらメッセージを読む限りメモリが足りないってことらしいのだけど、もともと普通にコンソールから起動した使っていたインスタンスで、その時は問題なく使えていた。その後e-Builder側でデバッグサーバとして設定したんだけど、e-Builderから起動すると、起動時は問題ないんだけどブラウザからアクセスしたときに上記スタックトレースが流れて、画面も壊れた表示になる。

起動方法を変えたとはいえ、別にアプリケーションの構成変えたりはしていない。

普通メモリの設定は${resin.home}/conf/resin.propertiesにコメントアウトで記載されている

# Arg passed directly to the JVM
# jvm_args  : -Xmx2048m -XX:MaxPermSize=512m

このあたりを有効にして大きくしてやればいいんだけど、e-Builderからデバッグサーバを設定するとワークスペースにServerってプロジェクトができて、サーバ構成毎のフォルダが作られ、その下にもresin.properties が作成される。なのでつまりこれを直してやればよい。・・・かというとそうでもなくて、e-Builder のサーバペインで構成済みのサーバをダブルクリックすると、コードペインでサーバ構成の内容が表示されるんだけど、その中にある「起動構成を開く」というリンクをクリックすると何やらresin起動時に指定していると思われるオプションをみることができる。

設定の仕方がまずいのか何なのか、ここでresinの引数に-Xmx512mなんて書かれていたのでメモリが足りなくなってて上記のエラーになる、ということみたい。