来自Coherence的奇怪错误:"必须为属性指定POF索引..."

时间:2016-02-04 15:59:08

标签: java caching oracle-coherence

我使用Coherence注释@PortableProperty来注释缓存对象以进行POF序列化。例如:

@Portable
public class Product implements Comparable<Product> {

    @PortableProperty(0)
    private String acronym;

    // other properties and getters/setters ...
}

pof-config看起来像这样:

<?xml version="1.0"?>
<pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
    xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config
    http://xmlns.oracle.com/coherence/coherence-pof-config/1.2/coherence-pof-config.xsd">

    <user-type-list>
        <!-- include all "standard" Coherence POF user types -->
        <include>coherence-pof-config.xml</include>

        <user-type>
            <type-id>1001</type-id>
            <class-name>
                com.xyz.Product
            </class-name>
        </user-type>

        <!-- More user-type definitions -->

    </user-type-list>
</pof-config>

当服务器管理员尝试部署我的GAR时,他收到以下错误:

An error occurred during activation of changes, please see the log for details. (Wrapped) (Wrapped: error creating class "com.tangosol.io.pof.ConfigurablePofContext") A POF Index must be specified for the property com.xyz.Product#acronym by specifying within the annotation or enabling autoIndexing on the Portable annotation

但是acronym属性用索引(0)注释的。我甚至从GAR反编译了.class文件,仔细检查注释是否在那里。

任何可能导致部署错误的想法?

1 个答案:

答案 0 :(得分:-1)

acronym正如您所定义的那样,它是一个字段,而不是一个属性。

添加一个Getter和一个Setter,公开它们,并将注释放在getter上。