Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 38971 invoked from network); 5 Mar 2009 09:35:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Mar 2009 09:35:56 -0000 Received: (qmail 37818 invoked by uid 500); 5 Mar 2009 09:35:56 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 37653 invoked by uid 500); 5 Mar 2009 09:35:55 -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 37642 invoked by uid 99); 5 Mar 2009 09:35:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Mar 2009 01:35:55 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.220.176 as permitted sender) Received: from [209.85.220.176] (HELO mail-fx0-f176.google.com) (209.85.220.176) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Mar 2009 09:35:46 +0000 Received: by fxm24 with SMTP id 24so3176394fxm.20 for ; Thu, 05 Mar 2009 01:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=cLYK81h7zvptj9INCmVrDpCvEAHqrP02NU/O/0HSqEc=; b=bAoftJ/kSFONp8W3iNuZdsCtdvj0C3j4qRqEZcRjtGg32fPhyPn3bCrVzDB1Xzm67h Rp/UPDYd3sYWNmkSAlLbQpTFybgz41mI3yTyAL20sJdBt81BdxkJPRnVuElhQFJ6ePTp BVn4NBGF47Bso+kJTKEe67mERTPRBxSRY8JGE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=T69ss/cs/nY1wjD+txMcoOv/D/FVhjPwL1EX+51v+5dLpZbVInQ4/zfKT8S6BGvucy 4SMJYIWUPSaw/t0vHmaYZGigxCyNVs6ar2Yf9HwpPSPchF3yuYw0ux/GKydvtglJDRxk xc+Hz7Ojrsl4Cft21437Y6ybitEFKxGr7Xomc= MIME-Version: 1.0 Received: by 10.223.109.20 with SMTP id h20mr759322fap.41.1236245724533; Thu, 05 Mar 2009 01:35:24 -0800 (PST) In-Reply-To: <49AF9BD4.9050009@gmail.com> References: <49AF9BD4.9050009@gmail.com> Date: Thu, 5 Mar 2009 10:35:24 +0100 Message-ID: <5380c69c0903050135o51ead932ofbec1cf8bc793b07@mail.gmail.com> Subject: Re: MinaConfiguration codec property From: Claus Ibsen To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Mar 5, 2009 at 10:31 AM, Willem Jiang wrot= e: > Hi > > Since the myMinaEndpoint is created by the myMinaFactory which has not > the reference from the application context which can be referred by the > camelContext . > So the myMinaEndpoint can't get find the instance of "myCodec". > > My suggestion is adding a constructor-arg of the camel context under the > to let the myMinaFactory hold the reference of camelContext. Yes I am adding it right now > > Willem > > > Nicolas Bouillon wrote: >> Hi, >> >> i've got an error when trying to create my mina endpoint with spring dsl= : >> >> =A0 =A0 =A0 >> =A0 =A0 =A0 >> >> =A0 =A0 =A0 > class=3D"org.apache.camel.component.mina.MinaComponent"/> >> >> =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 factory-bean=3D"myMinaFactory" >> =A0 =A0 =A0 =A0 =A0 =A0 factory-method=3D"createEndpoint"> >> =A0 =A0 =A0 =A0 =A0 >> =A0 =A0 =A0 >> >> =A0 =A0 =A0 > class=3D"org.apache.camel.component.mina.MinaConfiguration"> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 >> =A0 =A0 =A0 >> >> I got the following error : >> org.springframework.beans.factory.BeanCreationException: Error >> creating bean with name 'myMinaEndpoint' defined in class path >> resource [spring.xml]: Instantiation of bean failed; nested exception >> is org.springframework.beans.factory.BeanDefinitionStoreException: >> Factory method [public org.apache.camel.Endpoint >> org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.= camel.component.mina.MinaConfiguration) >> throws java.lang.Exception] threw exception; nested exception is >> java.lang.NullPointerException >> =A0 =A0 =A0 at org.springframework.beans.factory.support.ConstructorReso= lver.instantiateUsingFactoryMethod(ConstructorResolver.java:444) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractAutowir= eCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBe= anFactory.java:903) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractAutowir= eCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.j= ava:817) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractAutowir= eCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:44= 0) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractAutowir= eCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) >> =A0 =A0 =A0 at java.security.AccessController.doPrivileged(Native Method= ) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractAutowir= eCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractBeanFac= tory$1.getObject(AbstractBeanFactory.java:264) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.DefaultSingleto= nBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractBeanFac= tory.doGetBean(AbstractBeanFactory.java:261) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractBeanFac= tory.getBean(AbstractBeanFactory.java:185) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.AbstractBeanFac= tory.getBean(AbstractBeanFactory.java:164) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.DefaultListable= BeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) >> =A0 =A0 =A0 at org.springframework.context.support.AbstractApplicationCo= ntext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) >> =A0 =A0 =A0 at org.springframework.context.support.AbstractApplicationCo= ntext.refresh(AbstractApplicationContext.java:380) >> =A0 =A0 =A0 at org.springframework.context.support.ClassPathXmlApplicati= onContext.(ClassPathXmlApplicationContext.java:139) >> =A0 =A0 =A0 at org.springframework.context.support.ClassPathXmlApplicati= onContext.(ClassPathXmlApplicationContext.java:83) >> =A0 =A0 =A0 at com.example.main(App.java:15) >> Caused by: org.springframework.beans.factory.BeanDefinitionStoreExceptio= n: >> Factory method [public org.apache.camel.Endpoint >> org.apache.camel.component.mina.MinaComponent.createEndpoint(org.apache.= camel.component.mina.MinaConfiguration) >> throws java.lang.Exception] threw exception; nested exception is >> java.lang.NullPointerException >> =A0 =A0 =A0 at org.springframework.beans.factory.support.SimpleInstantia= tionStrategy.instantiate(SimpleInstantiationStrategy.java:127) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.ConstructorReso= lver.instantiateUsingFactoryMethod(ConstructorResolver.java:435) >> =A0 =A0 =A0 ... 17 more >> Caused by: java.lang.NullPointerException >> =A0 =A0 =A0 at org.apache.camel.util.CamelContextHelper.lookup(CamelCont= extHelper.java:152) >> =A0 =A0 =A0 at org.apache.camel.util.CamelContextHelper.mandatoryLookup(= CamelContextHelper.java:170) >> =A0 =A0 =A0 at org.apache.camel.impl.DefaultComponent.mandatoryLookup(De= faultComponent.java:315) >> =A0 =A0 =A0 at org.apache.camel.component.mina.MinaComponent.getCodecFac= tory(MinaComponent.java:360) >> =A0 =A0 =A0 at org.apache.camel.component.mina.MinaComponent.configureCo= decFactory(MinaComponent.java:213) >> =A0 =A0 =A0 at org.apache.camel.component.mina.MinaComponent.createSocke= tEndpoint(MinaComponent.java:175) >> =A0 =A0 =A0 at org.apache.camel.component.mina.MinaComponent.createEndpo= int(MinaComponent.java:109) >> =A0 =A0 =A0 at org.apache.camel.component.mina.MinaComponent.createEndpo= int(MinaComponent.java:101) >> =A0 =A0 =A0 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Metho= d) >> =A0 =A0 =A0 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodA= ccessorImpl.java:39) >> =A0 =A0 =A0 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegatin= gMethodAccessorImpl.java:25) >> =A0 =A0 =A0 at java.lang.reflect.Method.invoke(Method.java:597) >> =A0 =A0 =A0 at org.springframework.beans.factory.support.SimpleInstantia= tionStrategy.instantiate(SimpleInstantiationStrategy.java:115) >> =A0 =A0 =A0 ... 18 more >> >> if i remove the property "codec", it works. I believe it's because the >> "myCodec" bean is not already created. It is reference as a spring >> value, not as a bean reference. But i tried to add depends-on but it >> doesn't work. >> > >> Regards. >> NicolaS. >> > > --=20 Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/