-
Feature Request
-
Resolution: Obsolete
-
Major
-
None
-
7.3.1
Today the project generated using camel-cxf-code-first-blueprint can't Run As Local Camel Context (using Fuse Tooling Run As context menu).
You get many errors. The first one is:
[ERROR] ************************************* [ERROR] Error occurred while running main from: org.apache.camel.spring.Main [ERROR] java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:488) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from URL [file:/home/rsoares/dev/workspace-jbds-8.1/test/src/main/resources/OSGI-INF/blueprint/blueprint.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd; lineNumber: 1; columnNumber: 50; White spaces are required between publicId and systemId. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:94) at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:207) at org.apache.camel.spring.Main.doStart(Main.java:156) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.main.MainSupport.run(MainSupport.java:150) at org.apache.camel.main.MainSupport.run(MainSupport.java:354) at org.apache.camel.spring.Main.main(Main.java:89) ... 6 more Caused by: org.xml.sax.SAXParseException; systemId: http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd; lineNumber: 1; columnNumber: 50; White spaces are required between publicId and systemId. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
Trying to solve that I realized you have to add many things in your pom.xml to be able to run a Camel Blueprint context in JBDS Fuse Tooling (from Run As Camel Local Context context Menu).
The first one is to add the following deps:
<!-- testing --> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test-blueprint</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.fileinstall</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.aries.blueprint</groupId> <artifactId>org.apache.aries.blueprint</artifactId> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> </dependency>
But that led to another class loading|conflict issue with CXF and ASM libraries. That you can solve adding that ASM dep to the top most deps list:
<!-- assuming camel is pulling aries 1.0.0, pull asm 4.0 first --> <!-- this is needed when unit testing camel-cxf with camel-test-blueprint --> <dependency> <groupId>org.ow2.asm</groupId> <artifactId>asm-all</artifactId> </dependency>
Another thing you have to add is the camel-maven-plugin and configure it to use Blue Print
<plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> <configuration> <useBlueprint>true</useBlueprint> </configuration> </plugin>
Another issue has to do with the WS endpoint. In order to be able to start an embedded Jetty engine to expose our Service end point. You need to add the following deps:
<!-- cxf --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-simple</artifactId> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-jetty</artifactId> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-management</artifactId> </dependency>
- relates to
-
FUSETOOLS-1385 Cannot run a project as Local Camel Context (cxf-code-first-blueprint, cxf-contract-first-blueprint)
- Closed