我用的是Jboss 4,hibenate,spring和treecache。由于我们有不同的环境,我想将集群信息存储在一个单独的属性文件中,并引用treecache xml文件中的内容。我复制了
treecache-optimistic.xml
\jboss-4.2.0.GA\server\Pearl\conf
并在中设置属性
\jboss-4.2.0.GA\server\Pearl\deploy\properties-service.xml
<attribute name="Properties">
cluster.name=CluterName
cluster.ip=228.1.3.1
cluster.port=48866
</attribute>
我试图在treecache-optimistic.xml中引用它,如下所示:
<attribute name="ClusterName">${cluster.name}</attribute>
在启动实例之后,我通过JMX发现集群的名称是
${cluster.name}
ClusterName
). 我以为它找不到属性,但如果我把引用改为
<attribute name="ClusterName">${cluster.name:DefaultValue}</attribute>
然后我得到以下错误:
ServletRequestScopeFilter
org.springframework.beans.factory.BeanCreationException
pearlSessionFactory
hibernate-spring.xml
]:调用
init
方法失败;嵌套异常为
org.hibernate.cache.CacheException
:
javax.management.MalformedObjectNameException
:属性值部分中的字符“:”无效
hibernate属性由spring配置:
<!-- Database Property -->
<bean id="hibernatePropertiesPearl"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.TreeCacheProvider</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.max_fetch_depth">0</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
我不知道为什么
无法处理属性文件:-(
谢谢
佐尔坦