Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sequence of structs

2 views
Skip to first unread message

Dmitri Khrapov

unread,
Apr 26, 2001, 10:33:48 AM4/26/01
to
Hello!
I'm doing now some tests with CORBA & JAVA and would be very grateful if
somebody answered my question:
What is the proper Java way to pass a sequence of structs as a return value?
My IDL:

module Module1
{
typedef struct R
{
long N;
} Rage;
typedef sequence<Rage> RS;
interface Interface1
{
RS operation1();
};
};

My server implementation:

public R[] operation1()
{
R[] r = new R[10];
for (int i=0; i<10; i++)
{
r[i].N=i;
}
return r;
}

My client:
....
R[] r = I.operation1();
for (int i=0; i<r.length; i++)
{
System.out.println(r[i].N);
}

Everything compiles fine, but at the runtime an exception is raised:
org.omg.CORBA.UNKNOWN: minor code: 0 completed: No
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at com.inprise.vbroker.orb.SE.read(SE.java:28)
at com.inprise.vbroker.orb.DelegateImpl.handleReply(DelegateImpl.java:622)
at com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:552)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:294)
at recursive.Module1._Interface1Stub.operation1(_Interface1Stub.java:41)
at recursive.Client.main(Client.java:30)

The above was logged when using Visibroker for Java 4.01. The same error
also occured with JacORB 1.3.21.

Thanks in advance.

Dmitri Khrapov
CND
di...@cnd.ru


Randy

unread,
Apr 26, 2001, 7:59:22 PM4/26/01
to
Well, the obvious problem is that the ORB is unable to construct an object.
Exactly which object (the sequence itself or one of the objects within it) is
not so simple a question to answer.

Either way, the class was successfully loaded or you wouldn't have gotten
this far. It seems likely to me that your struct R doesn't have a default
constructor (i.e. a constructor that takes no arguments).

Check the IDL-generated java and see if that is the case. Also, check to see if
perhaps you have more than one "Module1/R.class" somewhere in your classpath...

Regards,
Randy

0 new messages