The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

dkssoft (1) [Avatar] Offline
#1
We have camel based application as OSGi bundle and were able to run using [mvn camel:run] apart from deploying it as a bundle in Servicemix.

Later we moved the properties file out of bundle.For this we have used Compendium Services.This facilitates us to keep the configuration file outside the bundle (in Servicemix_HOME/etc folder).To implement this we have addded http://www.springframework.org/schema/osgi-compendium" namespace handler in the camel-context file. This namespace handler is part of Spring-DM. So now we are we forced to deploy it in OSGi container. We can't use [mvn camel:run]

Is there any way that we can run this using [mvn camel:run] without removing osgi-compendium namespace handler from camel-context file(so that we can keep the configuration file outside bundle in case when we deploy in OSGi container)?

When using [mvn camel:run], we are getting the exception:

Error occurred while running main from: org.apache.camel.spring.Main
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:415)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi-compendium]
Offending resource: file [D:poccamel-osgi-wkf argetclassesMETA-INFspringcamel-context.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:6smilie
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:284)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1332)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)


Our camel-context.xml is:
<beans xmlns="http://www.springframework.org/schema/beans" >
xmlnssmiliesi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
xmlns:ctx="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">

<camelContext id="test-wkf" xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties" location="ref:testcfg" />
<routeBuilder ref="TestRoute" />
</camelContext>

<osgix:cm-properties id="testcfg" persistent-id="config" />

<ctx:property-placeholder properties-ref="testcfg" />
.........
.........
</beans>

Any help/suggestion will be highly appreciated.
davsclaus (413) [Avatar] Offline
#2
Re: Problem with Camel,osgi-compendium and mvn camel:run
Its generally better to use the Camel mailing list / forum to get help with Camel.
http://camel.apache.org/mailing-lists.html
http://camel.apache.org/discussion-forums.html

This forum is for discussing the Camel in Action book.

The came:run maven goal is running Camel standalone using an embedded Jetty server. Its not an OSGi runtime.