Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11643

Extensions: registerExtension method has to avoid final in his declaration to work in CDI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.20.0
    • camel-core, examples
    • None
    • Unknown

    Description

      For example in the examples camel-example-cdi-properties we are currently getting an error:

      [INFO] -------------------------------------------------------
      [INFO]  T E S T S
      [INFO] -------------------------------------------------------
      [INFO] Running org.apache.camel.example.cdi.properties.CdiPropertiesTest
      2017-08-07 10:40:08,567 [main           ] INFO  Version                        - WELD-000900: 2.4.4 (Final)
      2017-08-07 10:40:08,726 [main           ] INFO  Bootstrap                      - WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
      2017-08-07 10:40:08,824 [main           ] INFO  Event                          - WELD-000411: Observer method [BackedAnnotatedMethod] private org.apache.camel.cdi.CdiCamelExtension.processAnnotatedType(@Observes ProcessAnnotatedType<?>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
      2017-08-07 10:40:08,828 [main           ] INFO  Event                          - WELD-000411: Observer method [BackedAnnotatedMethod] private org.apache.camel.cdi.CdiCamelExtension.processAnnotatedType(@Observes ProcessAnnotatedType<?>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
      2017-08-07 10:40:08,831 [main           ] INFO  Event                          - WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.deltaspike.core.impl.interceptor.GlobalInterceptorExtension.promoteInterceptors(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
      2017-08-07 10:40:08,839 [main           ] INFO  Event                          - WELD-000411: Observer method [BackedAnnotatedMethod] public org.apache.deltaspike.core.impl.config.ConfigurationExtension.findDynamicConfigurationBeans(@Observes ProcessAnnotatedType<?>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
      2017-08-07 10:40:08,841 [main           ] INFO  Event                          - WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.deltaspike.core.impl.message.MessageBundleExtension.detectInterfaces(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
      2017-08-07 10:40:08,846 [main           ] INFO  Event                          - WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension.vetoBeans(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
      2017-08-07 10:40:09,090 [main           ] WARN  Validator                      - WELD-001478: Interceptor class org.apache.deltaspike.core.impl.throttling.ThrottledInterceptor is enabled for the application and for the bean archive /home/oscerd/.m2/repository/org/apache/deltaspike/core/deltaspike-core-impl/1.8.0/deltaspike-core-impl-1.8.0.jar. It will only be invoked in the @Priority part of the chain.
      2017-08-07 10:40:09,091 [main           ] WARN  Validator                      - WELD-001478: Interceptor class org.apache.deltaspike.core.impl.lock.LockedInterceptor is enabled for the application and for the bean archive /home/oscerd/.m2/repository/org/apache/deltaspike/core/deltaspike-core-impl/1.8.0/deltaspike-core-impl-1.8.0.jar. It will only be invoked in the @Priority part of the chain.
      2017-08-07 10:40:09,091 [main           ] WARN  Validator                      - WELD-001478: Interceptor class org.apache.deltaspike.core.impl.future.FutureableInterceptor is enabled for the application and for the bean archive /home/oscerd/.m2/repository/org/apache/deltaspike/core/deltaspike-core-impl/1.8.0/deltaspike-core-impl-1.8.0.jar. It will only be invoked in the @Priority part of the chain.
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.14 s <<< FAILURE! - in org.apache.camel.example.cdi.properties.CdiPropertiesTest
      [ERROR] org.apache.camel.example.cdi.properties.CdiPropertiesTest  Time elapsed: 1.14 s  <<< ERROR!
      org.jboss.weld.exceptions.DeploymentException: 
      Exception List with 1 exceptions:
      Exception 0 :
      javax.enterprise.inject.InjectionException: Error adding routes of type [org.apache.camel.example.cdi.properties.Application$HelloRoute] to Camel context [hello]
      	at org.apache.camel.cdi.CdiCamelExtension.addRouteToContext(CdiCamelExtension.java:456)
      	at org.apache.camel.cdi.CdiCamelExtension.afterDeploymentValidation(CdiCamelExtension.java:399)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
      	at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:144)
      	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:299)
      	at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:124)
      	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:277)
      	at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:255)
      	at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:269)
      	at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:258)
      	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:154)
      	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:148)
      	at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
      	at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
      	at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
      	at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:487)
      	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
      	at org.jboss.weld.environment.se.Weld.initialize(Weld.java:787)
      	at org.apache.camel.test.cdi.CamelCdiDeployment$1.evaluate(CamelCdiDeployment.java:71)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
      	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)
      Caused by: org.apache.camel.RuntimeCamelException: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001480: Bean type class org.apache.camel.component.properties.PropertiesComponent is not proxyable because it contains a final method protected final void org.apache.camel.impl.DefaultComponent.registerExtension(org.apache.camel.component.extension.ComponentExtension) - <unknown javax.enterprise.inject.spi.Bean instance>.
      	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1828)
      	at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByName(PropertyPlaceholderDelegateRegistry.java:52)
      	at org.apache.camel.util.CamelContextHelper.lookupPropertiesComponent(CamelContextHelper.java:683)
      	at org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:2532)
      	at org.apache.camel.model.ProcessorDefinitionHelper.resolvePropertyPlaceholders(ProcessorDefinitionHelper.java:735)
      	at org.apache.camel.model.RouteDefinitionHelper.initRouteInputs(RouteDefinitionHelper.java:378)
      	at org.apache.camel.model.RouteDefinitionHelper.prepareRouteImp(RouteDefinitionHelper.java:298)
      	at org.apache.camel.model.RouteDefinitionHelper.prepareRoute(RouteDefinitionHelper.java:270)
      	at org.apache.camel.model.RoutesDefinition.route(RoutesDefinition.java:205)
      	at org.apache.camel.model.RoutesDefinition.from(RoutesDefinition.java:158)
      	at org.apache.camel.builder.RouteBuilder.from(RouteBuilder.java:169)
      	at org.apache.camel.example.cdi.properties.Application$HelloRoute.configure(Application.java:45)
      	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:462)
      	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:402)
      	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:383)
      	at org.apache.camel.impl.DefaultCamelContext$1.call(DefaultCamelContext.java:1014)
      	at org.apache.camel.impl.DefaultCamelContext$1.call(DefaultCamelContext.java:1011)
      	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3235)
      	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:1011)
      	at org.apache.camel.impl.DefaultCamelContext$Proxy$_$$_WeldClientProxy.addRoutes(Unknown Source)
      	at org.apache.camel.cdi.CdiCamelExtension.addRouteToContext(CdiCamelExtension.java:443)
      	... 31 more
      Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001480: Bean type class org.apache.camel.component.properties.PropertiesComponent is not proxyable because it contains a final method protected final void org.apache.camel.impl.DefaultComponent.registerExtension(org.apache.camel.component.extension.ComponentExtension) - <unknown javax.enterprise.inject.spi.Bean instance>.
      	at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:222)
      	at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:179)
      	at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:141)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:239)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:779)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:808)
      	at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61)
      	at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:85)
      	at org.apache.camel.cdi.BeanManagerHelper.getReference(BeanManagerHelper.java:53)
      	at org.apache.camel.cdi.CdiCamelRegistry.lambda$findByTypeWithName$63(CdiCamelRegistry.java:78)
      	at java.util.stream.Collectors.lambda$toMap$214(Collectors.java:1321)
      	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
      	at java.util.Iterator.forEachRemaining(Iterator.java:116)
      	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at org.apache.camel.cdi.CdiCamelRegistry.findByTypeWithName(CdiCamelRegistry.java:78)
      	at org.apache.camel.cdi.CdiCamelRegistry.lookupByName(CdiCamelRegistry.java:58)
      	at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByName(PropertyPlaceholderDelegateRegistry.java:50)
      	... 50 more
      
      
      [INFO] 
      [INFO] Results:
      [INFO] 
      [ERROR] Errors: 
      [ERROR]   CdiPropertiesTest.org.apache.camel.example.cdi.properties.CdiPropertiesTest ยป Deployment
      [INFO] 
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
      [INFO] 
      

      Attachments

        Activity

          People

            lb Luca Burgazzoli
            acosentino Andrea Cosentino
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: