My Oracle Support Banner

@stereotype NOT CHECKED FOR @interceptorbinding ANNOTATIONS FOR EJBs (Doc ID 1642965.1)

Last updated on APRIL 26, 2018

Applies to:

Oracle WebLogic Server - Version 12.1.1.0 and later
Information in this document applies to any platform.

Symptoms

with patch 17754427, 17489143 and 17577626, we are seeing the following issue:

A @Test annotation is defined here:

package com.test.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.interceptor.InterceptorBinding;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@InterceptorBinding
@Inherited
@Target({ TYPE, METHOD })
@Retention(RUNTIME)
@Documented
public @interface Test {

}

the @Test annotation is added to a Stereotype annotation:

package com.test.annotation;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.inject.Stereotype;

@Stereotype
@Test
@Target({ TYPE })
@Retention(RUNTIME)
@Documented
public @interface Service {

}

an EJB is annotated with the Stereotype @Service:

package com.test.bean;

import javax.ejb.Local;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Inject;

import com.test.annotation.Service;
import com.test.annotation.Test;

@Service
@Stateless
@Local(Test2EJBService.class)
@LocalBean
public class Test2EJBServiceImpl implements Test2EJBService {

public Test2EJBServiceImpl() {
}

public void doSomething() {
System.out
.println("Test2EJBServiceBean.doSomething() invoked");
}

}

beans.xml has the interceptors defined: 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd">
<interceptors>
<class>com.test.interceptor.TestUtilInterceptor</class>
</interceptors>
</beans>

Here's the interceptor class:

package com.test.interceptor;

import javax.inject.Inject;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;

import com.test.annotation.Test;

@Test
@Interceptor
public class TestUtilInterceptor {

@Inject
private TestUtil testUtil;

public TestUtilInterceptor() {
// TODO Auto-generated constructor stub
}

@AroundInvoke
public Object aroundInvoke(InvocationContext ic) throws Exception {
System.out.println("\tTestUtilInterceptor intercepted: " + ic.getMethod().toGenericString());
return ic.proceed();
}

}

it's observed that the interceptor isn't called at all on the ejb.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.