2

我正在使用 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名称为“”的 bean 时出错:方法调用失败;嵌套异常是: : 属性值部分中的无效字符 ':'pearlSessionFactoryhibernate-spring.xmlinitorg.hibernate.cache.CacheExceptionjavax.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>

我不知道为什么treecache-optimistic.xml不能处理属性文件:-(

谢谢佐尔坦

4

0 回答 0