I am new in the Corba world and I develop my first
Client/Server Application via visibroker ORB.
I have the following idl declaration:
....
interface RemoteCall {
typedef sequence<string> string_array;
string_array getAllLibGroups(in long long sessionid);
...
What I do:
1. idl2java for generating the remote stuff
2. I implementing the Class ApplicationImpl extends ApplicationPOA and
have implemented the getAllLibGroups(in long long sessionid);- Methode
In Java it looks so:
public String[] getAllLibGroups(long sessionid){
String[] libGroups = null;
int i = 0;
String getsessionid = null;
getsessionid = new Long(getsessionid).toString();
System.out.println("Huuu bin in RemoteCallImpl!");
this.session = new srs.Session(getsessionid);
if (session == null) return null;
srs.LibGroupList groups = session.groups();
if (groups == null) return null;
srs.StrList libGrpNamesList = groups.names();
Vector group_vector = libGrpNamesList.getAll();
for (Enumeration e = group_vector.elements() ; e.hasMoreElements() ;) {
System.out.println((String)e.nextElement());
//libGroups[i] = (String)e.nextElement();
i++;
}
return libGroups;
}
3. I implemented the Server class.
4. I implemented the Client class.
Now when I start the Client I have the following error:
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:711)
at com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:606)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:459)
at srsproxy._RemoteCallStub.getAllLibGroups(_RemoteCallStub.java:90)
at Client.main(Client.java:54)
Know anyone what is wrong or have anyone an idea what it can be?????
Thanks,
Brunhilde
You have to return a valid value from your getAllLibGroups operation. In
your implementation, you return a null value. Null values, however, are
only allowed for object references (and some other types), but are not
valid for other IDL defined types.
In your case, if you want to return 'nothing', you have to return an
empty sequence of strings:
String[] libGroups = new String[0];
return libGroups;
Also, a Java hint: if you want to convert a vector that contains objects
of the same type to an array, you can use the toArray method:
Vector v = // v contains String objects
String[] arr = (String[]) v.toArray(new String[v.size()]);
--
Erik Post
erikpost at eml dot cc