我是gemfire的新手,我无法用它启动我的应用程序。
我得到的错误是
[info 2015/05/22 10:55:39.746 BRT <localhost-startStop-1> tid=0xf] Marking DistributionManager <v0>:17758 as closed.
10:55:40.922 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gfPool': Invocation of init method failed; nested exception is com.gemstone.gemfire.pdx.PdxInitializationException: The PDX metadata has already been created as a peer metadata region. Please create your pools first
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:743) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728) [catalina.jar:8.0.21]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166) [catalina.jar:8.0.21]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.21]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [catalina.jar:8.0.21]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [catalina.jar:8.0.21]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: com.gemstone.gemfire.pdx.PdxInitializationException: The PDX metadata has already been created as a peer metadata region. Please create your pools first
at com.gemstone.gemfire.pdx.internal.PeerTypeRegistration.creatingPool(PeerTypeRegistration.java:501) ~[gemfire-8.0.0.jar:?]
at com.gemstone.gemfire.pdx.internal.TypeRegistry.creatingPool(TypeRegistry.java:273) ~[gemfire-8.0.0.jar:?]
at com.gemstone.gemfire.internal.cache.PoolFactoryImpl.create(PoolFactoryImpl.java:439) ~[gemfire-8.0.0.jar:?]
at org.springframework.data.gemfire.client.PoolFactoryBean.afterPropertiesSet(PoolFactoryBean.java:172) ~[spring-data-gemfire-1.6.0.RELEASE.jar:1.6.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
... 21 more
这是我的配置
的GemFire-context.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:gfe="http://www.springframework.org/schema/gemfire"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire-1.2.xsd">
<gfe:client-cache id="gemfireClientCache"
cache-xml-location="classpath:client.xml" pool-name="gfPool" use-bean-factory-locator="false" />
<gfe:pool id="gfPool" max-connections="10">
<gfe:locator host= "127.0.0.1" port="9980" />
</gfe:pool>
<gfe:lookup-region id="myRegion" name="myRegion" cache-ref="gemfireClientCache" />
</beans>
这是Client.xml
<pdx read-serialized="false">
<pdx-serializer>
<class-name>com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer</class-name>
<parameter name="classes">
<string>br.com.xxx.*</string>
</parameter>
<parameter name="check-portability">
<string>true</string>
</parameter>
</pdx-serializer>
</pdx>
<region name="myRegion">
<region-attributes refid="PROXY" />
</region>
我的applicationContext.xml
<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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<!-- Use this configuration to test locally -->
<gfe:cache id="gemfireCache" pdx-persistent="true"/>
<gfe:partitioned-region id="myRegion" data-policy="PARTITION"/>
<import resource="classpath:registry-gemfire-context.xml"/>
<import resource="classpath:br/com/xxx/context.xml"/>
<context:component-scan base-package="br.com.xxx.*"/>
<bean id="string" class="java.lang.String"/>
</beans>
答案 0 :(得分:1)
您可以尝试在Spring中配置Client.xml中的内容。
答案 1 :(得分:1)
同意,错误消息可能不是那么有用,但这是一个特定于GemFire的异常(即PdxInitializationException)和错误消息。
另外,这里有一些提示......
通过这种方式,任何客户端区域将自动在您的配置中自动分配1和唯一的池,正如@dturanski所述,您提供了原生GemFire XML配置并定义您的客户区域,因此...
<gfe:client-region id="myRegion" shortcut="PROXY"/>
然后“myRegion”自动与ClientCache和客户端池相关联。
您也不需要在服务器端PARTITION Region上显式设置DataPolicy ......
由于&lt; gfe: partitioned-region &gt;如果持久性属性设置为 true (默认为 false ),则意味着PARTITION(即它是多余的)。
您还可以使用该元素在ClientCache上定义PDX序列化。有关详细信息,请参阅XML namespace。
最后,当您在服务器端的Spring配置中做正确的事情时,明确声明&lt; context:component-scan&gt;在GemFire配置之后的元素,请务必继续这样做,否则当您的用例和需求增长时,您可能会遇到意外行为,特别是如果您正在注入区域,比如DAO(而不是使用{{3}例如,抽象)。
事实上,将GemFire配置与您的应用程序配置完全分开并依赖于您已完成的导入可能更明智
registry-gemfire-context.xml,以及...... BR / COM / XXX / context.xml中
GemFire是一种复杂的动物,因此保持封装,组织和简单是GemFire成功的关键。
希望这会有所帮助;干杯!
答案 2 :(得分:0)
知道了。
问题是applicationContext.xml上的区域名称有一个拼写错误(小写字母)因此没有创建该区域,之后我尝试将其添加到池中。
无论如何,这个错误信息太可怕了......也许与丢失区域有关的东西会有很大帮助。
希望它可以帮助别人。