You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Josh Smith (Jira)" <ji...@apache.org> on 2020/11/02 19:24:00 UTC
[jira] [Created] (CAMEL-15793) MethodNotFoundException when calling
method on OSGi service reference in Blueprint
Josh Smith created CAMEL-15793:
----------------------------------
Summary: MethodNotFoundException when calling method on OSGi service reference in Blueprint
Key: CAMEL-15793
URL: https://issues.apache.org/jira/browse/CAMEL-15793
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 3.6.0, 3.4.4, 3.5.0
Reporter: Josh Smith
Camel throws an exception when trying to call a method on an OSGi service reference in Blueprint. For example:
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<reference id="helloWorldServiceRef" interface="com.example.HelloWorldService"/>
<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="simple">
<route>
<from uri="timer:simple?period=5000"/>
<setBody>
<method ref="helloWorldServiceRef" method="greet()"/>
</setBody>
<to uri="log:simplecamel"/>
</route>
</camelContext>
</blueprint>
{code}
Here's the exception thrown:
{code:java}
org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> SetBody[bean[ref:helloWorldServiceRef method:greet()]] <<< in route: Route(route1)[From[timer:simple?period=5000] -> [SetBody[bea... because of Method with name: greet() not found on bean: com.example.HelloWorldServiceImpl@604598c3 of type: Proxy7236e8f2_c140_49c7_a040_ac2eddfcda95
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:384) ~[?:?]
at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:111) ~[?:?]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:431) ~[?:?]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:393) ~[?:?]
at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2606) ~[!/:3.6.0]
at org.apache.camel.support.service.BaseService.init(BaseService.java:83) ~[!/:3.6.0]
at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2378) ~[!/:3.6.0]
at org.apache.camel.support.service.BaseService.start(BaseService.java:111) ~[!/:3.6.0]
at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2395) ~[!/:3.6.0]
at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:241) ~[!/:3.6.0]
at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:283) ~[!/:3.6.0]
at org.apache.camel.blueprint.BlueprintCamelContext.blueprintEvent(BlueprintCamelContext.java:187) [!/:3.6.0]
at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:190) [!/:1.10.2]
at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:188) [!/:1.10.2]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_242]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_242]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_242]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_242]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method with name: greet() not found on bean: com.example.HelloWorldServiceImpl@604598c3 of type: Proxy7236e8f2_c140_49c7_a040_ac2eddfcda95
at org.apache.camel.language.bean.BeanExpression.validateHasMethod(BeanExpression.java:268) ~[?:?]
at org.apache.camel.language.bean.BeanExpression.init(BeanExpression.java:164) ~[?:?]
at org.apache.camel.language.bean.BeanLanguage.createExpression(BeanLanguage.java:173) ~[?:?]
at org.apache.camel.reifier.language.MethodCallExpressionReifier.createExpression(MethodCallExpressionReifier.java:57) ~[?:?]
at org.apache.camel.reifier.language.ExpressionReifier.createExpression(ExpressionReifier.java:135) ~[?:?]
at org.apache.camel.reifier.AbstractReifier.createExpression(AbstractReifier.java:113) ~[?:?]
at org.apache.camel.reifier.SetBodyReifier.createProcessor(SetBodyReifier.java:34) ~[?:?]
at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:752) ~[?:?]
at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:495) ~[?:?]
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:382) ~[?:?]
... 23 more
{code}
This bug was introduced by this change: [https://github.com/apache/camel/commit/47d8ff92de888d923a7f3734080aa5a6d3d5bbcc#diff-d57c2c1fc8e674a5764e3fbe2cdc565dc12ca07541b9d6a2d9345f6c46a3d2e5R97-R107]
The service reference has a class of Proxy7236e8f2_c140_49c7_a040_ac2eddfcda95 (see the stack trace), which is a synthetic class, so the type for the BeanInfo is set to its superclass, which in this case is java.lang.Object.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)