Hi Liav, Have you add the code in the configure() method. The reason for this issue can be one of two things - The Camel listener has not been setup. This means the code is called before context.start() - The dependencies cannot be resolved (i.e the jar containing org/apache/camel/spi/InterceptStrategy) is not on your build path.
FUSE 3.3 has the same codebase as Servicemix and if you maven build the camel-core and link it in your POM, it should work. Cheers, Ashwin... Liav Ezer wrote: > > Hi Ashwin, > > My processor works great - if i remove the > getContext().addInterceptStrategy(new MyFromEndpointInterceptor()); line > everything is smooth. > > Can you think of a reason why i get this exception? > > framework.beans.factory.BeanCreationException: Error creating bean with > name 'camelContext': Invocation of init method failed; > apache.camel.CamelContext.addInterceptStrategy(Lorg/apache/camel/spi/InterceptStrategy;) > > Every other Camel component (such as processor or producerTemplate) was > fine untill i added the addInterceptStrategy API. > (By the way, getContext() alone isn't crushing..) > > Maybe it's related to the fact i use esb-fuse-3.3.1.3 & not pure > servicemix? (in regards to camel-core jar?!) > > This is my camel-context file: > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd > http://activemq.apache.org/camel/schema/spring > http://activemq.apache.org/camel/schema/spring/camel-spring.xsd"> > <camelContext useJmx="true" > xmlns="http://activemq.apache.org/camel/schema/spring"> > <package>com.liav.oxp.esb.poc</package> > </camelContext> > </beans> > > Thanks. > > Ashwin Karpe wrote: >> >> Hi Liav, >> >> Have you checked the packages in the camel context block of the >> camel-context.xml in the resources directory to see if the Camel >> processor have been correctly defined. >> >> Cheers, >> >> Ashwin... >> >> >> Liav Ezer wrote: >>> >>> Hi, >>> >>> I use servicemix-fuse 3.3.1.3 with Camel 1.4. >>> In my Camel Builder i try to add interceptor & it's causing me an >>> NoSuchMethodError. >>> >>> My configure method is: >>> >>> public void configure() throws Exception { >>> >>> getContext().addInterceptStrategy(new >>> MyFromEndpointInterceptor()); >>> from("jbi:service:http://oxp/oXpInternalService") >>> .process(new OXpServicesAuthenticationProcessor()); >>> } >>> >>> This is the context i use (i println it) >>> org.apache.camel.spring.SpringCamelContext >>> >>> My exception is at deploy time: >>> >>> org.springframework.beans.factory.BeanCreationException: Error creating >>> bean with name 'camel:beanPostProcessor': Cannot resolve reference to >>> bean 'camel' while setting bean property 'camelContext'; nested >>> exception is org.springframework.beans.factory.BeanCreationException: >>> Error creating bean with name ' >>> camel': Invocation of init method failed; nested exception is >>> java.lang.NoSuchMethodError: >>> org.apache.camel.CamelContext.addInterceptStrategy(Lorg/apache/camel/spi/InterceptStrategy;) >>> >>> >>> Thanks in advance, >>> Liav. >>> >>> >> >> > > ----- --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) ---- Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://www.nabble.com/Why-getContext%28%29.addInterceptStrategy-is-throwing-an-exception--tp21551665s22882p21577945.html Sent from the Camel - Users mailing list archive at Nabble.com.
