繁体   English   中英

Gemfire配置问题

[英]Gemfire configuration issues

我有一个xml配置文件,用于设置gemfire,如下所示

<?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:gfe="http://www.springframework.org/schema/gemfire"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd 
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:component-scan
        base-package="com.mycompany.data.testcache" />
    <context:annotation-config />

    <util:properties id="props" location="classpath:test-cache.properties">
        <prop key="log-level">info</prop>
    </util:properties>

    <gfe:cache id="gemfire-cache" properties-ref="props" />

    <gfe:local-region id="region1">
        <gfe:cache-listener ref="listener" />
    </gfe:local-region>

    <bean id="listener"
        class="com.mycompany.data.TestLoggingCacheListener" />
</beans>

当我尝试加载此配置文件时,我看到以下异常..

org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)引起:org.springframework.beans.factory.BeanCreationException:创建名为'region1'的bean时出错:无法解析对bean的引用' gemfireCache'设置bean属性'cache'; 嵌套异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:在org.springframework.beans.factory的org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)中没有定义名为'gemfireCache'的bean。 .support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory .java:1118)org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)at org。 springframework.beans.factory.support.Abstract BeanFactory $ 1.getObject(AbstractBeanFactory.java:294)org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java) :291)org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)org.springframework上的org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)。 context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader。 java:103)at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextL) orader.java:1)org.springframework上的org.springframework.test.context.utext.TeringContextLoader.loadContext(DelegatingSmartContextLoader.java:228)org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124) .test.context.TestContext.getApplicationContext(TestContext.java:148)... 24更多引起:

org.springframework.beans.factory.NoSuchBeanDefinitionException:在org.springframework.beans.factory.support的org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)中没有定义名为'gemfireCache'的bean。位于org.springframework.beans.factory.support.AbstractBeanFactory.getBean的Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)中的AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)(AbstractBeanFactory.java: 193)at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)... 41更多

当我从中删除id属性时

<gfe:cache id="gemfire-cache" properties-ref="props" />

然后给

<gfe:cache properties-ref="props" />

它工作正常。 当我指定id属性时,它会抛出任何人请帮助我

如果对gfe:cache元素使用id属性,则必须使用cache-ref属性来引用它:

<gfe:cache id="gemfire-cache" properties-ref="props" />

<gfe:local-region id="region1" cache-ref="gemfire-cache">
    <gfe:cache-listener ref="listener" />
</gfe:local-region>

否则,使用默认ID,即“gemfireCache”(这就是您在错误消息中看到“gemfireCache”的原因)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM