Announcement Announcement Module
Collapse
No announcement yet.
getting error in the constructor arguemement..!1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • getting error in the constructor arguemement..!1

    HI ,

    I am using the below xml tag in the configuration file ....
    Code:
    <bean id="timeout"
    		class="org.springframework.integration.aggregator.TimeoutCountSequenceSizeReleaseStrategy">
    		<constructor-arg name="threshold" value="1000" />
    		<constructor-arg name="timeout" value="7000" />
    	</bean>
    I am using IBM RAD ver 7 for developing the application but when I write the above tag I got the compilation error in the constructor arguement name and it doesn't accept the name parameter..!!


    NFO: Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@66146614: defining beans [org.springframework.beans.factory.config.PropertyP laceholderConfigurer#0,jmsQueueWriteConnectionFact ory,jmsQueueReadConnectionFactory,mqConnectionFact ory,odsRequestQueue_dev1,org.springframework.integ ration.internalDefaultConfiguringBeanFactoryPostPr ocessor,input,org.springframework.integration.jms. JmsSendingMessageHandler#0,channel-to-mq,aggregator-input-channel_1,aggregator-input-channel_2,org.springframework.integration.aggregat or.CorrelatingMessageHandler#0,aggregator_1,org.sp ringframework.integration.aggregator.CorrelatingMe ssageHandler#1,aggregator_2,sampleAggregator,corre lationBean,releaseStrategyBean,org.springframework .integration.file.config.FileWritingMessageHandler FactoryBean#0,org.springframework.integration.conf ig.ConsumerEndpointFactoryBean#0,org.springframewo rk.integration.file.config.FileWritingMessageHandl erFactoryBean#1,org.springframework.integration.co nfig.ConsumerEndpointFactoryBean#1,aggregator-output-channel_1,aggregator-output-channel_2,scheduler,org.springframework.scheduling .support.MethodInvokingRunnable#0,org.springframew ork.scheduling.support.MethodInvokingRunnable#1,or g.springframework.scheduling.config.ScheduledTaskR egistrar#0,reaper1,reaper2,timeout,messageStore1,m essageStore2,org.springframework.scheduling.suppor t.PeriodicTrigger#0,defaultPoller,nullChannel,erro rChannel,_org.springframework.integration.errorLog ger,taskScheduler,org.springframework.integration. config.IdGeneratorConfigurer#0]; root of factory hierarchy
    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.integration.aggregator.Correl atingMessageHandler#0': Cannot create inner bean '(inner bean)' of type [org.springframework.integration.config.ReleaseStra tegyFactoryBean] while setting bean property 'releaseStrategy'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)#2': Cannot resolve reference to bean 'timeout' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'timeout' defined in class path resource [spring-config_21Nov.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveInnerBean(BeanDefinitio nValueResolver.java:281)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:125)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 93)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:290 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)

  • #2
    Constructor arguments don't have names (this is also clearly explained in the reference guide). I suggest a read of the di especially the constructor based, section.

    Comment


    • #3
      @Marten,

      Actually 'name' is supported as a hint (when compiled with debug symbols). It is useful when you have a constructor with multiple parameters of the same type and, generally, for documentation purposes. Notice that the exception even suggests using name as a hint.

      In this case, the issue is probably that TimeoutCountSequenceSizeReleaseStrategy doesn't have a matching constructor (like the exception says).

      @SARAL: Look at the constructor(s).

      If you still can't figure it out; post the construtor(s) here.

      Comment


      • #4
        Well that is true however if you want a foolproof solution you shouldn't use name in constructor arguments... In general using index (at least in my experience) and/or type is a better alternative which will work with or without debug symbols. (That is also the reason why I always specify the name attribute on @RequestParam because it should work regardless of debug symbols, but all of that is IMHO of course

        Comment


        • #5
          Gary Russell


          @SARAL: Look at the constructor(s).

          If you still can't figure it out; post the construtor(s) here.
          Hi Gary,

          I have done it successfully , it was the issue of jars , I have put the jar in the classpath , the jar related to aggregator one..!! Thanks a lot..!!

          Comment


          • #6
            @Saral,
            What version of Spring and Spring integration are you using? This does works fine for me.

            @Gary

            Hi Gary,
            This is the constructor
            Code:
            /**
            	 * @param threshold the number of messages to accept before releasing
            	 * @param timeout the timeout for the release in milliseconds
            	 */
            	public TimeoutCountSequenceSizeReleaseStrategy(int threshold, long timeout) {
            		this.threshold = threshold;
            		this.timeout = timeout;
            	}

            Comment


            • #7
              Originally posted by Amol Nayak View Post
              @Saral,
              What version of Spring and Spring integration are you using? This does works fine for me.

              @Gary

              Hi Gary,
              This is the constructor
              Code:
              /**
              	 * @param threshold the number of messages to accept before releasing
              	 * @param timeout the timeout for the release in milliseconds
              	 */
              	public TimeoutCountSequenceSizeReleaseStrategy(int threshold, long timeout) {
              		this.threshold = threshold;
              		this.timeout = timeout;
              	}
              Originally posted by Amol Nayak View Post
              @Saral,
              What version of Spring and Spring integration are you using? This does works fine for me.
              Hi Amol,

              I am using spring integration version 2.0.5 and spring 3.0.6, It initially works fine in eclipse 3.7 INDIGO but In IBM RAD Ver 7 , it shows some jars issuse that i have added in classpath explicitly and it is working fine..!! thnks

              Comment

              Working...
              X