在使用ehcache缓存时,报如下错误。
DEBUG [net.sf.ehcache.CacheManager@625732] - Update check failed:
java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.terracotta.org/kit/reflector?pageID=update.properties&kitID=ehcache.default&id=-1062702591&os-name=Windows+7&jvm-name=Java+HotSpot%28TM%29+Client+VM&jvm-version=1.8.0_201&platform=x86&tc-version=2.6.5&tc-product=Ehcache+Core+2.6.5&source=Ehcache+Core&uptime-secs=1&patch=UNKNOWN
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at net.sf.ehcache.util.UpdateChecker.getUpdateProperties(UpdateChecker.java:108)
at net.sf.ehcache.util.UpdateChecker.doCheck(UpdateChecker.java:72)
at net.sf.ehcache.util.UpdateChecker.checkForUpdate(UpdateChecker.java:60)
at net.sf.ehcache.util.UpdateChecker.run(UpdateChecker.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
原因:
每次启动ehcache都会检查更新。
解决方案:
在ehcache.xml配置文件中加入updateCheck=”false”,如下:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">
即可。