将 Zeroc Ice 与 java 一起使用时出现 NoValueFactoryException
NoValueFactoryException when using Zeroc Ice with java
我在我的项目中使用 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.access0(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.
配置 属性 进行配置,如 documentation
中所述
因此对于您的示例,您需要设置配置 属性
Ice.Package.test=org.megacinol
我在我的项目中使用 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.access0(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.
配置 属性 进行配置,如 documentation
因此对于您的示例,您需要设置配置 属性
Ice.Package.test=org.megacinol