jsr107 / RI

Reference Implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CDI interceptors fail in Weblogic

pdjohe opened this issue · comments

The CDI interceptors do not follow the CDI spec:

(section 2.5 of Interceptor Specs)

Lifecycle callback interceptor methods defined on an interceptor class must have one of the following signatures:

void (InvocationContext)
Object (InvocationContext) throws Exception

The CDI adaptors (for example org.jsr107.ri.annotations.cdi.CacheRemoveAllInterceptor) have this signature instead:

@AroundInvoke
public Object cacheRemoveAll(InvocationContext invocationContext) throws Throwable

Please change 'Throwable' to 'Exception' so that this weblogic error does not come anymore:

[ERROR] weblogic.ejb.container.compliance.ComplianceException: AroundInvoke method cacheRemoveAll in class org.jsr107.ri.annotations.cdi.CacheRemoveAllInterceptor must have the signature: 'Object <METHOD(InvocationContext)> throws Exception'
[ERROR] at weblogic.ejb.container.compliance.BusinessMethodInterceptorChecker.validateAroundInvokeOrTimeoutMethod(BusinessMethodInterceptorChecker.java:154)
[ERROR] at weblogic.ejb.container.compliance.BusinessMethodInterceptorChecker.checkAroundInvokeOrTimeoutMethods(BusinessMethodInterceptorChecker.java:70)
[ERROR] at weblogic.ejb.container.compliance.InterceptorChecker.checkAroundInvokeMethods(InterceptorChecker.java:61)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:497)
[ERROR] at weblogic.ejb.container.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:100)

Affects both Weblogic 12.1.3 and 12.2.1.

Any news on this? The reference implementation really should be adherent to the JavaEE spec.

I have two different commits that I can submit as pull requests if desired. The one is only in the CDI module where the Throwable is caught and changed to an Exception. The other pull request uses generic to get the signatures correct for spring/guice (Throwable) and cdi (Exception).

Please advise if I should submit either as a pull request.

I have verified that both of the two fixes will work with Weblogic.

Can you please submit the pull request.

Hi! Two pull requests have been submitted. Both fix the problem. Choose the one you like best and revoke the other.

Hello.

Any expectations for when these pull requests are going to be handled?

Thanks.

@mmaica I'm looking into these today

I think #52 looks good. I tested the fix with Weld, when using 1.0.0 release it logs:
WARN org.jboss.weld.Reflection - WELD-001450 Interceptor method public java.lang.Object org.jsr107.ri.annotations.cdi.CacheResultInterceptor.cacheResult(javax.interceptor.InvocationContext) throws java.lang.Throwable does not declare that it throws Exception.
This warning is gone with the fix applied in 1.1.0-SNAPSHOT.

@pdjohe thanks for creating the PRs. Do you have a signed Oracle Contributor Agreement? I think this is a prerequisite in order to merge your PRs in the repository.

I have now emailed the Oracle Contributor Agreement to Oracle.

@pdjohe:

We discussed that issue internally. However, nobody on the Spec team can really verify your change. Further more its unclear why this part of the RI is actually used and relevant in some production environment as you use it. Maybe you can say something about that?

I have now emailed the Oracle Contributor Agreement to Oracle.

Can you please state your full name and maybe company under which you are doing the contribution?

This guy is Paul David Johe and he has is on the Oracle Contributor List. http://www.oracle.com/technetwork/community/oca-486395.html#j

Fixed with PR #53