Hi Are you sure the classpath is clean no double jars or what else?
I assume you are no using OSGi whereas the packages needs to be exported. But they should be in the camel 1.4 .jar Could you check which object the getContext() returns? System.out.println(getContext()): System.out.println(getContext().getClass().getName()): I am wondering what it is? On Thu, Jan 15, 2009 at 2:12 PM, Liav Ezer <liav.e...@gmail.com> wrote: > > Hi Claus, > > I do have a problem with this method (addInterceptStrategy) in deployment > time of the camel SA: > > I think i have to register the interceptor as a spring bean in the context > file - do i need? > > 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;)stack-trace><![CDATA[org.apache.xbean.kernel.ServiceRegistrationException: > 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. > > Claus Ibsen-2 wrote: >> >> Hi >> >> Are you still having problem with it? >> >> The method is in CamelContext interface >> >> /** >> * Adds the given interceptor strategy >> * >> * @param interceptStrategy the strategy >> */ >> void addInterceptStrategy(InterceptStrategy interceptStrategy); >> >> >> >> On Thu, Jan 15, 2009 at 1:57 PM, Liav Ezer <liav.e...@gmail.com> wrote: >>> >>> Hi Willem, >>> >>> My versions are: >>> >>> Camel:Camel 1.4 >>> SMX:fuse-esb-3.3.1.3 >>> >>> Thanks. >>> >>> willem.jiang wrote: >>>> >>>> Which version of Camel and ServiceMix are you using ? >>>> >>>> Willem >>>> >>>> On Thu, Jan 15, 2009 at 5:10 PM, Liav Ezer <liav.e...@gmail.com> wrote: >>>> >>>>> >>>>> Hi Claus, >>>>> >>>>> I'm having difficulties adjusting your example. >>>>> >>>>> Currently i have an independent class for the builder & for the >>>>> processor >>>>> (not inner class). >>>>> >>>>> This is my builder: >>>>> >>>>> public class OxpRouteBuilder extends RouteBuilder { >>>>> public void configure() throws Exception { >>>>> from("jbi:service:http://oxp/oXpInternalService") >>>>> .process(new OXpServicesAuthenticationProcessor()); >>>>> } >>>>> } >>>>> >>>>> This is my processor: >>>>> >>>>> class OXpServicesAuthenticationProcessor implements Processor{ >>>>> public OXpServicesAuthenticationProcessor() { >>>>> } >>>>> >>>>> public void process(Exchange exchange) throws Exception { >>>>> >>>>> String policyContentRequest = getPolicyContentRequest(exchange); >>>>> if(!userIsAuthenticate( exchange , policyContentRequest)){ >>>>> String errMsg = "<fault>User is not authorized to perform the >>>>> activity!</fault>"; >>>>> exchange.getIn().setBody(errMsg); >>>>> throw new Exception(errMsg ); >>>>> } >>>>> routeMessage(exchange); >>>>> } >>>>> } >>>>> >>>>> This is my camel-context: >>>>> >>>>> <camelContext id="camel" >>>>> xmlns="http://activemq.apache.org/camel/schema/spring"> >>>>> <package>com.liav.oxp.esb.poc</package> >>>>> </camelContext> >>>>> >>>>> My question is: >>>>> >>>>> 1.Can i "wire" up your example to my architecture or should i create a >>>>> different router builder like yours? >>>>> When i added to my builder's configure method the >>>>> "addInterceptStrategy" >>>>> i got >>>>> NoSuchMethodException in deployment. >>>>> 2. If i need to use your architecture, which definition of the >>>>> camel-context >>>>> file should i add to support this interceptor? >>>>> >>>>> Thanks. >>>>> >>>>> >>>>> >>>>> >>>>> Liav Ezer wrote: >>>>> > >>>>> > Oh sorry igot the answer from: >>>>> > >>>>> > >>>>> http://activemq.apache.org/camel/how-do-i-reuse-the-contexttestsupport-class-in-my-unit-tests.html >>>>> > >>>>> > >>>>> > >>>>> > Liav Ezer wrote: >>>>> >> >>>>> >> I don't have the org.apache.camel.ContextTestSupport in my maven >>>>> >> repository. >>>>> >> >>>>> >> Which dependency should i add to the camel SU's pom file? >>>>> >> >>>>> >> Thanks. >>>>> >> >>>>> >> Claus Ibsen-2 wrote: >>>>> >>> >>>>> >>> Hi >>>>> >>> >>>>> >>> I have created an unit test in Camel 1.x that simulates the >>>>> >>> fromEndpointUri using an interceptor instead. >>>>> >>> Its 99% as good :) >>>>> >>> >>>>> >>> Check out: >>>>> >>> >>>>> org.apache.camel.processor.interceptor.SimulateFromEndpointUsingInterceptorTest >>>>> >>> >>>>> >>> That I will commit in a short time. >>>>> >>> >>>>> >>> Then you will be able to get the fromEndpointUri from a Exchange >>>>> >>> property. >>>>> >>> >>>>> >>> >>>>> >>> On Thu, Jan 15, 2009 at 7:34 AM, Liav Ezer <liav.e...@gmail.com> >>>>> wrote: >>>>> >>>> >>>>> >>>> Hi Claus, >>>>> >>>> >>>>> >>>> My use case is: each new service need to have a consumer & a >>>>> provider >>>>> >>>> in my >>>>> >>>> application. >>>>> >>>> >>>>> >>>> Therefore, i need to dynamically build (via producer template) an >>>>> >>>> End-Point >>>>> >>>> & access it. >>>>> >>>> >>>>> >>>> My assumption is that the provider & consumer end-points (BC's) >>>>> will >>>>> >>>> have >>>>> >>>> the same name (prefix), only change will be the postfix >>>>> >>>> (<svcName>Provider >>>>> >>>> vs <svcName>Consumer). >>>>> >>>> >>>>> >>>> If i can gain knowledge on my FromEndPoing at DSL run time, i can >>>>> >>>> dynamically create a provider end-point based on the consumer name >>>>> >>>> (instead >>>>> >>>> of doing it hard coded). >>>>> >>>> >>>>> >>>> Thanks Claus. >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> Claus Ibsen-2 wrote: >>>>> >>>>> >>>>> >>>>> On Wed, Jan 14, 2009 at 6:00 PM, Liav Ezer <liav.e...@gmail.com> >>>>> >>>>> wrote: >>>>> >>>>>> >>>>> >>>>>> Hi, >>>>> >>>>>> >>>>> >>>>>> I have the following problem: >>>>> >>>>>> >>>>> >>>>>> In my Camel DSL routing logic i call a processor which analyzes >>>>> my >>>>> >>>>>> exchange. >>>>> >>>>>> >>>>> >>>>>> When i looked at the Exchange API i saw that i can extract the >>>>> >>>>>> original >>>>> >>>>>> exchane's end-point. >>>>> >>>>>> >>>>> >>>>>> Please refer to: >>>>> >>>>>> >>>>> http://activemq.apache.org/camel/maven/camel-core/apidocs/org/apache/camel/Exchange.html#getFromEndpoint()<http://activemq.apache.org/camel/maven/camel-core/apidocs/org/apache/camel/Exchange.html#getFromEndpoint%28%29> >>>>> >>>>>> >>>>> >>>>>> But this API is new - only in camel-2.0 while SMX works with 1.5 >>>>> at >>>>> >>>>>> most. >>>>> >>>>>> >>>>> >>>>>> My questions are: >>>>> >>>>>> >>>>> >>>>>> 1. Can you advise how to get the camel-core 2.0 version via >>>>> maven? >>>>> >>>>>> >>>>> >>>>>> I tried the following depedency & got this error: >>>>> >>>>>> <dependency> >>>>> >>>>>> <groupId>org.apache.camel</groupId> >>>>> >>>>>> <artifactId>camel-core</artifactId> >>>>> >>>>>> <version>2.0.0</version> >>>>> >>>>>> </dependency> >>>>> >>>>>> Error: >>>>> >>>>>> [INFO] >>>>> >>>>>> >>>>> ------------------------------------------------------------------- >>>>> >>>>>> [ERROR] BUILD ERROR >>>>> >>>>>> [INFO] >>>>> >>>>>> >>>>> ------------------------------------------------------------------- >>>>> >>>>>> [INFO] Failed to resolve artifact. >>>>> >>>>>> >>>>> >>>>>> GroupId: org.apache.camel >>>>> >>>>>> ArtifactId: camel-maven-plugin >>>>> >>>>>> Version: 2.0.0 >>>>> >>>>>> >>>>> >>>>>> Reason: Unable to download the artifact from any repository >>>>> >>>>>> org.apache.camel:camel-maven-plugin:pom:2.0.0 >>>>> >>>>>> >>>>> >>>>>> from the specified remote repositories: >>>>> >>>>>> central (http://repo1.maven.org/maven2), >>>>> >>>>>> apache.snapshots >>>>> >>>>>> (http://people.apache.org/repo/m2-snapshot-repository), >>>>> >>>>>> apache >>>>> (http://people.apache.org/repo/m2-ibiblio-rsync-repository) >>>>> >>>>> See the download page for using SNAPSHOTS >>>>> >>>>> http://activemq.apache.org/camel/download.html >>>>> >>>>> >>>>> >>>>> You need to add a SNAPSHOT maven repo and use 2.0-SNAPSHOT as >>>>> version >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> >>>>> >>>>>> >>>>> >>>>>> 2. Can you please advise how to gain the exchange's 'from' >>>>> end-point >>>>> >>>>>> at >>>>> >>>>>> run >>>>> >>>>>> time in other way beside using this new API? >>>>> >>>>> I dont think it is that easy in 1.x. An interceptor might get you >>>>> >>>>> close (like the tracer) as you can get the node (the model of the >>>>> >>>>> route graph) that started it and then "compute" the from >>>>> endpoint. >>>>> >>>>> >>>>> >>>>> What is your use case since you need the from endpoint? >>>>> >>>>> >>>>> >>>>>> >>>>> >>>>>> Thanks. >>>>> >>>>>> >>>>> >>>>>> -- >>>>> >>>>>> View this message in context: >>>>> >>>>>> >>>>> http://www.nabble.com/Problem-using-camel-2.0-API-in-SMX-tp21460207s22882p21460207.html >>>>> >>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>> >>>>>> >>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> >>>>> >>>>> /Claus Ibsen >>>>> >>>>> Apache Camel Committer >>>>> >>>>> Blog: http://davsclaus.blogspot.com/ >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>>> >>>> -- >>>>> >>>> View this message in context: >>>>> >>>> >>>>> http://www.nabble.com/Problem-using-camel-2.0-API-in-SMX-tp21460207s22882p21472159.html >>>>> >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>> >>>> >>>>> >>>> >>>>> >>> >>>>> >>> >>>>> >>> >>>>> >>> -- >>>>> >>> >>>>> >>> /Claus Ibsen >>>>> >>> Apache Camel Committer >>>>> >>> Blog: http://davsclaus.blogspot.com/ >>>>> >>> >>>>> >>> >>>>> >> >>>>> >> >>>>> > >>>>> > >>>>> >>>>> -- >>>>> View this message in context: >>>>> http://www.nabble.com/Problem-using-camel-2.0-API-in-SMX-tp21460207s22882p21473876.html >>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>> >>>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Problem-using-camel-2.0-API-in-SMX-tp21460207s22882p21477064.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> ------- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> >> > > -- > View this message in context: > http://www.nabble.com/Problem-using-camel-2.0-API-in-SMX-tp21460207s22882p21477349.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- ------- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/