You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by smythewin <sv...@businessdecision.com> on 2011/09/27 13:51:16 UTC
TypeConversion with JAXB when calling "remote" EJB
Hi,
I'am running a route wich perfoms JAXB unmarshalling before calling an EJB:
The camel route and the EJB reside in two different web archives, both
deployt on the same application container.
This results in:
The EJB method expects an object of the same type that was unmarshalled:
When deploying classes for camel route and the EJB in the same web archive
everything works as expected.
Thanks in advance for all your help/suggestions.
Sven
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4845064.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by smythewin <sv...@businessdecision.com>.
Hi Claus,
I am using Camel V2.8.1.
The full Stacktrace (with tracing turned on) is as follows:
Thx for your help.
Sven
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4848644.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Can you post the full stacktrace, and what version of Camel are you using?
On Tue, Sep 27, 2011 at 3:05 PM, smythewin
<sv...@businessdecision.com> wrote:
> Hi,
>
> I already did that (ensured types are compatible making the types
> Serializable and setting a proper serialVersionUID). Using the same type
> reference on a single deployment works fine as stated out before.
>
> Additionaly, I wrote a TypeConverter that was just casting the inExchange to
> the same type.
> In fact, the outcome (in both cases) was the same as described, which makes
> me a little nervous.
>
> So further hints are pretty much appreciated.
>
> Sven
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4845285.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by smythewin <sv...@businessdecision.com>.
Hi,
I already did that (ensured types are compatible making the types
Serializable and setting a proper serialVersionUID). Using the same type
reference on a single deployment works fine as stated out before.
Additionaly, I wrote a TypeConverter that was just casting the inExchange to
the same type.
In fact, the outcome (in both cases) was the same as described, which makes
me a little nervous.
So further hints are pretty much appreciated.
Sven
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4845285.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You may have to ensure the classes is compatible.
For example add a fixed serialVersionUID in the classes.
On Tue, Sep 27, 2011 at 1:51 PM, smythewin
<sv...@businessdecision.com> wrote:
> Hi,
>
> I'am running a route wich perfoms JAXB unmarshalling before calling an EJB:
>
>
>
> The camel route and the EJB reside in two different web archives, both
> deployt on the same application container.
>
> This results in:
>
>
> The EJB method expects an object of the same type that was unmarshalled:
> When deploying classes for camel route and the EJB in the same web archive
> everything works as expected.
>
> Thanks in advance for all your help/suggestions.
>
> Sven
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4845064.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by smythewin <sv...@businessdecision.com>.
I am afraid.
First, since I would have to manually provide the XmlRootElement annotation
to an JAXB generated type and
second, I would probably lose the possibility that the type might be used
within other schemas.
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4888824.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by Willem Jiang <wi...@gmail.com>.
On Mon Oct 10 14:53:37 2011, smythewin wrote:
> Hi,
>
> I investigated a little further on this conversion issue between a camel
> artifact and an ejb artifact deployt on the same container.
>
> > From this I can state two thing:
> 1. deploying the camel route as a dependency of the web archive works fine.
> Tthis would have satisfy Willem.Jiang's remark
>
> ...but...
>
> 2. When annotating the exchange type with
> @javax.xml.bind.annotation.XmlRootElement the cast is done as expected! Even
> deploying the camel route seperatly. And even without making the types
> serializable.
>
> So I'am not a JAXB-Camel guru, but may someone has an idea what is going on
> under the hood? Why does the deployment of camel route and the EJB within
> the same deployment unit work without the annotation XmlRootElement but the
> "remote" call will make the annotation mandatory for type conversion?
>
Interesting.
camel-jaxb has a fall back converter to be used when the object is
annotated with XmlRootElement.
I'm just guessing there are some magic happen there :)
> Thanks for your support.
>
> Sven
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4887193.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by smythewin <sv...@businessdecision.com>.
Hi,
I investigated a little further on this conversion issue between a camel
artifact and an ejb artifact deployt on the same container.
>From this I can state two thing:
1. deploying the camel route as a dependency of the web archive works fine.
Tthis would have satisfy Willem.Jiang's remark
...but...
2. When annotating the exchange type with
@javax.xml.bind.annotation.XmlRootElement the cast is done as expected! Even
deploying the camel route seperatly. And even without making the types
serializable.
So I'am not a JAXB-Camel guru, but may someone has an idea what is going on
under the hood? Why does the deployment of camel route and the EJB within
the same deployment unit work without the annotation XmlRootElement but the
"remote" call will make the annotation mandatory for type conversion?
Thanks for your support.
Sven
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4887193.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by smythewin <sv...@businessdecision.com>.
Hi Jean-Baptiste,
since your mail I wasn't thinking in that direction (setting up a
JndiContext on the EJB). So thanks for the input!
I used the Camel EJB component to integrate the EJB in my Camel route. Since
both deployments run in same application server (ergo the same JVM) the
default JndiContext on the JVM shall be used. At least thats what the
documentation says on http://camel.apache.org/ejb.html
cite: "/In a real application server you most likely do not have to setup a
JndiContext on the EJB component as it will create a default JndiContext on
the same JVM as the application server, which usually allows it to access
the JNDI registry and lookup the EJBs.
However if you need to access a application server on a remote JVM or the
likes, you have to prepare the properties beforehand./"
).
Even the EJB is found as the call happens. And there is still the type
conversion left.
Did I missed a critical point whilst this superficial view?
Thank you all for your help. And as I stated out: My view is probably to
narraw so I appreciate any hint.
Sven
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4852261.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Sven,
FYI, I blogged about calling remote EJBs in Camel routes:
http://blog.nanthrax.net/2011/08/use-a-remote-ejb-in-camel-routes/
I make a remote JNDI lookup on the EJB (session stateless) and use it as
a bean in a route.
Regards
JB
On 09/29/2011 10:19 AM, smythewin wrote:
> Hi Claus,
>
> thanks for your answer. You are pretty well dedicated in this forum!
>
> I am using Glassfish V3.1.1 with EJB V3.0, as you already assumed correctly.
>
> I stated at Willem within my last post: it is possible to call the "remote"
> EJB via an alternative EJB call (in my case from a Servlet referencing the
> same EJB method as within the camel route).
> And this is even possible depoying the camel stuff along with the servlet
> (well, but not making use of it while the described EJB call).
>
> May the sources will help?
>
> Sven
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4852209.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by smythewin <sv...@businessdecision.com>.
Hi Claus,
thanks for your answer. You are pretty well dedicated in this forum!
I am using Glassfish V3.1.1 with EJB V3.0, as you already assumed correctly.
I stated at Willem within my last post: it is possible to call the "remote"
EJB via an alternative EJB call (in my case from a Servlet referencing the
same EJB method as within the camel route).
And this is even possible depoying the camel stuff along with the servlet
(well, but not making use of it while the described EJB call).
May the sources will help?
Sven
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4852209.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Sep 28, 2011 at 4:27 PM, smythewin
<sv...@businessdecision.com> wrote:
> Hi,
>
> if I get Willem's point right, I would NOT be able to call the EJB remotely
> in either way (using camel ejb or any ordinary ejb invocation mechanism).
>
> But I can perfectly do that, when running a Servlet (in the same deployment
> artifact as the camel route is located), injecing it the (remote) EJB
> reference, create an object of type MemberBusDataDeliveryType and call the
> EJB method with the type object parameterized. The result is the expected
> one, and not the type conversion failure as described about.
>
>
May the sources will help?
>
Try creating a project without Camel, to see if you can get it working
to invoke the EJBs without any problems?
And btw which EJB server are you using? And what version of the EJB? I
assume its EJB 3.0.
> Thanks in advance for all your help/suggestions.
>
> Sven
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4849366.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by smythewin <sv...@businessdecision.com>.
Hi,
if I get Willem's point right, I would NOT be able to call the EJB remotely
in either way (using camel ejb or any ordinary ejb invocation mechanism).
But I can perfectly do that, when running a Servlet (in the same deployment
artifact as the camel route is located), injecing it the (remote) EJB
reference, create an object of type MemberBusDataDeliveryType and call the
EJB method with the type object parameterized. The result is the expected
one, and not the type conversion failure as described about.
May the sources will help?
Thanks in advance for all your help/suggestions.
Sven
--
View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4849366.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: TypeConversion with JAXB when calling "remote" EJB
Posted by Willem Jiang <wi...@gmail.com>.
I think it more like a class loader issue than a camel issue.
Maybe you need find other way to invoke the remote EJB by marshaling and
unmarshaling the request/response instead passing the value directly.
On 9/27/11 7:51 PM, smythewin wrote:
> Hi,
>
> I'am running a route wich perfoms JAXB unmarshalling before calling an EJB:
>
>
>
> The camel route and the EJB reside in two different web archives, both
> deployt on the same application container.
>
> This results in:
>
>
> The EJB method expects an object of the same type that was unmarshalled:
> When deploying classes for camel route and the EJB in the same web archive
> everything works as expected.
>
> Thanks in advance for all your help/suggestions.
>
> Sven
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TypeConversion-with-JAXB-when-calling-remote-EJB-tp4845064p4845064.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang