You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by eswar <ea...@gmail.com> on 2014/02/28 17:11:47 UTC

Bean MethodNotFound Exception though it looks correct

hi - this looks obvious but I am not sure if Camel has any restrictions in
using the bean which is defined with parent and as singleton. I m using
Camel 2.12.2 and this works all fine if I use a simple class(without any
superclass) with a method in it.

Also I do have AOP's defined on certain methods inside this bean, but I am
creating a seperate method in the class to use in Camel route.

Below exception is what I get when I use a method from such a bean, any
suggestion would be really helpful. thanks.

Camel Context - 

<camelContext id="camelRoute" xmlns="http://camel.apache.org/schema/spring">		
	<routeContextRef ref="Route1"/>
	<interceptFrom>
	<log message="INTERCEPTOR #######." />
		<bean ref="testBean" method="camel1" />
	</interceptFrom>
</camelContext>

Bean Definition -

<bean id="testBean" class="com.test.project" parent="projectImpl"
scope="singleton">
	<property name="prop1">
		<ref bean="prop1"/>
	</property>
	<property name="prop2">
		<ref bean="prop2"/>
	</property>
</bean>	

Class - 

public class project extends projectImpl implements 
inteface1, interface2, interface3 {

	public synchronized void camel1(Exchange ex) {
		System.out.println("test ... ");
	}
	
}

Exception - 

Caused by: org.apache.camel.RuntimeCamelException:
org.apache.camel.component.bean.MethodNotFoundException: Method with name:
camel1 not found on bean: com.test.project@14363d8 of type:
com.sun.proxy.$Proxy52
        at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1352)
        at
org.apache.camel.model.BeanDefinition.createProcessor(BeanDefinition.java:270)
        at
org.apache.camel.model.ProcessorDefinition.createProcessor(ProcessorDefinition.java:460)
        at
org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:429)
        at
org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:159)
        at
org.apache.camel.model.ProcessorDefinition.createChildProcessor(ProcessorDefinition.java:178)
        at
org.apache.camel.model.InterceptFromDefinition.createProcessor(InterceptFromDefinition.java:92)
        at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:500)
        at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:909)
        ... 32 more
Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method
with name: camel1 not found on bean: com.test.project@14363d8 of type:
com.sun.proxy.$Proxy52





--
View this message in context: http://camel.465427.n5.nabble.com/Bean-MethodNotFound-Exception-though-it-looks-correct-tp5748110.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bean MethodNotFound Exception though it looks correct

Posted by eswar <ea...@gmail.com>.
hi Ceposta- Yes I have defined this method camel1 in interface1 and then
implemented in the class - project. hence i was thinking the testBean should
be able to access the camel1 method as defined in the interface. But i am
still getting this error, any insight you can offer would be helpful. thank
you again.



--
View this message in context: http://camel.465427.n5.nabble.com/Bean-MethodNotFound-Exception-though-it-looks-correct-tp5748110p5748166.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bean MethodNotFound Exception though it looks correct

Posted by Christian Posta <ch...@gmail.com>.
the names accessible are probably those seen in the interfaces and not
concrete classes as spring is using dynamic proxies for you

On Fri, Feb 28, 2014 at 9:11 AM, eswar <ea...@gmail.com> wrote:
> hi - this looks obvious but I am not sure if Camel has any restrictions in
> using the bean which is defined with parent and as singleton. I m using
> Camel 2.12.2 and this works all fine if I use a simple class(without any
> superclass) with a method in it.
>
> Also I do have AOP's defined on certain methods inside this bean, but I am
> creating a seperate method in the class to use in Camel route.
>
> Below exception is what I get when I use a method from such a bean, any
> suggestion would be really helpful. thanks.
>
> Camel Context -
>
> <camelContext id="camelRoute" xmlns="http://camel.apache.org/schema/spring">
>         <routeContextRef ref="Route1"/>
>         <interceptFrom>
>         <log message="INTERCEPTOR #######." />
>                 <bean ref="testBean" method="camel1" />
>         </interceptFrom>
> </camelContext>
>
> Bean Definition -
>
> <bean id="testBean" class="com.test.project" parent="projectImpl"
> scope="singleton">
>         <property name="prop1">
>                 <ref bean="prop1"/>
>         </property>
>         <property name="prop2">
>                 <ref bean="prop2"/>
>         </property>
> </bean>
>
> Class -
>
> public class project extends projectImpl implements
> inteface1, interface2, interface3 {
>
>         public synchronized void camel1(Exchange ex) {
>                 System.out.println("test ... ");
>         }
>
> }
>
> Exception -
>
> Caused by: org.apache.camel.RuntimeCamelException:
> org.apache.camel.component.bean.MethodNotFoundException: Method with name:
> camel1 not found on bean: com.test.project@14363d8 of type:
> com.sun.proxy.$Proxy52
>         at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1352)
>         at
> org.apache.camel.model.BeanDefinition.createProcessor(BeanDefinition.java:270)
>         at
> org.apache.camel.model.ProcessorDefinition.createProcessor(ProcessorDefinition.java:460)
>         at
> org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:429)
>         at
> org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:159)
>         at
> org.apache.camel.model.ProcessorDefinition.createChildProcessor(ProcessorDefinition.java:178)
>         at
> org.apache.camel.model.InterceptFromDefinition.createProcessor(InterceptFromDefinition.java:92)
>         at
> org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:500)
>         at
> org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:909)
>         ... 32 more
> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method
> with name: camel1 not found on bean: com.test.project@14363d8 of type:
> com.sun.proxy.$Proxy52
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bean-MethodNotFound-Exception-though-it-looks-correct-tp5748110.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Re: Bean MethodNotFound Exception though it looks correct

Posted by eswar <ea...@gmail.com>.
sorry, never mind I was using a wrong signature which I fixed and its working
now.



--
View this message in context: http://camel.465427.n5.nabble.com/Bean-MethodNotFound-Exception-though-it-looks-correct-tp5748110p5748171.html
Sent from the Camel - Users mailing list archive at Nabble.com.