Now, these r my client & server program parts where i was trying the IOR
implementation -
my server pgm-
**********************
String fileName = new String("accountIO.ior");
OutputStream fOut = new FileOutputStream (fileName);
DataOutputStream outPut = new DataOutputStream (fOut);
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
try {
AccountImplementation a_i = new AccountImplementation(0,"chris");
accImpl = new _tie_Account (a_i);
if (accImpl == null) {
System.out.println("accImpl is null..");
}
try {
stringifiedIOR = (String) orb.object_to_string(accImpl);
System.out.println("in server..."+stringifiedIOR); ****<--- L1
outPut.writeChars(stringifiedIOR);
fOut.close();
}
catch(org.omg.CORBA.SystemException se) {
System.out.println("Exception " + se.toString());
}
finally {
System.out.println("####### $$$$$"); *****<----- L2
}
_CORBA.Orbix.impl_is_ready("AccountSrv");
********************** there r couple of things to be noticed here- L1 prints
the IOR, which is :
IOR:000000000000001049444c3a4163636f756e743a312e300000000001000000000000005b0
00100000000001767616e64616c662e63732e636c656d736f6e2e656475000006230000000000
333a5c67616e64616c662e63732e636c656d736f6e2e6564753a4163636f756e745372763a303
a3a4946523a4163636f756e7400 I was wondering if this what i shud get (is
this the string format of IOR?) btw i compiled the IDL file using -m interOP
option so it uses IIOP.
also L2 is printed on the server console for some reason, i dont think there
shud be any exception raised in this part of the code, but i always get that
thing printed.
now my CLIENT JAVA looks something like-
**************************
String fileName = new String("accountIO.ior");
FileInputStream fIn = new FileInputStream(fileName);
DataInputStream inPut = new DataInputStream (fIn);
String tmp = inPut.readLine();
System.out.println (tmp); *****<-- L1
fIn.close();
org.omg.CORBA.Object o = null;
Account curAct = null;
try {
o = orb.string_to_object((String)tmp);
if (o == null) {
System.out.println("account objref is nill!");
}
}
catch (org.omg.CORBA.SystemException ex) {
System.out.println("exception during bind b'cos ");
System.out.println(ex.toString());
System.exit(1);
}
finally {
System.out.println("########## $$$$$$ "); ****<--- L2
}
try {
curAct = AccountHelper.narrow(o);
............
*****************************
note that the client program first prints L1 which matches the server printed
String (IOR).
Also L2 is printed & then the exception message which i listed in the begining
of this long mail is printed.
I have no clue what is going on here.
Help please......
thanks,
Murali
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
Regards, Peter.
------------------------------------------------------------------------
Pongsatorn P. Sukhum
Infowave (Thailand) Co., Ltd.
21/2 Sukhumvit 34
Bangkok 10110 Tel: +66-2 259-7555
Thailand Fax: +66-2 259-7558
------------------------------------------------------------------------
INTERNET suk...@waveman.com
------------------------------------------------------------------------
WWW http://www.waveman.com
------------------------------------------------------------------------
I would try to use impl_is_ready with a timeout of
zero .. write then the IOR and call processEvents
with the timeout you like !
Maybe this helps !
Good luck !
Frank
-------------------------------------------------------------
| Dipl.-Ing. Frank Gruetzmacher | TelefoN : (03677) 69 1167 |
| Technische Universitaet Ilmenau | (03677) 69 1168 |
| PSF 0565, 98684 Ilmenau | Telefax : (03677) 69 1163 |
|-------------------------------------------------------------|
| E-Mail : gr...@Inf-Technik.TU-Ilmenau.DE |
-------------------------------------------------------------
mka...@clemson.edu wrote:
Murali,
I have pretty much the same approach working here.
I am using VisiBroker it's true, but I think that your way
of outputting the IOR in the server is suspect.
> OutputStream fOut = new FileOutputStream (fileName);
> DataOutputStream outPut = new DataOutputStream (fOut);
> org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
>
> try {
> AccountImplementation a_i = new AccountImplementation(0,"chris");
> accImpl = new _tie_Account (a_i);
> if (accImpl == null) {
> System.out.println("accImpl is null..");
> }
> try {
> stringifiedIOR = (String) orb.object_to_string(accImpl);
> System.out.println("in server..."+stringifiedIOR); ****<--- L1
> outPut.writeChars(stringifiedIOR);
> fOut.close();
Instead of writeChars (which is trying to output wide chars I think),
change your DataOutputStream to a PrintWriter and do a print.
John D.
PS. here's the relevant part of my server...
OutputStream fOS = new FileOutputStream (fileName);
PrintWriter pW = new PrintWriter (fOS);
// output the objref for Hospital
String stringifiedIOR = orb.object_to_string( theHosp);
System.out.println( stringifiedIOR);
pW.print( stringifiedIOR);
pW.close();
// ready the object
boa.obj_is_ready( theHosp);
System.out.println( theHosp + "is ready");