You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Joel Lang (JIRA)" <ji...@apache.org> on 2018/07/19 15:25:00 UTC

[jira] [Comment Edited] (IGNITE-9031) SpringCacheManager throws AssertionError during Spring initialization

    [ https://issues.apache.org/jira/browse/IGNITE-9031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16549421#comment-16549421 ] 

Joel Lang edited comment on IGNITE-9031 at 7/19/18 3:24 PM:
------------------------------------------------------------

[~aakhmedov] you described the setup I have. Ignite is being started inside of a host application which creates more than one {{ApplicationContext}}. This isn't Spring MVC.

This host application first creates a {{FileSystemXmlApplicationContext}} using root-app-context.xml, which imports ignite.xml.

Later it creates another {{ClassPathXmlApplicationContext}} using extensions.xml which uses the previously created context as its parent. This is the line in the stack trace when the assertion happens. This should be the root cause.

I can post a stripped-down version of the root-app-context.xml and ignite.xml:

*root-app-context.xml:*
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">

    <bean id="appProperties" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>cluster.properties</value>
            </list>
        </property>
        <property name="ignoreResourceNotFound" value="true" />
    </bean>
    
    <!-- other beans here -->
    
    <import resource="classpath:ignite.xml"/>
</beans>
{code}
*ignite.xml:*
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
       http://www.springframework.org/schema/util
       http://www.springframework.org/schema/util/spring-util-4.3.xsd">

    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <!-- other settings here -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="localPort" value="${ignite.disc.port}"/>
                <property name="localPortRange" value="${ignite.disc.portrange}"/>
                <property name="ipFinder">
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <bean class="org.springframework.util.StringUtils" factory-method="commaDelimitedListToSet">
                                <constructor-arg type="java.lang.String" value="${ignite.disc.nodes}"/>
                            </bean>
                        </property>
                    </bean> 
                </property> 
            </bean> 
        </property>
        <property name="communicationSpi">
            <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
                <property name="localPort" value="${ignite.comm.port}"/>
                <property name="localPortRange" value="${ignite.comm.portrange}"/>
            </bean>
        </property>
        <!-- other settings here -->
    </bean>

    <bean id="ignite" class="org.apache.ignite.IgniteSpringBean">
        <property name="configuration" ref="ignite.cfg"/>
    </bean>

    <bean id="cacheManager" class="org.apache.ignite.cache.spring.SpringCacheManager" lazy-init="true"/>
</beans>
{code}


was (Author: langj):
[~aakhmedov] you described the setup I have. Ignite is being started inside of a host application which creates more than one {{ApplicationContext}}. This isn't Spring MVC.

This host application first creates a {{FileSystemXmlApplicationContext}} using root-app-context.xml, which imports ignite.xml.

Later it creates another {{ClassPathXmlApplicationContext}} using extensions.xml which uses the previously created context as its parent. This is the line in the stack trace when the assertion happens. This would be the root cause.

I can post a stripped-down version of the root-app-context.xml and ignite.xml:

*root-app-context.xml:*
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">

    <bean id="appProperties" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>cluster.properties</value>
            </list>
        </property>
        <property name="ignoreResourceNotFound" value="true" />
    </bean>
    
    <!-- other beans here -->
    
    <import resource="classpath:ignite.xml"/>
</beans>
{code}
*ignite.xml:*
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
       http://www.springframework.org/schema/util
       http://www.springframework.org/schema/util/spring-util-4.3.xsd">

    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <!-- other settings here -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="localPort" value="${ignite.disc.port}"/>
                <property name="localPortRange" value="${ignite.disc.portrange}"/>
                <property name="ipFinder">
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <bean class="org.springframework.util.StringUtils" factory-method="commaDelimitedListToSet">
                                <constructor-arg type="java.lang.String" value="${ignite.disc.nodes}"/>
                            </bean>
                        </property>
                    </bean> 
                </property> 
            </bean> 
        </property>
        <property name="communicationSpi">
            <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
                <property name="localPort" value="${ignite.comm.port}"/>
                <property name="localPortRange" value="${ignite.comm.portrange}"/>
            </bean>
        </property>
        <!-- other settings here -->
    </bean>

    <bean id="ignite" class="org.apache.ignite.IgniteSpringBean">
        <property name="configuration" ref="ignite.cfg"/>
    </bean>

    <bean id="cacheManager" class="org.apache.ignite.cache.spring.SpringCacheManager" lazy-init="true"/>
</beans>
{code}

> SpringCacheManager throws AssertionError during Spring initialization
> ---------------------------------------------------------------------
>
>                 Key: IGNITE-9031
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9031
>             Project: Ignite
>          Issue Type: Bug
>          Components: spring
>    Affects Versions: 2.6
>            Reporter: Joel Lang
>            Assignee: Amir Akhmedov
>            Priority: Major
>
> When initializing Ignite using an IgniteSpringBean and also having a SpringCacheManager defined, the SpringCacheManager throws an AssertionError in the onApplicationEvent() method due to it being called more than once.
> There is an "assert ignite == null" that fails after the first call.
> This is related to the changes in IGNITE-8740. This happened immediately when I first tried to start Ignite after upgrading from 2.5 to 2.6.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)