CacheResultInterceptor intercepting EJB method on glassfish 4.0.1 b08
cocorossello Jul 10, 2014 6:58 AMI have an application using glassfish 4.0.1 with infinispan. When I moved to b08 (which is using weld 2.2), it does not deploy any more. It works fine if I intercept a CDI bean method, but it breaks if I try to intercept the EJB method.
(I have filed a bug in glassfish fishCAT, I think it's related to glassfish, but it can be a weld thing or inifinispan)
Error:
Grave: Exception while loading the app : CDI deployment failure:Interceptor Class class org.infinispan.jcache.annotation.AbstractCacheResultInterceptor has no method annotated with interface javax.interceptor.AroundInvoke
java.lang.IllegalStateException: Interceptor Class class org.infinispan.jcache.annotation.AbstractCacheResultInterceptor has no method annotated with interface javax.interceptor.AroundInvoke
at org.glassfish.weld.services.EjbServicesImpl.getInterceptorMethod(EjbServicesImpl.java:346)
at org.glassfish.weld.services.EjbServicesImpl.makeInterceptorChain(EjbServicesImpl.java:282)
at org.glassfish.weld.services.EjbServicesImpl.registerInterceptors(EjbServicesImpl.java:223)
at org.jboss.weld.bean.SessionBean.registerInterceptors(SessionBean.java:279)
at org.jboss.weld.bean.SessionBean.initializeAfterBeanDiscovery(SessionBean.java:273)
at org.jboss.weld.bootstrap.BeanDeployer.doAfterBeanDiscovery(BeanDeployer.java:343)
at org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:277)
at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:408)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:222)
SimpleEJB.java
@Stateless
public class SimpleEJB {
@CacheResult(cacheName = "example")
public void aMethod() {
System.out.println("amethod");
}
}
SimpleBean.java
@Named
@RequestScoped
public class SimpleBean {
@EJB
private transient SimpleEJB ejb;
public String getHello() {
ejb.aMethod();;
return "hello";
}
}
beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<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.1" bean-discovery-mode="all" >
<interceptors>
<class>org.infinispan.jcache.annotation.CacheResultInterceptor</class>
</interceptors>
</beans>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>mavenproject1</name>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-jcache</artifactId>
<version>7.0.0.Alpha4</version>
<exclusions>
<exclusion>
<artifactId>cdi-api</artifactId>
<groupId>javax.enterprise</groupId>
</exclusion>
<exclusion>
<artifactId>org.osgi.compendium</artifactId>
<groupId>org.osgi</groupId>
</exclusion>
<exclusion>
<artifactId>org.osgi.core</artifactId>
<groupId>org.osgi</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
Thanks in advance