[jboss-jira] [JBoss JIRA] (WFLY-6501) EJB with AroundConstruct interceptor with Object return type fails to deploy

Dmitrii Tikhomirov (JIRA) issues at jboss.org
Tue Apr 19 11:16:00 EDT 2016


    [ https://issues.jboss.org/browse/WFLY-6501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13193879#comment-13193879 ] 

Dmitrii Tikhomirov commented on WFLY-6501:
------------------------------------------

According to specs, @AroundConstruct must support two kinds of methods:

 @AroundConstruct
 public void <METHOD>(InvocationContext ctx) { ... }
 
 @AroundConstruct
 public Object <METHOD>(InvocationContext ctx) throws Exception { ... }

but for some reason, wildfly works only with the first one. That fix makes both of them acceptable. I am not sure about Class names in the test (AroundConstructWithReturnSLSB and AroundConstructInterceptorWithReturn ), maybe someone has better ideas ?  


> EJB with AroundConstruct interceptor with Object return type fails to deploy
> ----------------------------------------------------------------------------
>
>                 Key: WFLY-6501
>                 URL: https://issues.jboss.org/browse/WFLY-6501
>             Project: WildFly
>          Issue Type: Bug
>          Components: EE, EJB
>    Affects Versions: 10.0.0.Final
>            Reporter: Tomas Remes
>            Assignee: Dmitrii Tikhomirov
>         Attachments: myintercepter.tar.gz
>
>
> Having:
> {code}
> @Stateless
> @Interceptors(AroundConstructInterceptor.class)
> public class AroundConstructSLSB {
> ...
> }
> {code}
> and 
> {code}
> public class AroundConstructInterceptor {
>     public static volatile boolean intercepted = false;
>     @AroundConstruct
>     private Object aroundConstruct(InvocationContext ctx) throws Exception {
>         intercepted = true;
>         return ctx.proceed();
>     }
> }
> {code}
> fails with following exception:
> {noformat}
> 08:18:55,464 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."bcc899ab-39cf-44dc-a2ba-e364d53091cc.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."bcc899ab-39cf-44dc-a2ba-e364d53091cc.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "bcc899ab-39cf-44dc-a2ba-e364d53091cc.war"
> 	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
> 	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
> 	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0024: Could not configure component AroundConstructSLSB
> 	at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:96)
> 	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
> 	... 5 more
> Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0175: No method found with id: Method aroundConstruct(javax.interceptor.InvocationContext) on class (or its super class) class org.jboss.as.test.integration.ejb.interceptor.aroundconstruct.returnObject.AroundConstructInterceptor
> 	at org.jboss.as.server.deployment.reflect.ClassReflectionIndexUtil.findRequiredMethod(ClassReflectionIndexUtil.java:79)
> 	at org.jboss.as.ee.component.DefaultInterceptorConfigurator$1.handleInterceptorClass(DefaultInterceptorConfigurator.java:177)
> 	at org.jboss.as.ee.component.DefaultInterceptorConfigurator$1.handle(DefaultInterceptorConfigurator.java:158)
> 	at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
> 	at org.jboss.as.ee.component.DefaultInterceptorConfigurator.configure(DefaultInterceptorConfigurator.java:188)
> 	at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:82)
> 	... 6 more
> {noformat}
> I cannot see any statement in Interceptor spec forbidding this. Testcase is available at https://github.com/tremes/wildfly/tree/intercept_ejb. I think the problem is class description having this method return type as void. I guess it occurs at first at https://github.com/wildfly/wildfly/blob/master/ee/src/main/java/org/jboss/as/ee/component/ClassDescriptionTraversal.java#L46 



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list