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 192B511232 for ; Fri, 11 Jul 2014 11:50:45 +0000 (UTC) Received: (qmail 94642 invoked by uid 500); 11 Jul 2014 11:50:44 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 94586 invoked by uid 500); 11 Jul 2014 11:50:44 -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 94564 invoked by uid 99); 11 Jul 2014 11:50:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 11:50:44 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_REPLY,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of willem.jiang@gmail.com designates 209.85.220.42 as permitted sender) Received: from [209.85.220.42] (HELO mail-pa0-f42.google.com) (209.85.220.42) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 11:50:40 +0000 Received: by mail-pa0-f42.google.com with SMTP id lj1so1353516pab.1 for ; Fri, 11 Jul 2014 04:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:content-transfer-encoding:content-disposition; bh=MhuZQmR4S2Lwi4gqlNpwdXyb4HEa4a2KrtKzpnwzro0=; b=DkIA1QnVBnOmxr70ag8J/hPhmsxmJh4JZDxvtWOQ1C7gikRnguYPKVKqY7kFMRdhDJ 3/6bXYg6Xb++w/Hpk8fiCjo81Te+2lRSb0dibUBl7Is27sAjEe9b+B77aeB6STCdhxyy aMa5KK4KK51uJwfuoXi7EJi2oeYKydBTpBbWf+bvA71F5hYwlO2opDyyO3DrUw0RCuWX jTdoiBUht+1rM5wGMSZ6p/IoZfhO/4E7R1Pr+pLvUc90RhUr3qHNMpba61bS6le911I3 XjVZHBNkiEJtLuQqb/EwyC/Ftym3sB+Qbxyy12mYWLWZngiVEUuSfEwepJyKYJ9Tk9rJ eyag== X-Received: by 10.70.138.45 with SMTP id qn13mr23556982pdb.20.1405079419589; Fri, 11 Jul 2014 04:50:19 -0700 (PDT) Received: from localhost ([125.34.11.44]) by mx.google.com with ESMTPSA id eh4sm2083234pbc.79.2014.07.11.04.50.15 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jul 2014 04:50:16 -0700 (PDT) Date: Fri, 11 Jul 2014 19:50:10 +0800 From: Willem Jiang To: users@camel.apache.org Message-ID: In-Reply-To: <1405073514000-5753714.post@n5.nabble.com> References: <1402913218487-5752336.post@n5.nabble.com> <1403061517965-5752466.post@n5.nabble.com> <1405073514000-5753714.post@n5.nabble.com> Subject: Re: How to use a public endpoint outside of camecontext? X-Mailer: Airmail (237) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org It looks like you don=E2=80=99t have any camel context definition inside = of spring configuration file. It could cause some trouble as the endpoint need to have the reference of= the camel context. -- =20 Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang =20 Weibo: =E5=A7=9C=E5=AE=81willem On July 11, 2014 at 6:14:35 PM, simafengyun (273132695=40qq.com) wrote: > Hi Willem, > =20 > My code like that(not the real code) > =20 > *in xml: * > =20 > > uri=3D=22seda:trades=3Fsize=3D1000000&concurrentConsumers=3D20&wait=46= orTaskToComplete=3DNever=22 =20 > xmlns=3D=22http://camel.apache.org/schema/spring=22/> > =20 > > xmlns=3D=22http://camel.apache.org/schema/spring=22> > =20 > =20 > =20 > =20 > =20 > =20 > =20 > *in java: * > =20 > //load spring xml > final AbstractXmlApplicationContext springAppContext=3D new > ClassPathXmlApplicationContext(=22testSpring.xml=22); > =20 > =20 > //registry spring xml to camel context > ActorSystem system =3D ActorSystem.create(=22some-system=22); > Camel camel =3D CamelExtension.get(system); > camel.context().setRegistry(new > ApplicationContextRegistry(springAppContext)); > springAppContext.refresh(); > =20 > =20 > // add the routesContext to camelContext > ArrayList rdList =3D > (ArrayList)camel.context().getRegistry().lookup(=22defaultRoutes=22); =20 > RouteDefinition rd =3D rdList.get(0); > CamelExtension.get(system).context().addRouteDefinition(rd); > =20 > *Error:* > =20 > Caused by: org.springframework.beans.factory.BeanCreationException: Err= or > creating bean with name 'testSeda': =46actoryBean threw exception on ob= ject > creation; nested exception is java.lang.NullPointerException > at > org.springframework.beans.factory.support.=46actoryBeanRegistrySupport.= doGetObject=46rom=46actoryBean(=46actoryBeanRegistrySupport.java:149) =20 > at > org.springframework.beans.factory.support.=46actoryBeanRegistrySupport.= getObject=46rom=46actoryBean(=46actoryBeanRegistrySupport.java:102) =20 > at > org.springframework.beans.factory.support.AbstractBean=46actory.getObje= ct=46orBeanInstance(AbstractBean=46actory.java:1440) =20 > at > org.springframework.beans.factory.support.AbstractBean=46actory.doGetBe= an(AbstractBean=46actory.java:247) =20 > at > org.springframework.beans.factory.support.AbstractBean=46actory.getBean= (AbstractBean=46actory.java:192) =20 > at > org.springframework.context.support.AbstractApplicationContext.getBean(= AbstractApplicationContext.java:1075) =20 > at > org.apache.camel.spring.spi.ApplicationContextRegistry.lookup(Applicati= onContextRegistry.java:66) =20 > at > org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(Proper= tyPlaceholderDelegateRegistry.java:49) =20 > ... 21 more > Caused by: java.lang.NullPointerException > at > org.apache.camel.core.xml.AbstractCamelEndpoint=46actoryBean.getObject(= AbstractCamelEndpoint=46actoryBean.java:46) =20 > at > org.apache.camel.core.xml.AbstractCamelEndpoint=46actoryBean.getObject(= AbstractCamelEndpoint=46actoryBean.java:30) =20 > at > org.springframework.beans.factory.support.=46actoryBeanRegistrySupport.= doGetObject=46rom=46actoryBean(=46actoryBeanRegistrySupport.java:142) =20 > ... 28 more > =20 > =20 > =20 > =20 > =20 > -- > View this message in context: http://camel.465427.n5.nabble.com/How-to-= use-a-public-endpoint-outside-of-camecontext-tp5752336p5753714.html =20 > Sent from the Camel - Users mailing list archive at Nabble.com. > =20