【问题标题】:Wildfly 10 Infinispan JCache: @CacheResult causes "Member of array type or annotation type must be annotated @NonBinding"Wildfly 10 Infinispan JCache:@CacheResult 导致“数组类型或注释类型的成员必须注释 @NonBinding”
【发布时间】:2017-08-02 13:54:56
【问题描述】:

我正在尝试在 Wilfly 10 中使用 Infinispan JCache 注释。我的 Wildfly 安装具有 Wildfly-Camel 扩展 (http://wildfly-extras.github.io/wildfly-camel/)。

我想使用方法级缓存:

@CacheResult
public Connector getConnector(String name) {
   ...
}

我的应用的相关 Maven 依赖项:

<dependencies>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.cache</groupId>
        <artifactId>cache-api</artifactId>
        <version>1.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.infinispan</groupId>
        <artifactId>infinispan-jcache</artifactId>
        <version>8.2.4.Final</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

我的beans.xml

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
    version="1.2" bean-discovery-mode="annotated">
    <interceptors>
        <class>org.infinispan.jcache.annotation.InjectedCacheResultInterceptor</class>
        <class>org.infinispan.jcache.annotation.InjectedCachePutInterceptor</class>
        <class>org.infinispan.jcache.annotation.InjectedCacheRemoveEntryInterceptor</class>
        <class>org.infinispan.jcache.annotation.InjectedCacheRemoveAllInterceptor</class>
        <class>org.infinispan.jcache.annotation.CacheResultInterceptor</class>
        <class>org.infinispan.jcache.annotation.CachePutInterceptor</class>
        <class>org.infinispan.jcache.annotation.CacheRemoveEntryInterceptor</class>
        <class>org.infinispan.jcache.annotation.CacheRemoveAllInterceptor</class>
    </interceptors>
</beans>

但是,在部署应用程序时出现以下错误:

WELD-001121: Member of array type or annotation type must be annotated @NonBinding:  [EnhancedAnnotatedMethodImpl] public abstract javax.cache.annotation.CacheResult.cachedExceptions()

这很奇怪,因为javax.cache.annotation.CacheResult 中的所有方法都用@Nobinding 注释

有什么想法吗?

谢谢!

【问题讨论】:

    标签: java cdi wildfly-10 jcache infinispan-8


    【解决方案1】:
    • 您是否测试过从 beans.xml 中删除 bean-discovery-mode="annotated" 的行为?
    • 您是否已将 cacheName 分配给 @CacheResult 注释?
    • 最好在standalone.xml中启用TRACE调试到“org.infinispan”

    我使用“bean-discovery-mode=all”运行它(如果未在 beans.xml 中指定,则将其作为默认值)并仅指示最后四个拦截器类:org.infinispan .jcache.annotation.Cache*

    希望对您有所帮助,请继续关注。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-05
      • 1970-01-01
      • 2021-12-29
      • 2022-12-15
      • 2020-02-24
      • 2021-09-10
      • 2020-09-29
      • 2010-09-17
      相关资源
      最近更新 更多