2
我有以下idl結構。我想用opendds發佈它從OpenDDS發佈者傳遞複雜結構
#pragma DCPS_DATA_TYPE "B::CData"
#pragma DCPS_DATA_KEY "B::CData id"
module B {
struct Quote {
string skit_name;
string episode_name;
string line;
};
struct CData{
long id;
Quote payload;
};
};
我已經在java中編寫了發佈者和訂閱者。但在發佈和訂閱上述主題JVM崩潰時。
任何人都有這個想法?
下面是一個公衆話題
public static void main(String[] args) {
DomainParticipantFactory dpf =
TheParticipantFactory.WithArgs(new StringSeqHolder(args));
if (dpf == null) {
System.err.println ("Domain Participant Factory not found");
return;
}
final int DOMAIN_ID = 42;
DomainParticipant dp = dpf.create_participant(DOMAIN_ID,
PARTICIPANT_QOS_DEFAULT.get(), null, DEFAULT_STATUS_MASK.value);
if (dp == null) {
System.err.println ("Domain Participant creation failed");
return;
}
CDataTypeSupportImpl servant = new CDataTypeSupportImpl();
if (servant.register_type(dp, "") != RETCODE_OK.value) {
System.err.println ("register_type failed");
return;
}
Topic top = dp.create_topic("data",
servant.get_type_name(),
TOPIC_QOS_DEFAULT.get(), null,
DEFAULT_STATUS_MASK.value);
Publisher pub = dp.create_publisher(
PUBLISHER_QOS_DEFAULT.get(),
null,
DEFAULT_STATUS_MASK.value);
DataWriter dw = pub.create_datawriter(
top, DATAWRITER_QOS_DEFAULT.get(), null, DEFAULT_STATUS_MASK.value);
CDataDataWriter mdw = CDataDataWriterHelper.narrow(dw);
CData cData=new CData();
int handle = mdw.register(cData);
// above statement crashes the jvm
int ret = mdw.write(msg, handle);
}
我想象不到 - 因爲你沒有真正顯示任何相關的代碼,或者它是如何崩潰的...... – Nim 2014-10-09 13:47:54
也肯定證實 - JVM崩潰了嗎? – Nim 2014-10-09 13:48:52
通常,JVM崩潰是JVM錯誤(除非您的DDS提供者正在使用JNI)。你可以嘗試另一個JRE嗎?哪個DDS提供者會發生這種情況? – 2014-10-09 13:51:54