Hi Errors like that smells like mixed versions of Camel JARs on the classpath etc. So I suggest to double check that all the camel JARs are the same version. And also for Spring JARs.
On Mon, Nov 10, 2014 at 9:10 AM, Vaïsse-Lesteven Arthur <arthurvai...@yahoo.fr> wrote: > Hi everyone, > > I'm currently trying the new REST DSL of the Apache Camel 2.14.0 release. > And as the title of this post state it, I got problems with a bean that > specify a file name. Let's show what's wrong. > > Here come a valid XML file reduced to a test case. It only define a String > bean and a Camel context containing a rest endpoint and a single route > called by the rest endpoint. > _______________________________________________________________________________________ > <?xml version="1.0" encoding="UTF-8"?> > <beans > xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > > http://camel.apache.org/schema/spring > > http://camel.apache.org/schema/spring/camel-spring.xsd" >> > > <bean id="source-directory" class="java.lang.String"> > <constructor-arg type="java.lang.String" > value="file:/opt/a/directory/data/audio" /> > </bean> > > <camelContext id="camelContext" > xmlns="http://camel.apache.org/schema/spring"> > > <dataFormats> > <json id="jack" library="Jackson" > unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/> > </dataFormats> > > <restConfiguration bindingMode="json" component="restlet" > port="5117" /> > > <rest path="/rest-api/"> > <get uri="/{words}/" consumes="application/json" > produces="application/json"> > <to uri="direct:words" /> > </get> > </rest> > > <route> > <from uri="direct:words" /> > <transform> > <simple>${headers.words}</simple> > </transform> > </route> > > </camelContext> > > </beans> > _______________________________________________________________________________________ > > To load and test this Camel context I use the following test case : > _______________________________________________________________________________________ > import org.apache.camel.CamelContext; > import org.springframework.context.support.FileSystemXmlApplicationContext; > > public class Test { > @org.junit.Test > public void testT() throws Exception { > final FileSystemXmlApplicationContext bean = new > FileSystemXmlApplicationContext("src/test/resources/camelContext.xml"); > final CamelContext context = bean.getBean("camelContext", > CamelContext.class); > context.start(); > Thread.yield(); > Thread.sleep(600000); > } > } > _______________________________________________________________________________________ > > It currently lead to the following error : > /org.apache.camel.RuntimeCamelException: > org.apache.camel.FailedToCreateRouteException: Failed to create route route2 > at: >>> RestBinding <<< in route: > Route(route2)[[From[rest:get:/rest-api/:/{words}/?produces=a... because of > Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: > javax.xml.bind.JAXBException: "file" ne contient pas ObjectFactory.class ou > jaxb.index/ > > It seems that removing the bean declaration OR the rest endpoint > declaration solve the problem, there is so an incompatibility between them, > but, as a Camel newbie, I'm unable to figure out what is the problem. > > Can someone give me clues ? Do I'm doing something wrong ? > > Thanks in advance, > Arthur. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Problem-with-REST-DSL-2-14-0-and-String-bean-tp5758812.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/