You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bovas <bo...@gmail.com> on 2013/05/29 11:23:44 UTC

Help Jaxb

Hi,

I use camel 2.11, jdk1.6, Groovy language.
I have problem in use Jaxb. I don't understand the problem. 
I read this http://camel.apache.org/producertemplate.html
I try this solution
http://camel.465427.n5.nabble.com/ProducerTemplate-td4552750.html#a4553023
(only Pojo, no spring)

Can someone help me please? or give me a simple use of jaxb.

<http://camel.465427.n5.nabble.com/file/n5733397/jaxbtest.png> 

My class customer :

<http://camel.465427.n5.nabble.com/file/n5733397/customer.png> 

regards, 
Bovas





--
View this message in context: http://camel.465427.n5.nabble.com/Help-Jaxb-tp5733397.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help Jaxb

Posted by Ornitorrinc <or...@gmail.com>.
Try to change that line:
jaxb.setContextPath("Customer.class.getPackage().getName")

Like that:
jaxb.setContextPath(Customer.class.getPackage().getName)



--
View this message in context: http://camel.465427.n5.nabble.com/Help-Jaxb-tp5733397p5733513.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help Jaxb

Posted by Bovas <bo...@gmail.com>.
I put @Autowire because i read this post
http://camel.465427.n5.nabble.com/ProducerTemplate-td4552750.html#a4553023
but nothing.

I remove the @Autowire, I have always  the same error :

*Caught: java.lang.NullPointerException: Cannot invoke method sendBody() on
null object
java.lang.NullPointerException: Cannot invoke method sendBody() on null
object*

I try several tests to use jaxb but nothing :

<http://camel.465427.n5.nabble.com/file/n5733508/jaxb.png> 

My method initialize :

<http://camel.465427.n5.nabble.com/file/n5733508/initialise.png> 

In this example the error is : 

Caught: org.apache.camel.FailedToCreateRouteException: Failed to create
route route1 at: >>>
Marshal[org.apache.camel.model.dataformat.JaxbDataFormat@559b808a] <<< in
route: Route(route1)[[From[file://c/dev/camel/in2]] -> [To[bean://v...
*because of Data format 'jaxb' could not be created. Ensure that the data
format is valid and the associated Camel component is present on the
classpath*
org.apache.camel.FailedToCreateRouteException: Failed to create route route1
at: >>> Marshal[org.apache.camel.model.dataformat.JaxbDataFormat@559b808a]
<<< in route: Route(route1)[[From[file://c/dev/camel/in2]] ->
[To[bean://v... *because of Data format 'jaxb' could not be created. Ensure
that the data format is valid and the associated Camel component is present
on the classpath*

I'm missing something.
I'm hopeless 






-----
regards,
Bovas
--
View this message in context: http://camel.465427.n5.nabble.com/Help-Jaxb-tp5733397p5733508.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help Jaxb

Posted by Magnus Palmér <ma...@gmail.com>.
You use the Spring annotation @Autowire for your ProducerTemplate which is
null when you try to use it.
You wrote that you don't use Spring?

You will need a CamelContext for your route to run in as well.

Kind regards, Magnus Palmér


2013/5/29 Bovas <bo...@gmail.com>

> Hi,
>
> I use camel 2.11, jdk1.6, Groovy language.
> I have problem in use Jaxb. I don't understand the problem.
> I read this http://camel.apache.org/producertemplate.html
> I try this solution
> http://camel.465427.n5.nabble.com/ProducerTemplate-td4552750.html#a4553023
> (only Pojo, no spring)
>
> Can someone help me please? or give me a simple use of jaxb.
>
> <http://camel.465427.n5.nabble.com/file/n5733397/jaxbtest.png>
>
> My class customer :
>
> <http://camel.465427.n5.nabble.com/file/n5733397/customer.png>
>
> regards,
> Bovas
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Help-Jaxb-tp5733397.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>