Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89B1CC5FB for ; Mon, 30 Jul 2012 23:52:40 +0000 (UTC) Received: (qmail 74476 invoked by uid 500); 30 Jul 2012 23:52:40 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 74406 invoked by uid 500); 30 Jul 2012 23:52:40 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 74395 invoked by uid 99); 30 Jul 2012 23:52:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2012 23:52:40 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of steved@glam.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2012 23:52:33 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Svzky-0007VB-4j for users@camel.apache.org; Mon, 30 Jul 2012 16:52:12 -0700 Date: Mon, 30 Jul 2012 16:52:12 -0700 (PDT) From: Steve Drach To: users@camel.apache.org Message-ID: <1343692332138-5716620.post@n5.nabble.com> Subject: NPE in RouteContextProcessor MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm using Camel 2.4.10. I'm get a NPE in RouteContextProcessor at line 42: 29 public class RouteContextProcessor extends DelegateAsyncProcessor { ... 38 @Override 39 protected boolean processNext(final Exchange exchange, final AsyncCallback callback) { 40 // push the current route context 41 if (exchange.getUnitOfWork() != null) { 42 exchange.getUnitOfWork().pushRouteContext(routeContext); 43 } I am able to demonstrate that even though the test in line 41 is true, getUnitOfWork() in null in line 43. I do this by instrumenting the code as follows: @Override protected boolean processNext(final Exchange exchange, final AsyncCallback callback) { // push the current route context try { if (exchange.getUnitOfWork() != null) { exchange.getUnitOfWork().pushRouteContext(routeContext); } } catch (Exception e) { System.out.println("********************\n"+exchange); System.out.println(exchange.getUnitOfWork()); e.printStackTrace(); System.exit(1); } And I can clearly see the null value. This implies to me somebody else has a reference to the same exchange object and is changing it between lines 42 and line 43. This only happens occasionally (1 in 1000 times). My code has 10 threads, so I wouldn't be surprised if it was my problem, but I just can't see it. I am not doing anything with the UnitOfWork in an exchange. At most, I change the body of the Message and perhaps the headers. This is very difficult to debug because it happens so infrequently. Does anyone have a suggestion that could help me? -- View this message in context: http://camel.465427.n5.nabble.com/NPE-in-RouteContextProcessor-tp5716620.html Sent from the Camel - Users mailing list archive at Nabble.com.