So here comes the next bump! javax.xml.bind.JAXBException: "com.example.filexml" doesnt contain ObjectFactory.class or jaxb.index
Do I have to add a jaxb.index file to my package? Regards, Jothi On Fri, Aug 17, 2012 at 10:24 AM, Joe San <codeintheo...@gmail.com> wrote: > Just managed to get rid of this issue and I was about to post my solution > and saw your message. Added the following as a dependency and it worked! > > <dependency> > <groupId>org.slf4j</groupId> > <artifactId>slf4j-api</artifactId> > <version>1.6.6</version> > </dependency> > > Regards, > Jothi > > > On Fri, Aug 17, 2012 at 10:18 AM, Claus Ibsen <claus.ib...@gmail.com>wrote: > >> On Fri, Aug 17, 2012 at 10:06 AM, Joe San <codeintheo...@gmail.com> >> wrote: >> > I've tried to get rid of this issue but unfortunately could not. What I >> do >> > not understand is the following: >> > >> > The Error says: >> > >> > Exception in thread "main" java.lang.NoClassDefFoundError: >> > org/slf4j/LoggerFactory >> > at >> > org.apache.camel.support.ServiceSupport.<clinit>(ServiceSupport.java:38) >> > at >> > >> org.example.filexml.CamelWithFileAndXML.main(CamelWithFileAndXML.java:23) >> > Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory >> > >> > I have a dependency as: >> > >> > <dependency> >> > <groupId>org.slf4j</groupId> >> > <artifactId>slf4j-log4j12</artifactId> >> > <version>1.6.6</version> >> > </dependency> >> > >> > When I checked the slf4j jar file, the package structure is different >> from >> > what the error says. There is no org.slf4j.LoggerFactory but rather >> > org\slf4j\impl\Log4jLoggerFactory. Am I using wrong libraries? >> > >> >> And you got slf4j-api JAR as well? Its needed as dependency. >> >> > Regards, >> > Jothi >> > >> > On Thu, Aug 16, 2012 at 5:37 PM, Claus Ibsen <claus.ib...@gmail.com> >> wrote: >> > >> >> On Thu, Aug 16, 2012 at 4:08 PM, Joe San <codeintheo...@gmail.com> >> wrote: >> >> > Even with the al4j-log4j dependecy added in the libraries, I get this >> >> error. >> >> > >> >> >> >> Are you sure they are on the classpath when you run the app form within >> >> Eclipse. >> >> >> >> And you may want to add slf4j-log4j12 or some other logging bridge so >> >> you can use log4j, or maybe some other log kit to log. >> >> Then you can see logs in the console in eclipse etc, if you configure >> >> logging to output to std out. >> >> >> >> If you create a new Camel project using the maven archetypes it does >> that. >> >> camel.apache.org/camel-maven-archetypes.html >> >> >> >> Or see some of the Camel examples in the examples dir >> >> >> >> >> >> >> >> > Regards, >> >> > Jothi >> >> > >> >> > On Thu, Aug 16, 2012 at 3:59 PM, Claus Ibsen <claus.ib...@gmail.com> >> >> wrote: >> >> > >> >> >> Hi >> >> >> >> >> >> See this FAQ >> >> >> http://camel.apache.org/what-jars-do-i-need.html >> >> >> >> >> >> >> >> >> >> >> >> On Thu, Aug 16, 2012 at 3:50 PM, Joe San <codeintheo...@gmail.com> >> >> wrote: >> >> >> > Exception in thread "main" java.lang.NoClassDefFoundError: >> >> >> > org/slf4j/LoggerFactory >> >> >> > at >> >> >> > >> >> >> org.apache.camel.support.ServiceSupport.<clinit>(ServiceSupport.java:38) >> >> >> > at >> >> >> > >> >> >> org.example.filexml.CamelWithFileAndXML.main(CamelWithFileAndXML.java:23) >> >> >> > Caused by: java.lang.ClassNotFoundException: >> org.slf4j.LoggerFactory >> >> >> > at java.net.URLClassLoader$1.run(Unknown Source) >> >> >> > at java.security.AccessController.doPrivileged(Native Method) >> >> >> > at java.net.URLClassLoader.findClass(Unknown Source) >> >> >> > at java.lang.ClassLoader.loadClass(Unknown Source) >> >> >> > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) >> >> >> > at java.lang.ClassLoader.loadClass(Unknown Source) >> >> >> > ... 2 more >> >> >> > >> >> >> > My simple route fails with the above exception. All I have in my >> >> pom.xml >> >> >> > defined is: >> >> >> > >> >> >> > <dependency> >> >> >> > <groupId>org.apache.camel</groupId> >> >> >> > <artifactId>camel-core</artifactId> >> >> >> > <version>2.9.2</version> >> >> >> > </dependency> >> >> >> > <dependency> >> >> >> > <groupId>org.apache.camel</groupId> >> >> >> > <artifactId>camel-jaxb</artifactId> >> >> >> > <version>2.9.2</version> >> >> >> > </dependency> >> >> >> > >> >> >> > Do I need additional dependencies to be added other than this? >> >> >> > >> >> >> > Regards, >> >> >> > Jothi >> >> >> > >> >> >> > On Thu, Aug 16, 2012 at 3:34 PM, Joe San <codeintheo...@gmail.com >> > >> >> >> wrote: >> >> >> > >> >> >> >> I just found that out from Chapter 4. I would have expected this >> hint >> >> >> that >> >> >> >> "when the bean has only one method, camel invokes it >> automagically >> >> >> without >> >> >> >> having to explicitly specifying it" in Chapter 3 itself. >> >> >> >> >> >> >> >> Regards, >> >> >> >> Jothi >> >> >> >> >> >> >> >> >> >> >> >> On Thu, Aug 16, 2012 at 3:32 PM, Claus Ibsen < >> claus.ib...@gmail.com >> >> >> >wrote: >> >> >> >> >> >> >> >>> On Thu, Aug 16, 2012 at 3:16 PM, Joe San < >> codeintheo...@gmail.com> >> >> >> wrote: >> >> >> >>> > Thanks for pointing me to toe documentation. My actual >> question >> >> got >> >> >> >>> > clarified once I had a look into the documentation. >> >> >> >>> > >> >> >> >>> > From the Camel in Action book: >> >> >> >>> > >> >> >> >>> > from("quartz://report?cron=0+0+6+*+*+?") >> >> >> >>> > .to("http://riders.com/orders/cmd=received&date=yesterday") >> >> >> >>> > .bean(new OrderToCsvBean()) >> >> >> >>> > >> .to("file://riders/orders?fileName=report-${header.Date}.csv"); >> >> >> >>> > >> >> >> >>> > How does Camel know which method in the OrderToCsvBean() >> class to >> >> >> >>> invoke. >> >> >> >>> > Unfortunately the book does not mentions this in Chapter 3. >> Not >> >> sure >> >> >> if >> >> >> >>> it >> >> >> >>> > is mentioned in Chapter 4 as I'm yet to start with Chapter 4. >> >> >> >>> > >> >> >> >>> >> >> >> >>> Yep chapter 4 is all about using beans/pojos with Camel; see for >> >> >> >>> example page 105. >> >> >> >>> >> >> >> >>> But basically if the pojo/bean has 1 method, then Camel knows >> that >> >> it >> >> >> >>> should invoke that method. >> >> >> >>> Its when you have 2+ methods it gets more complicated. You can >> of >> >> >> >>> course tell Camel the method name to use etc. >> >> >> >>> >> >> >> >>> But its all covered as well in chapter 4, as well you can find >> >> pieces >> >> >> >>> of details scattered online in the Camel docs. >> >> >> >>> >> >> >> >>> >> >> >> >>> > Regards, >> >> >> >>> > Jothi >> >> >> >>> > >> >> >> >>> > On Thu, Aug 16, 2012 at 2:46 PM, Babak Vahdat >> >> >> >>> > <babak.vah...@swissonline.ch>wrote: >> >> >> >>> > >> >> >> >>> >> Check the documentation for this: >> >> >> >>> >> >> >> >> >>> >> http://camel.apache.org/bean-binding.html >> >> >> >>> >> >> >> >> >>> >> Babak >> >> >> >>> >> >> >> >> >>> >> Am 16.08.12 14:32 schrieb "Joe San" unter < >> >> codeintheo...@gmail.com >> >> >> >: >> >> >> >>> >> >> >> >> >>> >> >I have decided to use JAXB instead of xStream. My route >> >> definition >> >> >> >>> looks >> >> >> >>> >> >like this: >> >> >> >>> >> > >> >> >> >>> >> > final JaxbDataFormat jaxb = new >> >> >> >>> >> >JaxbDataFormat("com.example.filexml"); >> >> >> >>> >> > context.addRoutes(new RouteBuilder() { >> >> >> >>> >> > public void configure() { >> >> >> >>> >> > >> from("file://my.xml").unmarshal(jaxb).bean(new >> >> >> >>> >> >ProcessorBean()).to("file://my.xml"); >> >> >> >>> >> > } >> >> >> >>> >> > }); >> >> >> >>> >> > >> >> >> >>> >> >How do I get hold of the UnMarshalled Java Object (say >> >> Person.java) >> >> >> >>> in my >> >> >> >>> >> >ProcessorBean. Also, when I use a bean for Processing, how >> does >> >> >> Camel >> >> >> >>> know >> >> >> >>> >> >which method to invoke in that bean? >> >> >> >>> >> > >> >> >> >>> >> >Regards, >> >> >> >>> >> >Jothi >> >> >> >>> >> > >> >> >> >>> >> >On Thu, Aug 16, 2012 at 1:56 PM, Joe San < >> >> codeintheo...@gmail.com> >> >> >> >>> wrote: >> >> >> >>> >> > >> >> >> >>> >> >> Guys, >> >> >> >>> >> >> >> >> >> >>> >> >> I have a route which is defined as below: >> >> >> >>> >> >> >> >> >> >>> >> >> from("file://my.xml").marshal().xstream("UTF-8").bean(new >> >> >> >>> >> >> ProcessorBean()).to("file://my.xml"); >> >> >> >>> >> >> >> >> >> >>> >> >> All I want to do is access the my.xml in my ProcessorBean. >> >> Where >> >> >> >>> and how >> >> >> >>> >> >> do I specify the Java object which will be filled with the >> >> values >> >> >> >>> in the >> >> >> >>> >> >> xml file? >> >> >> >>> >> >> >> >> >> >>> >> >> Regards, >> >> >> >>> >> >> Jothi >> >> >> >>> >> >> >> >> >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> -- >> >> >> >>> Claus Ibsen >> >> >> >>> ----------------- >> >> >> >>> FuseSource >> >> >> >>> Email: cib...@fusesource.com >> >> >> >>> Web: http://fusesource.com >> >> >> >>> Twitter: davsclaus, fusenews >> >> >> >>> Blog: http://davsclaus.com >> >> >> >>> Author of Camel in Action: http://www.manning.com/ibsen >> >> >> >>> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> Claus Ibsen >> >> >> ----------------- >> >> >> FuseSource >> >> >> Email: cib...@fusesource.com >> >> >> Web: http://fusesource.com >> >> >> Twitter: davsclaus, fusenews >> >> >> Blog: http://davsclaus.com >> >> >> Author of Camel in Action: http://www.manning.com/ibsen >> >> >> >> >> >> >> >> >> >> >> -- >> >> Claus Ibsen >> >> ----------------- >> >> FuseSource >> >> Email: cib...@fusesource.com >> >> Web: http://fusesource.com >> >> Twitter: davsclaus, fusenews >> >> Blog: http://davsclaus.com >> >> Author of Camel in Action: http://www.manning.com/ibsen >> >> >> >> >> >> -- >> Claus Ibsen >> ----------------- >> FuseSource >> Email: cib...@fusesource.com >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> > >