从1.7升级到2.3后,Ignite抛出异常

时间:2017-12-11 03:00:19

标签: java spring ignite

异常是: Ignite Discovery SPI实现不支持节点排序,不能与缓存一起使用(使用带有DiscoverySpiOrderSupport注释的SPI,如TcpDiscoverySpi)

<bean id="igniteConfig" class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="cacheConfiguration">
        <util:list>
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name" value="rateLimitterBuckets" />
                <property name="cacheMode" value="REPLICATED" />
                <property name="rebalanceMode" value="SYNC" />
                <property name="expiryPolicyFactory">
                    <bean class="javax.cache.configuration.FactoryBuilder.SingletonFactory">
                        <constructor-arg>
                            <bean class="javax.cache.expiry.TouchedExpiryPolicy">
                                <constructor-arg>
                                    <bean class="javax.cache.expiry.Duration">
                                        <constructor-arg value="DAYS" />
                                        <constructor-arg value="1" />
                                    </bean>
                                </constructor-arg>
                            </bean>
                        </constructor-arg>
                    </bean>
                </property>
                <property name="eagerTtl" value="true" />
            </bean>
        </util:list>
    </property>

    <property name="gridLogger">
        <bean class="org.apache.ignite.logger.log4j.Log4JLogger" />
    </property>

    <property name="includeEventTypes">
        <list>
            <util:constant static-field="org.apache.ignite.events.EventType.EVT_CLIENT_NODE_DISCONNECTED" />
            <util:constant static-field="org.apache.ignite.events.EventType.EVT_CLIENT_NODE_RECONNECTED" />
        </list>
    </property>

    <property name="metricsLogFrequency" value="3600000" />

    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <property name="ipFinder">
                <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                    <property name="addresses">
                        <list>
                            <value>127.0.0.1:47500..47509</value>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </property>
</bean>

我确实使用TcpDiscoverySpi。我检查了标有@DiscoverySpiOrderSupport(true)注释的来源。

但仍有例外。因此问题是:如何解决这个问题?

UPD 1 :添加堆栈跟踪(我删除了无关的部分 - 我有几个bean依赖于Ignite,所以它们因为这个异常而无法创建)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ignite' defined in class path resource [farm-connection-ignite.xml]: Invocation of init method failed; nested exception is class org.apache.ignite.IgniteCheckedException: Discovery SPI implementation does not support node ordering and cannot be used with cache (use SPI with @DiscoverySpiOrderSupport annotation, like TcpDiscoverySpi)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 76 more
Caused by: class org.apache.ignite.IgniteCheckedException: Discovery SPI implementation does not support node ordering and cannot be used with cache (use SPI with @DiscoverySpiOrderSupport annotation, like TcpDiscoverySpi)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.initializeDefaultCacheConfiguration(IgnitionEx.java:2234)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.initializeConfiguration(IgnitionEx.java:2179)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1678)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1652)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1080)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:578)
    at org.apache.ignite.IgniteSpring.start(IgniteSpring.java:66)
    at org.apache.ignite.IgniteSpringBean.afterPropertiesSet(IgniteSpringBean.java:160)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 92 more

1 个答案:

答案 0 :(得分:0)

好吧看来它不是一个罐子地狱,我检查了类路径。

这是一个Spring Context AOP地狱,当Spring用代理程序包装bean时。代理没有注释。因此IgniteUtils.discoOrdered看不到那些。 在我的应用程序上下文xml配置中我有

<bean id="facadeMonitoringAdvisor" class="net.bull.javamelody.MonitoringSpringAdvisor">
    <property name="pointcut">
        <bean class="org.springframework.aop.support.JdkRegexpMethodPointcut">
            <property name="pattern" value=".*Impl.*" />
            <property name="excludedPattern" value=".*PerfSens.*" />
        </bean>
    </property>
</bean> 

现在有趣的问题是:

  • 为什么它在1.7.0中有效。必须有一些能够与代理一起使用的代码。
  • 为什么它甚至影响TcpDiscoverySpi bean,模式显然不应该匹配TcpDiscoverySpi

如果我发现更多,我会更新这个答案。