I am new to OSGI world.
Versions: Karaf: 4.1.0 Camel: 2.18.2 Spring: 4.3.5_RELEASE_1 (Apache Service Mix Bundles)
Ref: Camel-UserForum-on same question
I spent lot of time (even days ) in searching/understanding camel-spring with osgi container. I didn't find a good article for begginer like me which works with some setup or github..etc.
We are having camel-spring application running well. Now we want to move to OSGI environment like Karaf . We are doing some work on migration to OSGI, we are having severe issues we were able to solve couple of them ,but end up with having below issues:
I dont know where to place camel-spring xml context and route files (previuosly in classpath with NON-OSGi) .So its not loading context getting file not found .
if I put that as below , i know its may be a wrong way
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext( new String[] {"file:app-camel-spring.xml" }); Exception: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://camel.apache.org/schema/spring] Offending resource: URL [file:app-camel-spring.xml]
Even with Spring DM it doesn't work
Thanks,
Update-1 1. After forums asked me to look into GEMINI Blueprint(GB) I am now checking with GB. But Still I am getting same error with JAXB errors.
I am using now : Felix:
runtimelib group: 'org.apache.felix', name: 'org.apache.felix.gogo.command', version: '1+'
runtimelib group: 'org.apache.felix', name: 'org.apache.felix.gogo.runtime', version: '1+'
runtimelib group: 'org.apache.felix', name: 'org.apache.felix.gogo.shell', version: '1+'
runtimelib group: 'org.apache.felix', name: 'org.apache.felix.bundlerepository', version: '2+'
runtimelib group: 'org.apache.felix', name: 'org.apache.felix.fileinstall', version: '3+'
runtimelib group: 'org.apache.felix', name: 'org.apache.felix.scr.annotations', version: '1.12.0'
Bundle List:
lb
START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (5.6.2)|5.6.2
1|Active | 1|Apache Felix Bundle Repository (2.0.8)|2.0.8
2|Active | 1|Apache Felix File Install (3.5.8)|3.5.8
3|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
4|Active | 1|Apache Felix Gogo Runtime (1.0.2)|1.0.2
5|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
6|Active | 1|file:/E:/Codes/GIT/Repos/Experiments/osgi/felix/bundle/org.apache.felix.scr.annotations-1.12.0.jar (0.0.0)|0.0.0
7|Active | 1|Apache MINA Core (2.0.14)|2.0.14
8|Active | 1|Apache ServiceMix :: Bundles :: spring-context (4.3.1.RELEASE_1)|4.3.1.RELEASE_1
9|Active | 1|Logback Core Module (1.1.1)|1.1.1
10|Active | 1|slf4j-api (1.7.21)|1.7.21
11|Active | 1|camel-mina2 (2.18.0)|2.18.0
12|Active | 1|osgi_testing.test_cons (0.0.4.1488767989530)|0.0.4.1488767989530
13|Active | 1|Logback Classic Module (1.1.1)|1.1.1
14|Active | 1|Old JAXB Runtime (2.2.11)|2.2.11
15|Active | 1|Apache Log4j (1.2.17)|1.2.17
16|Active | 1|gemini-blueprint-core (2.0.9.BUILD-atlassian-m003)|2.0.9.BUILD-atlassian-m003
17|Installed | 1|Apache ServiceMix :: Bundles :: spring-context-support (4.3.1.RELEASE_1)|4.3.1.RELEASE_1
18|Active | 1|camel-core (2.18.0)|2.18.0
19|Active | 1|Apache ServiceMix :: Bundles :: aopalliance (1.0.0.6)|1.0.0.6
20|Active | 1|Apache ServiceMix :: Bundles :: spring-tx (4.3.1.RELEASE_1)|4.3.1.RELEASE_1
21|Active | 1|Apache ServiceMix :: Bundles :: spring-core (4.3.1.RELEASE_1)|4.3.1.RELEASE_1
22|Active | 1|gemini-blueprint-extender (2.0.9.BUILD-atlassian-m003)|2.0.9.BUILD-atlassian-m003
23|Active | 1|Apache ServiceMix :: Bundles :: spring-beans (4.3.1.RELEASE_1)|4.3.1.RELEASE_1
24|Active | 1|osgi_testing.test_impl2 (0.0.1.1488767989534)|0.0.1.1488767989534
25|Active | 1|camel-spring (2.18.0)|2.18.0
26|Active | 1|Apache Commons Logging (1.2.0)|1.2.0
27|Active | 1|test_api (0.0.2.1488767989527)|0.0.2.1488767989527
28|Active | 1|Apache Commons IO (2.5.0)|2.5.0
29|Active | 1|Old JAXB Core (2.2.11)|2.2.11
30|Active | 1|osgi_testing.test_impl3 (0.0.1.1488767989536)|0.0.1.1488767989536
31|Active | 1|Apache ServiceMix :: Bundles :: spring-expression (4.3.1.RELEASE_1)|4.3.1.RELEASE_1
32|Active | 1|Apache ServiceMix :: Bundles :: spring-aop (4.3.1.RELEASE_1)|4.3.1.RELEASE_1
33|Active | 1|gemini-blueprint-io (2.0.9.BUILD-atlassian-m003)|2.0.9.BUILD-atlassian-m003
34|Active | 1|osgi_testing.test_impl (0.0.1.1488767989532)|0.0.1.1488767989532
g! start 17
org.osgi.framework.BundleException: Unable to resolve org.apache.servicemix.bundles.spring-context-support [17](R 17.0): missing requirement
[org.apache.servicemix.bundles.spring-context-support [17](R 17.0)] osgi.wiring.package; (osgi.wiring.package=com.github.benmanes.caffeine.cache)
Unresolved requirements: [[org.apache.servicemix.bundles.spring-context-support [17](R 17.0)] osgi.wiring.package;
(osgi.wiring.package=com.github.benmanes.caffeine.cache)]
10:41:25.836 [fileinstall-load] ERROR com.tp.boot.ApplicationBootActivator - ERROR::
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://camel.apache.org/schema/spring]
Offending resource: URL [file:app-camel-spring.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) ~[na:na]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) ~[na:na]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80) ~[na:na]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:301) ~[na:na]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1408) ~[na:na]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401) ~[na:na]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:172) ~[na:na]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:142) ~[na:na]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252) ~[na:na]
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127) ~[na:na]
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93) ~[na:na]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) ~[na:na]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:612) ~[na:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:513) ~[na:na]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) ~[na:na]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) ~[na:na]
at com.tp.boot.ApplicationBootActivator.start(ApplicationBootActivator.java:54) ~[na:na]
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697) ~[felix.jar:na]
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2238) ~[felix.jar:na]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[felix.jar:na]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[felix.jar:na]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253) ~[na:na]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225) ~[na:na]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512) ~[na:na]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361) ~[na:na]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312) ~[na:na]
10:41:25.870 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: osgi_testing.test_api
10:41:25.903 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: org.apache.mina.core
10:41:25.915 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: ch.qos.logback.core
10:41:25.928 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: slf4j.api
10:41:25.954 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: com.sun.xml.bind.jaxb-core
10:41:25.990 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: org.eclipse.gemini.blueprint.core
10:41:26.022 [fileinstall-load] DEBUG com.tp.device.rba.Activator - Started [osgi_testing.test_impl3]
10:41:26.035 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: osgi_testing.test_impl3
10:41:26.096 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: com.sun.xml.bind.jaxb-impl
10:41:26.123 [fileinstall-load] DEBUG com.tp.app.cons.Activator - start CONS
10:41:26.131 [fileinstall-load] DEBUG com.tp.app.cons.Activator - Device Bundle Tracker - started
10:41:26.139 [fileinstall-load] DEBUG com.tp.app.cons.DeviceHub - Device [rbaonguard] ClassName [com.tp.device.rba.RBADeviceImpl] Added
10:41:26.188 [fileinstall-load] DEBUG com.tp.app.cons.DeviceHub - Written to File [Config/devices]
10:41:26.195 [fileinstall-load] DEBUG com.tp.app.cons.DeviceServiceTracker - Service Reference- Added Device [rbaonguard] Device Class [com.tp.device.rba.RBADeviceImpl]
10:41:26.204 [fileinstall-load] DEBUG com.tp.app.cons.DeviceHub - Device [rbavoltagetep2] ClassName [com.tp.device.rba.RBADeviceImpl] Added
10:41:26.218 [fileinstall-load] DEBUG com.tp.app.cons.DeviceHub - Written to File [Config/devices]
10:41:26.225 [fileinstall-load] DEBUG com.tp.app.cons.DeviceServiceTracker - Service Reference- Added Device [rbavoltagetep2] Device Class [com.tp.device.rba.RBADeviceImpl]
10:41:26.240 [fileinstall-load] DEBUG com.tp.app.cons.DeviceHub - Device [xpi] ClassName [com.tp.device.xpi.XPIDeviceImpl] Added
10:41:26.266 [fileinstall-load] DEBUG com.tp.app.cons.DeviceHub - Written to File [Config/devices]
10:41:26.271 [fileinstall-load] DEBUG com.tp.app.cons.DeviceServiceTracker - Service Reference- Added Device [xpi] Device Class [com.tp.device.xpi.XPIDeviceImpl]
10:41:26.278 [fileinstall-load] DEBUG com.tp.app.cons.Activator - Device Service Tracker - started
10:41:26.283 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: osgi_testing.test_cons
10:41:26.295 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: org.apache.servicemix.bundles.spring-tx
10:41:26.832 [EclipseGeminiBlueprintExtenderThread-1] INFO o.e.g.b.c.s.AbstractDelegatedExecutionApplicationContext - About to begin startRefresh for osgi_testing.test_api [27]
10:41:26.985 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: org.eclipse.gemini.blueprint.extender
10:41:27.000 [EclipseGeminiBlueprintExtenderThread-2] INFO o.e.g.b.c.s.AbstractDelegatedExecutionApplicationContext - About to begin startRefresh for osgi_testing.test_api [27]
10:41:27.336 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: org.apache.servicemix.bundles.aopalliance
10:41:27.455 [fileinstall-load] DEBUG org.apache.camel.impl.osgi.Activator - Bundle started: ch.qos.logback.classic
10:41:27.559 [EclipseGeminiBlueprintExtenderThread-1] DEBUG o.a.c.s.h.CamelNamespaceHandler - Using org.apache.camel.spring.CamelContextFactoryBean as CamelContextBeanDefinitionParser
10:41:27.561 [EclipseGeminiBlueprintExtenderThread-2] DEBUG o.a.c.s.h.CamelNamespaceHandler - Using org.apache.camel.spring.CamelContextFactoryBean as CamelContextBeanDefinitionParser
10:41:27.762 [EclipseGeminiBlueprintExtenderThread-2] DEBUG o.e.g.b.c.s.AbstractDelegatedExecutionApplicationContext - Pre refresh error for osgi_testing.test_api [27]
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to create the JAXB binder; nested exception is javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index
- with linked exception:
[javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index]
at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:380) ~[na:na]
at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85) ~[na:na]
at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:61) ~[na:na]
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74) ~[na:na]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1411) ~[na:na]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401) ~[na:na]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:172) ~[na:na]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:142) ~[na:na]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) ~[na:na]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[na:na]
at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:170) ~[na:na]
at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:140) ~[na:na]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) ~[na:na]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:612) ~[na:na]
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:63) ~[na:na]
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:249) ~[na:na]
at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85) ~[na:na]
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:224) ~[na:na]
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:224) ~[na:na]
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:177) ~[na:na]
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:159) ~[na:na]
at org.eclipse.gemini.blueprint.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:207) ~[na:na]
at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_102]
Caused by: javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index
at javax.xml.bind.ContextFinder.newInstance(Unknown Source) ~[na:1.8.0_102]
at javax.xml.bind.ContextFinder.find(Unknown Source) ~[na:1.8.0_102]
at javax.xml.bind.JAXBContext.newInstance(Unknown Source) ~[na:1.8.0_102]
at javax.xml.bind.JAXBContext.newInstance(Unknown Source) ~[na:1.8.0_102]
at org.apache.camel.impl.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:31) ~[na:na]
at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:217) ~[na:na]
at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:378) ~[na:na]
... 28 common frames omitted
Caused by: javax.xml.bind.JAXBException: "org.apache.camel.model.config" doesnt contain ObjectFactory.class or jaxb.index
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) ~[na:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_102]
at javax.xml.bind.ContextFinder.newInstance(Unknown Source) ~[na:1.8.0_102]
... 35 common frames omitted
10:41:27.770 [EclipseGeminiBlueprintExtenderThread-1] DEBUG o.e.g.b.c.s.AbstractDelegatedExecutionApplicationContext - Pre refresh error for osgi_testing.test_api [27]