Hi ,
You can use
SpringCamelContext.springCamelContext(applicationContext);
to create a SpringCamelContext from an applicationContext.
Willem
ee7arh wrote:
>
> Too add a bit more information....
>
> I found the code which throws this error in the camel source base:
>
> public ApplicationContext getApplicationContext() {
> + if (applicationContext == null) {
> + CamelContext camelContext = getContext();
> + if (camelContext instanceof SpringCamelContext) {
> + SpringCamelContext springCamelContext =
> (SpringCamelContext) camelContext;
> + return springCamelContext.getApplicationContext();
> + }
> + else {
> + throw new IllegalArgumentException("This SpringBuilder is
> not being used
> with a SpringCamelContext and there is no applicationContext property
> configured");
> + }
> + }
>
>
> So the problem seems to be that I have an instance of CamelContext instead
> of SpringCamelContext. SpringcamelContext extends camelcontext incidently.
>
> the questions is - how can I create an instance of SpringCamelContext from
> within my Spring xml?
>
> To refer back to my original post, I have this piece of XML to create, I
> guess, a normal camelContext:
>
> <camel:camelContext id="camel2"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <camel:package>com.mycompany.mypackage</camel:package>
> </camel:camelContext>
>
> I was hoping it would be as simply as changing "camelContext" to
> "SpringCamelContext" but sadly not ;)
>
> Can anyone indicate if this is something perhaps currently not supported,
> or hopefully offer a solution? maybe I can't use spring xml for this?
>
> I am using the SpringRouteBuilder because I want to be able to ensure that
> messages are persisted from 1 queue to another (i.e. if somebody pulls out
> the plug during processing within a bean, my message will still exist on
> the "from" queue and not be lost). So if Camel supports transactions
> another way, would gladly use that instead.
>
> Thanks for any feedback
>
> andrew
>
--
View this message in context:
http://www.nabble.com/Error%3A-This-SpringBuilder-is-not-being-used-with-a-SpringCamelContext-and-there-is-no-applicationContext-property-configured-tp22326547p22347500.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.