Announcement Announcement Module
Collapse
No announcement yet.
SI 2.1.1 Release - Error in aggregator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SI 2.1.1 Release - Error in aggregator

    I have defined aggregator using the following code
    Code:
    <aggregator input-channel="filteredChannel"
                    output-channel="aggregatedChannel"
                    message-store="persistentMessageStore"
                    correlation-strategy="aggregator"
                    correlation-strategy-method="getCorrelationKey"
                    ref="aggregator"
                    method="aggregate"
                    release-strategy="aggregator"
                    release-strategy-method="canRelease"
                    send-partial-result-on-expiry="true"
                    send-timeout="300000"
                    expire-groups-upon-completion="true" >
    </aggregator>

    I was using SI 2.0 successfully except that I didn't had
    expire-groups-upon-completion="true"
    However when I upgraded to 2.1.1 I started getting the following error


    Caused By: org.springframework.beans.PropertyBatchUpdateExcep tion; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationExceptio n: Property 'expireGroupsUponCompletion' threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:1 02)
    at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:5 8)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1393)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1118)
    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 94)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:464)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:93)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:513)
    at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:147)
    at org.springframework.beans.factory.support.SimpleIn stantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:110)
    at org.springframework.beans.factory.support.Construc torResolver.autowireConstructor(ConstructorResolve r.java:280)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:1035)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:939)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:485)
    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 94)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:464)
    at org.springframework.context.access.ContextSingleto nBeanFactoryLocator.initializeDefinition(ContextSi ngletonBeanFactoryLocator.java:143)
    at org.springframework.beans.factory.access.Singleton BeanFactoryLocator.useBeanFactory(SingletonBeanFac toryLocator.java:381)



    Thanks,
    Murali

  • #2
    Hello

    Can you debug it?
    Which line of this method:
    Code:
    public void setExpireGroupsUponCompletion(boolean expireGroupsUponCompletion) {
    		this.expireGroupsUponCompletion = expireGroupsUponCompletion;
    		if (expireGroupsUponCompletion) {
    			Iterator<MessageGroup> messageGroups = this.messageStore.iterator();
    			while (messageGroups.hasNext()) {
    				MessageGroup messageGroup = messageGroups.next();
    				if (messageGroup.isComplete()) {
    					remove(messageGroup);
    				}
    			}
    		}
    	}
    Throws NPE?

    Cheers,
    Artem Bilan

    Comment


    • #3
      The error is strange and is coming from Spring (not Spring Integration).
      Having said that it would be nice if you explain how to reproduce it since I just tried your identical configuration with SI 2.1.1 and it works perfectly fine.
      If you can attach a zip file with the test reproducing it or explain the steps needed to reproduce it.
      Thanks

      Comment


      • #4
        Also, looking at the javadocs for setPropertyValue it states:
        Code:
        * @throws PropertyAccessException if the property was valid but the
        * accessor method failed or a type mismatch occured
        So obviously there are two reasons where this exception can happen.
        1. Wrong type which i seriously doubt since you clearly setting it to 'true'
        2. Failure of the setter method (the one Artem included earlier)

        Looking at the method further I wonder what implementation of MessageStore you are using. Is it custom or one provided by SI?
        I am assuming its custom since the only place I can see this method can result in exception is inside of the 'while' loop when it deals with iterator which may not be properly implemented.
        For example; You'll get NPE if this results in null
        Code:
        Iterator<MessageGroup> messageGroups = this.messageStore.iterator();
        Non of SI implementation fo MS will return null on iterator() call

        Comment


        • #5
          Oleg, Murali,

          I think NPE may happen somewhere deeper in the MS on the invocation of messageStore.removeMessageGroup. E.g. Messages were added to MS from previous version of SI and right now they don't have some critical properties.

          Oleg, especially for you and all team:
          Maybe we should avoid similar logic in the "setters" and move it into onInit()...
          Right now it's difficult to guess what's going on.
          "setters" must just follow with POJO specification, except to add some value checks.
          IMHO.

          Artem

          Comment


          • #6
            In fact I was just able to reproduce the exact same error by simply providing custom implementation of MessageStore that returns 'null' from the iterator() method.
            Code:
            Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
            PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'expireGroupsUponCompletion' threw exception; nested exception is java.lang.NullPointerException
            	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
            	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
            	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
            	... 14 more

            Comment


            • #7
              Artem. I would agree with you, but the reason for this logic to be there is because this value can change at runtime and therefore we need to make sure it applies to every group. So its an exception to the rule, but we can talk about it offline Let's make sure we get some answers from the reporter first.

              Comment


              • #8
                Thank you so much for the the prompt replies. I have debugged the code and found that the error was thrown from somewhere in the line

                SimpleMessageGroup messageGroup = new SimpleMessageGroup(messages, groupId, timestamp, complete); Line 390 in JdbcMessageStore.java

                I removed all the old messages and message groups from the DB and then deployment worked ok. In fact the tables were dropped and created so should not have any old messages on there(but I am not too sure whether the application was working with older or newer version of the SI). After I cleared the messages I was able to deploy the application again.

                Thanks
                Murali

                Comment


                • #9
                  Originally posted by Cleric View Post
                  Oleg, Murali,

                  I think NPE may happen somewhere deeper in the MS on the invocation of messageStore.removeMessageGroup. E.g. Messages were added to MS from previous version of SI and right now they don't have some critical properties.

                  Oleg, especially for you and all team:
                  Maybe we should avoid similar logic in the "setters" and move it into onInit()...
                  Right now it's difficult to guess what's going on.
                  "setters" must just follow with POJO specification, except to add some value checks.
                  IMHO.

                  Artem
                  I agree your opinion on setters and onInit

                  Comment

                  Working...
                  X