我使用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文件,仔细检查注释是否在那里。
任何可能导致部署错误的想法?
答案 0 :(得分:-1)
acronym
正如您所定义的那样,它是一个字段,而不是一个属性。
添加一个Getter和一个Setter,公开它们,并将注释放在getter上。