You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "tim08 (via GitHub)" <gi...@apache.org> on 2025/09/02 06:00:06 UTC
Re: [I] osgi - Bean method invocations where the bean is a proxy for an Interface & the method has no arguments fail with AmbiguousMethodCallException [camel-karaf]
tim08 commented on issue #565:
URL: https://github.com/apache/camel-karaf/issues/565#issuecomment-3243884801
@essobedo to reproduce the problem:
bundle 1
```
package my.test;
public interface MyService {
String myMethod();
}
```
```
package my.test;
public class MyServiceImpl implements MyService{
@Override
public String myMethod() {
return "test1";
}
}
```
in blueprint
```
<bean class="my.test.MyServiceImpl" id="myServiceImpl"/>
<service ref="myServiceImpl" interface="my.test.MyService"/>
```
bundle 2
in blueprint
```
<reference id="myService"
interface="my.test.MyService"
timeout="30000" availability="mandatory"/>
<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="mytest">
<route>
<from uri="timer://letsgo?repeatCount=1"/>
<to uri="bean:myService?method=myMethod" />
<to uri="log:test" />
</route>
</camelContext>
```
@paul-mcculloch I was able to partially solve the problem using
`<to uri="bean:my.test.MyService?method=myMethod" />`
or if you need to set some header
```
<setHeader name="myCustomHeader">
<method method="myMethod()" beanType="my.test.MyService"/>
</setHeader>
```
but sometimes I get a class missing error, I think it depends on the order of loading bundles (maybe as a fix use different start-level), or using lazyStartProducer https://camel.apache.org/components/4.10.x/bean-component.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org