LoginSignup
0
0

More than 5 years have passed since last update.

EHCache + PlayのdevでClassNotFoundExceptionが出るときの解決方法

Last updated at Posted at 2016-09-07

前はこの記事の方法で解決していたのだが、今は解決できなくなったので参考程度にどうぞ。

概要

EHCacheをPlayで使っていると、dev-modeでreloadが掛かったときにClassNotFoundExceptionが出るという問題がある。

原因

Playの特殊なClassLoaderの使い方にある。

が詳しい。

解決方法

Cache生成時に使用するClassLoaderが渡せる。

val conf = new CacheConfiguration(cacheName, maxEntries)
  .setClassLoader(env.classLoader)
val cache = new Cache(conf)

渡すClassLoaderはplay.api.EnvironmentをDIから持ってきてclassLoaderを呼べばいい。

0
0
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
0
0