2016-02-04 20 views
0

我正在使用Coherence注释@PortableProperty注释用于POF序列化的缓存对象。例如:来自Coherence的奇怪错误:“必须为属性指定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文件来仔细检查注释是否存在。

任何想法会导致部署错误?

+0

请分享您的pof-config.xml –

+0

@ArkadiyVerman,我用我的pof-config –

+0

更新了问题,看不到您的定义有任何问题,它在我的程序中看起来是一样的。我唯一可以建议的是验证您的配置标志,特别是Dtangosol.pof.config。 –

回答

-1

acronym因为您已经定义它是一个字段,而不是属性。

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

+0

它已经有一个getter和setter。我会尝试移动注释,但Coherence文档(https://docs.oracle.com/middleware/1212/coherence/COHDG/api_pof.htm#COHDG5590)明确指出:“@PortableProperty - 标记成员变量或方法访问器作为POF序列化属性。“ –

+0

这个answear很简单,不正确。您不需要POF序列化的getter/setter。即使你拥有它们,如果注释放在字段而不是getter上,它们也会被序列化程序忽略。 –

相关问题