You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Charles Moulliard <ch...@gmail.com> on 2013/10/18 18:51:53 UTC
NPE - Camel UnitOfWork / CDI / CXF
Hi,
I'm currently working on a Camel CDI project using CXF/ActiveMQ endpoint
but when CXF endpoint creates the CamelExchange and Camel creates the
UnitOfWork, I get a NPE
https://gist.github.com/7044362
https://gist.github.com/7044297
I suspect that for a reason that I don't know the Exchange is null or
Context is null at line 49
public static UnitOfWork createUoW(Exchange exchange) {
UnitOfWork answer;
if (exchange.getContext().isUseMDCLogging()) {
answer = new MDCUnitOfWork(exchange);
} else {
answer = new DefaultUnitOfWork(exchange);
}
return answer;
}
As until now, I cannot debug, I contact you to get your ideas
Regards,
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Fwd: NPE - Camel UnitOfWork / CDI / CXF
Posted by Charles Moulliard <ch...@gmail.com>.
Hi,
I'm currently working on a Camel CDI project using CXF/ActiveMQ endpoint
but when CXF endpoint creates the CamelExchange and Camel creates the
UnitOfWork, I get a NPE
https://gist.github.com/7044362
https://gist.github.com/7044297
I suspect that for a reason that I don't know the Exchange is null or
Context is null at line 49
public static UnitOfWork createUoW(Exchange exchange) {
UnitOfWork answer;
if (exchange.getContext().isUseMDCLogging()) {
answer = new MDCUnitOfWork(exchange);
} else {
answer = new DefaultUnitOfWork(exchange);
}
return answer;
}
As until now, I cannot debug, I contact you to get your ideas
Regards,
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: NPE - Camel UnitOfWork / CDI / CXF
Posted by Charles Moulliard <ch...@gmail.com>.
modification committed so demo-skyguide should not be there anymore
On Tue, Oct 22, 2013 at 12:02 PM, Willem jiang <wi...@gmail.com>wrote:
> Hi Charles
>
> I think you just need to wire the CamelContext with CXF Endpoint to fix
> the NPE.
>
> I tried to run the build of workshop, but I got complain of not Failure to
> find
> org.fusesource.workshop:demo-skyguide:pom:1.0
>
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
> http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Tuesday, October 22, 2013 at 5:53 PM, Charles Moulliard wrote:
>
> > That does not work, most probably because getContext is not able to
> > find/retrieve the Context from CDI container.
> >
> >
> > On Tue, Oct 22, 2013 at 9:50 AM, Willem jiang <willem.jiang@gmail.com(mailto:
> willem.jiang@gmail.com)>wrote:
> >
> > > Hi Charles,
> > >
> > > How about adding below code into the first line of CxfRoute.configure()
> > > method ?
> > >
> > > cxfEndpoint.setCamelContext(getContext());
> > >
> > > --
> > > Willem Jiang
> > >
> > > Red Hat, Inc.
> > > Web: http://www.redhat.com
> > > Blog: http://willemjiang.blogspot.com (
> http://willemjiang.blogspot.com/)
> > > (English)
> > > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > > Twitter: willemjiang
> > > Weibo: 姜宁willem
> > >
> > >
> > >
> > >
> > >
> > > On Tuesday, October 22, 2013 at 3:15 PM, Charles Moulliard wrote:
> > >
> > > > code is here :
> > >
> https://github.com/cmoulliard/fuse-workshop-all/tree/master/routing/cdi-cxf
> > > >
> > > >
> > > > On Tue, Oct 22, 2013 at 9:00 AM, Willem jiang <
> willem.jiang@gmail.com (mailto:willem.jiang@gmail.com)(mailto:
> > > willem.jiang@gmail.com (mailto:willem.jiang@gmail.com))>wrote:
> > > >
> > > > > Hi Charles,
> > > > >
> > > > > It looks like the CamelContext wasn't injected into the
> CxfEndpoint.
> > > > > I need to have a look at the code how did you setup the
> CxfEndpoint.
> > > > >
> > > > > Regards,
> > > > > --
> > > > > Willem Jiang
> > > > >
> > > > > Red Hat, Inc.
> > > > > Web: http://www.redhat.com
> > > > > Blog: http://willemjiang.blogspot.com (
> > > >
> > >
> > >
> > > http://willemjiang.blogspot.com/)
> > > > > (English)
> > > > > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > > > > Twitter: willemjiang
> > > > > Weibo: 姜宁willem
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Saturday, October 19, 2013 at 12:51 AM, Charles Moulliard wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I'm currently working on a Camel CDI project using CXF/ActiveMQ
> > > endpoint
> > > > > > but when CXF endpoint creates the CamelExchange and Camel
> creates the
> > > > > > UnitOfWork, I get a NPE
> > > > > >
> > > > > > https://gist.github.com/7044362
> > > > > > https://gist.github.com/7044297
> > > > > >
> > > > > > I suspect that for a reason that I don't know the Exchange is
> null or
> > > > > > Context is null at line 49
> > > > > >
> > > > > > public static UnitOfWork createUoW(Exchange exchange) {
> > > > > > UnitOfWork answer;
> > > > > > if (exchange.getContext().isUseMDCLogging()) {
> > > > > > answer = new MDCUnitOfWork(exchange);
> > > > > > } else {
> > > > > > answer = new DefaultUnitOfWork(exchange);
> > > > > > }
> > > > > > return answer;
> > > > > > }
> > > > > >
> > > > > > As until now, I cannot debug, I contact you to get your ideas
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > --
> > > > > > Charles Moulliard
> > > > > > Apache Committer / Architect @RedHat
> > > > > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Charles Moulliard
> > > > Apache Committer / Architect @RedHat
> > > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> > >
> >
> >
> >
> >
> > --
> > Charles Moulliard
> > Apache Committer / Architect @RedHat
> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
>
>
>
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: NPE - Camel UnitOfWork / CDI / CXF
Posted by Willem jiang <wi...@gmail.com>.
Hi Charles
I think you just need to wire the CamelContext with CXF Endpoint to fix the NPE.
I tried to run the build of workshop, but I got complain of not Failure to find
org.fusesource.workshop:demo-skyguide:pom:1.0
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Tuesday, October 22, 2013 at 5:53 PM, Charles Moulliard wrote:
> That does not work, most probably because getContext is not able to
> find/retrieve the Context from CDI container.
>
>
> On Tue, Oct 22, 2013 at 9:50 AM, Willem jiang <willem.jiang@gmail.com (mailto:willem.jiang@gmail.com)>wrote:
>
> > Hi Charles,
> >
> > How about adding below code into the first line of CxfRoute.configure()
> > method ?
> >
> > cxfEndpoint.setCamelContext(getContext());
> >
> > --
> > Willem Jiang
> >
> > Red Hat, Inc.
> > Web: http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> > (English)
> > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> >
> >
> >
> >
> > On Tuesday, October 22, 2013 at 3:15 PM, Charles Moulliard wrote:
> >
> > > code is here :
> > https://github.com/cmoulliard/fuse-workshop-all/tree/master/routing/cdi-cxf
> > >
> > >
> > > On Tue, Oct 22, 2013 at 9:00 AM, Willem jiang <willem.jiang@gmail.com (mailto:willem.jiang@gmail.com)(mailto:
> > willem.jiang@gmail.com (mailto:willem.jiang@gmail.com))>wrote:
> > >
> > > > Hi Charles,
> > > >
> > > > It looks like the CamelContext wasn't injected into the CxfEndpoint.
> > > > I need to have a look at the code how did you setup the CxfEndpoint.
> > > >
> > > > Regards,
> > > > --
> > > > Willem Jiang
> > > >
> > > > Red Hat, Inc.
> > > > Web: http://www.redhat.com
> > > > Blog: http://willemjiang.blogspot.com (
> > >
> >
> >
> > http://willemjiang.blogspot.com/)
> > > > (English)
> > > > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > > > Twitter: willemjiang
> > > > Weibo: 姜宁willem
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Saturday, October 19, 2013 at 12:51 AM, Charles Moulliard wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm currently working on a Camel CDI project using CXF/ActiveMQ
> > endpoint
> > > > > but when CXF endpoint creates the CamelExchange and Camel creates the
> > > > > UnitOfWork, I get a NPE
> > > > >
> > > > > https://gist.github.com/7044362
> > > > > https://gist.github.com/7044297
> > > > >
> > > > > I suspect that for a reason that I don't know the Exchange is null or
> > > > > Context is null at line 49
> > > > >
> > > > > public static UnitOfWork createUoW(Exchange exchange) {
> > > > > UnitOfWork answer;
> > > > > if (exchange.getContext().isUseMDCLogging()) {
> > > > > answer = new MDCUnitOfWork(exchange);
> > > > > } else {
> > > > > answer = new DefaultUnitOfWork(exchange);
> > > > > }
> > > > > return answer;
> > > > > }
> > > > >
> > > > > As until now, I cannot debug, I contact you to get your ideas
> > > > >
> > > > > Regards,
> > > > >
> > > > > --
> > > > > Charles Moulliard
> > > > > Apache Committer / Architect @RedHat
> > > > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Charles Moulliard
> > > Apache Committer / Architect @RedHat
> > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> >
>
>
>
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: NPE - Camel UnitOfWork / CDI / CXF
Posted by Charles Moulliard <ch...@gmail.com>.
That does not work, most probably because getContext is not able to
find/retrieve the Context from CDI container.
On Tue, Oct 22, 2013 at 9:50 AM, Willem jiang <wi...@gmail.com>wrote:
> Hi Charles,
>
> How about adding below code into the first line of CxfRoute.configure()
> method ?
>
> cxfEndpoint.setCamelContext(getContext());
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
> http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Tuesday, October 22, 2013 at 3:15 PM, Charles Moulliard wrote:
>
> > code is here :
> >
> https://github.com/cmoulliard/fuse-workshop-all/tree/master/routing/cdi-cxf
> >
> >
> > On Tue, Oct 22, 2013 at 9:00 AM, Willem jiang <willem.jiang@gmail.com(mailto:
> willem.jiang@gmail.com)>wrote:
> >
> > > Hi Charles,
> > >
> > > It looks like the CamelContext wasn't injected into the CxfEndpoint.
> > > I need to have a look at the code how did you setup the CxfEndpoint.
> > >
> > > Regards,
> > > --
> > > Willem Jiang
> > >
> > > Red Hat, Inc.
> > > Web: http://www.redhat.com
> > > Blog: http://willemjiang.blogspot.com (
> http://willemjiang.blogspot.com/)
> > > (English)
> > > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > > Twitter: willemjiang
> > > Weibo: 姜宁willem
> > >
> > >
> > >
> > >
> > >
> > > On Saturday, October 19, 2013 at 12:51 AM, Charles Moulliard wrote:
> > >
> > > > Hi,
> > > >
> > > > I'm currently working on a Camel CDI project using CXF/ActiveMQ
> endpoint
> > > > but when CXF endpoint creates the CamelExchange and Camel creates the
> > > > UnitOfWork, I get a NPE
> > > >
> > > > https://gist.github.com/7044362
> > > > https://gist.github.com/7044297
> > > >
> > > > I suspect that for a reason that I don't know the Exchange is null or
> > > > Context is null at line 49
> > > >
> > > > public static UnitOfWork createUoW(Exchange exchange) {
> > > > UnitOfWork answer;
> > > > if (exchange.getContext().isUseMDCLogging()) {
> > > > answer = new MDCUnitOfWork(exchange);
> > > > } else {
> > > > answer = new DefaultUnitOfWork(exchange);
> > > > }
> > > > return answer;
> > > > }
> > > >
> > > > As until now, I cannot debug, I contact you to get your ideas
> > > >
> > > > Regards,
> > > >
> > > > --
> > > > Charles Moulliard
> > > > Apache Committer / Architect @RedHat
> > > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> > >
> >
> >
> >
> >
> > --
> > Charles Moulliard
> > Apache Committer / Architect @RedHat
> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
>
>
>
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: NPE - Camel UnitOfWork / CDI / CXF
Posted by Willem jiang <wi...@gmail.com>.
Hi Charles,
How about adding below code into the first line of CxfRoute.configure() method ?
cxfEndpoint.setCamelContext(getContext());
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Tuesday, October 22, 2013 at 3:15 PM, Charles Moulliard wrote:
> code is here :
> https://github.com/cmoulliard/fuse-workshop-all/tree/master/routing/cdi-cxf
>
>
> On Tue, Oct 22, 2013 at 9:00 AM, Willem jiang <willem.jiang@gmail.com (mailto:willem.jiang@gmail.com)>wrote:
>
> > Hi Charles,
> >
> > It looks like the CamelContext wasn't injected into the CxfEndpoint.
> > I need to have a look at the code how did you setup the CxfEndpoint.
> >
> > Regards,
> > --
> > Willem Jiang
> >
> > Red Hat, Inc.
> > Web: http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> > (English)
> > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> >
> >
> >
> >
> > On Saturday, October 19, 2013 at 12:51 AM, Charles Moulliard wrote:
> >
> > > Hi,
> > >
> > > I'm currently working on a Camel CDI project using CXF/ActiveMQ endpoint
> > > but when CXF endpoint creates the CamelExchange and Camel creates the
> > > UnitOfWork, I get a NPE
> > >
> > > https://gist.github.com/7044362
> > > https://gist.github.com/7044297
> > >
> > > I suspect that for a reason that I don't know the Exchange is null or
> > > Context is null at line 49
> > >
> > > public static UnitOfWork createUoW(Exchange exchange) {
> > > UnitOfWork answer;
> > > if (exchange.getContext().isUseMDCLogging()) {
> > > answer = new MDCUnitOfWork(exchange);
> > > } else {
> > > answer = new DefaultUnitOfWork(exchange);
> > > }
> > > return answer;
> > > }
> > >
> > > As until now, I cannot debug, I contact you to get your ideas
> > >
> > > Regards,
> > >
> > > --
> > > Charles Moulliard
> > > Apache Committer / Architect @RedHat
> > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
> >
>
>
>
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: NPE - Camel UnitOfWork / CDI / CXF
Posted by Charles Moulliard <ch...@gmail.com>.
code is here :
https://github.com/cmoulliard/fuse-workshop-all/tree/master/routing/cdi-cxf
On Tue, Oct 22, 2013 at 9:00 AM, Willem jiang <wi...@gmail.com>wrote:
> Hi Charles,
>
> It looks like the CamelContext wasn't injected into the CxfEndpoint.
> I need to have a look at the code how did you setup the CxfEndpoint.
>
> Regards,
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
> http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Saturday, October 19, 2013 at 12:51 AM, Charles Moulliard wrote:
>
> > Hi,
> >
> > I'm currently working on a Camel CDI project using CXF/ActiveMQ endpoint
> > but when CXF endpoint creates the CamelExchange and Camel creates the
> > UnitOfWork, I get a NPE
> >
> > https://gist.github.com/7044362
> > https://gist.github.com/7044297
> >
> > I suspect that for a reason that I don't know the Exchange is null or
> > Context is null at line 49
> >
> > public static UnitOfWork createUoW(Exchange exchange) {
> > UnitOfWork answer;
> > if (exchange.getContext().isUseMDCLogging()) {
> > answer = new MDCUnitOfWork(exchange);
> > } else {
> > answer = new DefaultUnitOfWork(exchange);
> > }
> > return answer;
> > }
> >
> > As until now, I cannot debug, I contact you to get your ideas
> >
> > Regards,
> >
> > --
> > Charles Moulliard
> > Apache Committer / Architect @RedHat
> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
>
>
>
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: NPE - Camel UnitOfWork / CDI / CXF
Posted by Willem jiang <wi...@gmail.com>.
Hi Charles,
It looks like the CamelContext wasn't injected into the CxfEndpoint.
I need to have a look at the code how did you setup the CxfEndpoint.
Regards,
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Saturday, October 19, 2013 at 12:51 AM, Charles Moulliard wrote:
> Hi,
>
> I'm currently working on a Camel CDI project using CXF/ActiveMQ endpoint
> but when CXF endpoint creates the CamelExchange and Camel creates the
> UnitOfWork, I get a NPE
>
> https://gist.github.com/7044362
> https://gist.github.com/7044297
>
> I suspect that for a reason that I don't know the Exchange is null or
> Context is null at line 49
>
> public static UnitOfWork createUoW(Exchange exchange) {
> UnitOfWork answer;
> if (exchange.getContext().isUseMDCLogging()) {
> answer = new MDCUnitOfWork(exchange);
> } else {
> answer = new DefaultUnitOfWork(exchange);
> }
> return answer;
> }
>
> As until now, I cannot debug, I contact you to get your ideas
>
> Regards,
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.github.io