当使用Spring Boot嵌入时,Apache Ignite支持我的SQL无法在客户端模式下启动-显示配置不匹配

时间:2018-10-03 12:03:53

标签: java spring spring-boot ignite

我在客户端模式下使用自定义配置启动了apache ignite服务器2.6.0(二进制发行版),并使用了具有类似配置的spring boot应用程序。尝试启动spring boot应用程序时,spring boot应用程序将错误消息显示为配置合并。下面是来自控制台的消息

Caused by: org.apache.ignite.spi.IgniteSpiException: Conflicts during configuration merge for cache 'PersonCache' :
PERSON conflict:
keyFieldName is different: local=id, received=null

您能告诉我如何解决此问题吗?当我使用具有类似配置的Spring Boot嵌入式ignite服务器和Spring Boot嵌入式客户端时,这可以按预期工作

点燃XML配置

<bean id="datasource"
    class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
    <property name="URL"
        value="jdbc:mysql://localhost:3307/ignite" />
    <property name="user" value="root" />
    <property name="password" value="*****" />
</bean>
<bean id="gridCfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="cacheConfiguration">
        <list>
            <bean
                class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name" value="PersonCache" />
                <property name="readThrough" value="true" />
                <property name="writeThrough" value="true" />
                <property name="writeBehindEnabled" value="true" />
                <property name="cacheStoreFactory">
                    <bean
                        class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
                        <property name="dataSourceBean" value="datasource" />
                        <property name="dialect">
                            <bean
                                class="org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect">
                            </bean>
                        </property>
                        <property name="types">
                            <list>
                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
                                    <property name="cacheName" value="PersonCache" />
                                    <property name="keyType" value="java.lang.Long" />
                                    <property name="valueType"
                                        value="pl.piomin.services.ignite.model.Person" />
                                    <property name="databaseSchema" value="ignite" />
                                    <property name="databaseTable" value="PERSON" />
                                    <property name="keyFields">
                                        <list>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.INTEGER" />
                                                </constructor-arg>
                                                <constructor-arg value="id" />
                                                <constructor-arg value="java.lang.Long" />
                                                <constructor-arg value="id" />
                                            </bean>
                                        </list>
                                    </property>
                                    <property name="valueFields">
                                        <list>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.VARCHAR" />
                                                </constructor-arg>
                                                <constructor-arg value="first_name" />
                                                <constructor-arg value="java.lang.String" />
                                                <constructor-arg value="firstName" />
                                            </bean>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.VARCHAR" />
                                                </constructor-arg>
                                                <constructor-arg value="last_name" />
                                                <constructor-arg value="java.lang.String" />
                                                <constructor-arg value="lastName" />
                                            </bean>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.VARCHAR" />
                                                </constructor-arg>
                                                <constructor-arg value="gender" />
                                                <constructor-arg value="java.lang.String" />
                                                <constructor-arg value="gender" />
                                            </bean>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.VARCHAR" />
                                                </constructor-arg>
                                                <constructor-arg value="country" />
                                                <constructor-arg value="java.lang.String" />
                                                <constructor-arg value="country" />
                                            </bean>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.VARCHAR" />
                                                </constructor-arg>
                                                <constructor-arg value="city" />
                                                <constructor-arg value="java.lang.String" />
                                                <constructor-arg value="city" />
                                            </bean>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.VARCHAR" />
                                                </constructor-arg>
                                                <constructor-arg value="address" />
                                                <constructor-arg value="java.lang.String" />
                                                <constructor-arg value="address" />
                                            </bean>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.DATE" />
                                                </constructor-arg>
                                                <constructor-arg value="birth_date" />
                                                <constructor-arg value="java.util.Date" />
                                                <constructor-arg value="birthDate" />
                                            </bean>
                                        </list>
                                    </property>
                                </bean>
                            </list>
                        </property>
                    </bean>
                </property>
                <property name="queryEntities">
                    <list>
                        <bean class="org.apache.ignite.cache.QueryEntity">
                            <property name="keyType" value="java.lang.Long" />
                            <property name="valueType"
                                value="pl.piomin.services.ignite.model.Person" />
                            <property name="keyFieldName" value="id" />
                            <property name="keyFields">
                                <list>
                                    <value>id</value>
                                </list>
                            </property>
                            <property name="fields">
                                <map>
                                    <entry key="id" value="java.lang.Integer" />
                                    <entry key="firstName" value="java.lang.String" />
                                    <entry key="lastName" value="java.lang.String" />
                                    <entry key="gender" value="java.lang.String" />
                                    <entry key="country" value="java.lang.String" />
                                    <entry key="city" value="java.lang.String" />
                                    <entry key="address" value="java.lang.String" />
                                    <entry key="birthDate" value="java.util.Date" />
                                </map>
                            </property>
                            <property name="indexes">
                                <list>
                                    <bean class="org.apache.ignite.cache.QueryIndex">
                                        <constructor-arg value="id"/>
                                    </bean>
                                    <bean class="org.apache.ignite.cache.QueryIndex">
                                        <constructor-arg value="firstName"/>
                                    </bean>
                                    <bean class="org.apache.ignite.cache.QueryIndex">
                                        <constructor-arg value="lastName"/>
                                    </bean>
                                </list>
                            </property>
                        </bean>
                    </list>
                </property>
            </bean>
        </list>
    </property>
    <property name="peerClassLoadingEnabled" value="true"></property>
</bean>

0 个答案:

没有答案