今天在学习配置高可用缓存leveldb的时候遇到问题,就是配置完文件以后发生错误,activeMQ无法启动,检查完所有的配置文件,都没有发现有明显的错误,然后去data/active.log
下面查到了错误
问题:
2020-02-11 17:08:59,463 | ERROR | Failed to load: class path resource [activemq.xml], reason: Invalid bean definition with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Could not resolve placeholder 'activemq-data' in value "${activemq-data}/leveldb"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'activemq-data' in value "${activemq-data}/leveldb" | org.apache.activemq.xbean.XBeanBrokerFactory | main
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Could not resolve placeholder 'activemq-data' in value "${activemq-data}/leveldb"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'activemq-data' in value "${activemq-data}/leveldb"
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:223)[spring-beans-4.3.24.RELEASE.jar:4.3.24.RELEASE]
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:210)[spring-beans-4.3.24.RELEASE.jar:4.3.24.RELEASE]
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)[spring-beans-4.3.24.RELEASE.jar:4.3.24.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283)[spring-context-4.3.24.RELEASE.jar:4.3.24.RELEASE]
问题解决
写错了配置文件
<persistenceAdapter>
<replicatedLevelDB
directory="${activemq-data}/leveldb"
replicas="3"
bind="tcp://0.0.0.0:63631"
zkAddress="hadoop102:2181,hadoop103:2181,hadoop103:2181"
hostname="hadoop102"
sync="local_disk"
zkPath="/activemq/leveldb-stores"
/>
</persistenceAdapter>
.<persistenceAdapter>
<replicatedLevelDB
directory="${activemq.data}/leveldb"
replicas="3"
bind="tcp://0.0.0.0:0"
zkAddress="localhost:2181,localhost:2182,localhost:2183"
zkPath="/usr/local//activemq/leveldb-stores"
hostname="localhost"
/>
</persistenceAdapter>
directory="${activemq.data}/leveldb"
中间应该是一个.而不是-
问题出现原因
直接从官网上拿下来的,忘记改了,官网上就是-,下次要细心一些。