java.lang.annotation.IncompleteAnnotationException: org.terracotta.statistics.Statistic 缺少元素类型
java.lang.annotation.IncompleteAnnotationException: org.terracotta.statistics.Statistic missing element type
我的项目有 hibernate l2 缓存并使用 ehcache 通过此配置管理它
hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
迁移到 Spring 启动 2 后我得到这个异常
Caused by: java.lang.annotation.IncompleteAnnotationException: org.terracotta.statistics.Statistic missing element type
at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:81)
at com.sun.proxy.$Proxy151.type(Unknown Source)
at org.terracotta.statistics.StatisticsManager.parseStatisticAnnotations(StatisticsManager.java:114)
at org.terracotta.context.ContextManager.contextCreated(ContextManager.java:183)
at org.terracotta.context.ContextManager.getOrCreateTreeNode(ContextManager.java:136)
at org.terracotta.context.ContextManager.associate(ContextManager.java:114)
at org.terracotta.context.ContextManager.access[=12=]0(ContextManager.java:38)
at org.terracotta.context.ContextManager.withChild(ContextManager.java:57)
at org.terracotta.statistics.StatisticsManager.createOperationStatistic(StatisticsManager.java:55)
at org.terracotta.statistics.StatisticsManager.createOperationStatistic(StatisticsManager.java:50)
at net.sf.ehcache.statistics.StatisticBuilder$OperationStatisticBuilder.build(StatisticBuilder.java:79)
at net.sf.ehcache.Cache.<init>(Cache.java:268)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:305)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:223)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:783)
at net.sf.ehcache.CacheManager.doInit(CacheManager.java:470)
at net.sf.ehcache.CacheManager.init(CacheManager.java:394)
... 42 common frames omitted
在问了一些问题后我发现 ehcache 2x 和 3 x
在我的项目中有异常原因是,但是当排除 2x 时。请参阅 spring 需要启动 2x。如何解决这个问题
通过替换解决了这个问题:
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
具有以下内容:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
自 SPRING 启动 2.0.2
删除:
spring.jpa.properties.hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
删除:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
使用
解决了问题
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.0.0</version>
</dependency>
我的项目有 hibernate l2 缓存并使用 ehcache 通过此配置管理它
hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
迁移到 Spring 启动 2 后我得到这个异常
Caused by: java.lang.annotation.IncompleteAnnotationException: org.terracotta.statistics.Statistic missing element type
at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:81)
at com.sun.proxy.$Proxy151.type(Unknown Source)
at org.terracotta.statistics.StatisticsManager.parseStatisticAnnotations(StatisticsManager.java:114)
at org.terracotta.context.ContextManager.contextCreated(ContextManager.java:183)
at org.terracotta.context.ContextManager.getOrCreateTreeNode(ContextManager.java:136)
at org.terracotta.context.ContextManager.associate(ContextManager.java:114)
at org.terracotta.context.ContextManager.access[=12=]0(ContextManager.java:38)
at org.terracotta.context.ContextManager.withChild(ContextManager.java:57)
at org.terracotta.statistics.StatisticsManager.createOperationStatistic(StatisticsManager.java:55)
at org.terracotta.statistics.StatisticsManager.createOperationStatistic(StatisticsManager.java:50)
at net.sf.ehcache.statistics.StatisticBuilder$OperationStatisticBuilder.build(StatisticBuilder.java:79)
at net.sf.ehcache.Cache.<init>(Cache.java:268)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:305)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:223)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:783)
at net.sf.ehcache.CacheManager.doInit(CacheManager.java:470)
at net.sf.ehcache.CacheManager.init(CacheManager.java:394)
... 42 common frames omitted
在问了一些问题后我发现 ehcache 2x 和 3 x 在我的项目中有异常原因是,但是当排除 2x 时。请参阅 spring 需要启动 2x。如何解决这个问题
通过替换解决了这个问题:
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
具有以下内容:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
自 SPRING 启动 2.0.2
删除:
spring.jpa.properties.hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
删除:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
使用
解决了问题<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.0.0</version>
</dependency>