我在我的项目中使用ZeroC Ice。我对以下异常有问题:
com.zeroc.Ice.NoValueFactoryException
reason = "no value factory found and compact format prevents slicing (the sender should use the sliced format instead)"
type = "::test::DataExt"
at com.zeroc.Ice.InputStream$EncapsDecoder11.skipSlice(InputStream.java:3120)
at com.zeroc.Ice.InputStream$EncapsDecoder11.readInstance(InputStream.java:3333)
at com.zeroc.Ice.InputStream$EncapsDecoder11.readValue(InputStream.java:2881)
at com.zeroc.Ice.InputStream.readValue(InputStream.java:1933)
at org.megacinol.test.DataListHelper.read(DataListHelper.java:48)
at org.megacinol.test.TestClass._iceD_testSth(TestClass.java:58)
at org.megacinol.test.TestClass._iceDispatch(TestClass.java:106)
at com.zeroc.IceInternal.Incoming.invoke(Incoming.java:221)
at com.zeroc.Ice.ConnectionI.invokeAll(ConnectionI.java:2706)
at com.zeroc.Ice.ConnectionI.dispatch(ConnectionI.java:1292)
at com.zeroc.Ice.ConnectionI.message(ConnectionI.java:1203)
at com.zeroc.IceInternal.ThreadPool.run(ThreadPool.java:412)
at com.zeroc.IceInternal.ThreadPool.access$500(ThreadPool.java:7)
at com.zeroc.IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:781)
at java.base/java.lang.Thread.run(Thread.java:830)
我的切片文件如下:
[["underscore"]]
[["java:package:org.megacinol"]]
module test
{
class Data
{
string name;
string profession;
}
["java:serializable:temp.Player"]
sequence<byte> Player;
class DataExt extends Data
{
Player player;
}
["java:type:java.util.ArrayList<Data>"] sequence<Data> DataList;
interface TestClass
{
void testSth(DataList data);
}
}
经过一些实验和调试,我发现,删除
[["java:package:org.megacinol"]]
解决了问题。
我可以用嵌套的模块声明来替换这个元数据,但我更愿意坚持元数据方法。
有其他办法解决这个问题吗?
您需要使用文档中解释的Ice.Package.
配置属性对此进行配置
因此,对于您的样本,您需要设置配置属性
Ice.Package.test=org.megacinol