Discussion:
[omniORB] Java, Python, CORBA
Jakub Moskal
2009-02-11 11:11:16 UTC
Permalink
Hey all,

I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried some
other ports but all gave me the same error.

My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
interface MyInter {
attribute string attr;
string printMe();
};

interface MyInterFactory {
MyInter createMyInter(in string attr);
}

I implemented the factory in this way:
public MyInter createMyInter(string attr) {
MyInterImpl mii = new MyInterImpl(attr);
return new MyInterPOATie(mii)._this(this.orb);
}

where this.orb is orb that is passed by the server after the init was invoked.

Now on my client, after retrieving the MyInterFactory object, I do:

MyInter mi = factory.createMyInter(attr); //passes
String toPrint = mi.printMe();

The second line above throws a CORBA.BAD_OPERATION and after some
debugging I noticed that somehow the invocation of "printMe()" is
passed to the factory object on the server and not on the appropriate
MyInter object - whcih explains the BAD_OPERATION. Finally, my
question is how should the factory create a new object so that clients
can access them and invoke their methods. Secondly, is there a better
way for the client to be able to create new objects that implement
CORBA interfaces?

Any help greatly appreciated!
Jakub
Martin Trappel
2009-02-11 12:54:39 UTC
Permalink
Post by Jakub Moskal
Hey all,
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried some
other ports but all gave me the same error.
The default port for omniNames is 2809.
I thought that's the default port for the CORBA Naming Service.
However, the orbd docs don't mention it:
http://java.sun.com/javase/6/docs/technotes/tools/share/orbd.html
Post by Jakub Moskal
<snip>
Note that it seems to me that your questions ain't have anything to do
with omniORB. They would probably be answered quicker on a Java/CORBA
related forum.

br,
Martin
Jakub Moskal
2009-02-11 19:04:57 UTC
Permalink
Martin,

Thanks for the link. I thought this wasn't the best place to ask my
question, but it seems to be the most active group that deals with
CORBA. orbd runs on port 900 by default, but my python client still
can't connect. Perhaps it's because the port is below 1024 and
requires the root to run it. Anyways, I will follow your advice and
post my question on a Java/CORBA related group.

Thanks,
Jakub
Post by Martin Trappel
Post by Jakub Moskal
Hey all,
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried some
other ports but all gave me the same error.
The default port for omniNames is 2809.
I thought that's the default port for the CORBA Naming Service.
http://java.sun.com/javase/6/docs/technotes/tools/share/orbd.html
Post by Jakub Moskal
<snip>
Note that it seems to me that your questions ain't have anything to do with
omniORB. They would probably be answered quicker on a Java/CORBA related
forum.
br,
Martin
Duncan Grisby
2009-02-11 21:18:25 UTC
Permalink
Post by Jakub Moskal
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried some
other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you
can't use a corbaname URI to resolve it. The Java ORB uses a proprietary
bootstrap mechanism invented by Sun. Luckily for you, omniORB supports
it too. It should work if you use these arguments instead of the
-ORBInitRef:

-ORBInitialHost localhost -ORBInitialPort 900
Post by Jakub Moskal
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be getting
such a strange problem. It's definitely nothing to do with the omniORB
end, though.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
evgeni.rojkov at durr.com ()
2009-02-11 21:48:26 UTC
Permalink
Java's orbd doesn't support the interoperable naming service, so you can't use
a corbaname URI to resolve it.
The Java ORB uses a proprietary bootstrap
mechanism invented by Sun. Luckily for you, omniORB supports it too. It should
work if you use these arguments instead of the
-ORBInitialHost localhost -ORBInitialPort 900
... just a confirmation...
I could replace omniNames with orbd -ORBInitialPort 2809
It works for omniORB-4.0.5 with Java 1.4
Kind Regards, Evgeni

-----Urspr?ngliche Nachricht-----
Von: omniorb-list-***@omniorb-support.com
[mailto:omniorb-list-***@omniorb-support.com] Im Auftrag von Duncan Grisby
Gesendet: Mittwoch, 11. Februar 2009 16:18
An: Jakub Moskal
Cc: OmniORB Support
Betreff: Re: [omniORB] Java, Python, CORBA
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried some
other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you can't use a
corbaname URI to resolve it. The Java ORB uses a proprietary bootstrap mechanism
invented by Sun. Luckily for you, omniORB supports it too. It should work if you
use these arguments instead of the
-ORBInitRef:

-ORBInitialHost localhost -ORBInitialPort 900
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be getting such a
strange problem. It's definitely nothing to do with the omniORB end, though.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Jakub Moskal
2009-02-11 22:35:55 UTC
Permalink
Duncan,

I went after your advice and changed my python client code to:

javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef"]
orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID)
obj = orb.resolve_initial_references("NameService")

However, that throws: omniORB.NO_RESOURCES_InitialRefNotFound. I
checked open ports and as the documentation for orbd says, 900 and
1049 are being listened by orbd. So I added the info about hte
InitRef:

javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef", "NameService=corbaname::localhost:1049"]

and it still gives me the same error.

I also tried 'orbd -ORBInitialPort 2809" - with the same results, Java
client connects, python throws InitialRefNotFound.

Thanks for help!
Jakub
Post by Duncan Grisby
Post by Jakub Moskal
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried some
other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you
can't use a corbaname URI to resolve it. The Java ORB uses a proprietary
bootstrap mechanism invented by Sun. Luckily for you, omniORB supports
it too. It should work if you use these arguments instead of the
-ORBInitialHost localhost -ORBInitialPort 900
Post by Jakub Moskal
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be getting
such a strange problem. It's definitely nothing to do with the omniORB
end, though.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
evgeni.rojkov at durr.com ()
2009-02-11 22:48:16 UTC
Permalink
Hi Jakub,
Could you check "supportBootstrapAgent" entry in omniOrb.cfg.
I suppose it should be set to 1.
Kind Regards, Evgeni

############################################################################
# supportBootstrapAgent
#
# Applies to the server side. 1 means enable the support for Sun's
# bootstrap agent protocol. This enables interoperability between omniORB
# servers and Sun's javaIDL clients. When this option is enabled, an
# omniORB server will respond to a bootstrap agent request.
supportBootstrapAgent = 1




-----Urspr?ngliche Nachricht-----
Von: omniorb-list-***@omniorb-support.com
[mailto:omniorb-list-***@omniorb-support.com] Im Auftrag von Jakub Moskal
Gesendet: Mittwoch, 11. Februar 2009 17:36
An: Duncan Grisby
Cc: OmniORB Support
Betreff: Re: [omniORB] Java, Python, CORBA

Duncan,

I went after your advice and changed my python client code to:

javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef"] orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID) obj =
orb.resolve_initial_references("NameService")

However, that throws: omniORB.NO_RESOURCES_InitialRefNotFound. I checked open
ports and as the documentation for orbd says, 900 and
1049 are being listened by orbd. So I added the info about hte
InitRef:

javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef", "NameService=corbaname::localhost:1049"]

and it still gives me the same error.

I also tried 'orbd -ORBInitialPort 2809" - with the same results, Java client
connects, python throws InitialRefNotFound.

Thanks for help!
Jakub
Post by Duncan Grisby
Post by Jakub Moskal
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried
some other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you
can't use a corbaname URI to resolve it. The Java ORB uses a
proprietary bootstrap mechanism invented by Sun. Luckily for you,
omniORB supports it too. It should work if you use these arguments
instead of the
-ORBInitialHost localhost -ORBInitialPort 900
Post by Jakub Moskal
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be
getting such a strange problem. It's definitely nothing to do with the
omniORB end, though.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
Jakub Moskal
2009-02-11 23:03:05 UTC
Permalink
I am trying to not to use omniOrb.cfg and pass all parameters from
within the code. However, I added that line to omniOrb.cfg and still
no success.

Thanks
Post by evgeni.rojkov at durr.com ()
Hi Jakub,
Could you check "supportBootstrapAgent" entry in omniOrb.cfg.
I suppose it should be set to 1.
Kind Regards, Evgeni
############################################################################
# supportBootstrapAgent
#
# Applies to the server side. 1 means enable the support for Sun's
# bootstrap agent protocol. This enables interoperability between omniORB
# servers and Sun's javaIDL clients. When this option is enabled, an
# omniORB server will respond to a bootstrap agent request.
supportBootstrapAgent = 1
-----Urspr?ngliche Nachricht-----
Gesendet: Mittwoch, 11. Februar 2009 17:36
An: Duncan Grisby
Cc: OmniORB Support
Betreff: Re: [omniORB] Java, Python, CORBA
Duncan,
javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef"] orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID) obj =
orb.resolve_initial_references("NameService")
However, that throws: omniORB.NO_RESOURCES_InitialRefNotFound. I checked open
ports and as the documentation for orbd says, 900 and
1049 are being listened by orbd. So I added the info about hte
javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef", "NameService=corbaname::localhost:1049"]
and it still gives me the same error.
I also tried 'orbd -ORBInitialPort 2809" - with the same results, Java client
connects, python throws InitialRefNotFound.
Thanks for help!
Jakub
Post by Duncan Grisby
Post by Jakub Moskal
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried
some other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you
can't use a corbaname URI to resolve it. The Java ORB uses a
proprietary bootstrap mechanism invented by Sun. Luckily for you,
omniORB supports it too. It should work if you use these arguments
instead of the
-ORBInitialHost localhost -ORBInitialPort 900
Post by Jakub Moskal
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be
getting such a strange problem. It's definitely nothing to do with the
omniORB end, though.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
_______________________________________________
omniORB-list mailing list
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
_______________________________________________
omniORB-list mailing list
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
William Bauder
2009-02-11 22:47:59 UTC
Permalink
I don't know how it works with the orb init parameters, but this always
worked for me:

CORBA::Object_ptr
object=orb->string_to_object("corbaloc::localhost:900/NameService");
CosNaming::NamingContext_ptr
rootContext=CosNaming::NamingContext::_narrow(object);

-----Original Message-----
From: omniorb-list-***@omniorb-support.com
[mailto:omniorb-list-***@omniorb-support.com] On Behalf Of Jakub Moskal
Sent: Wednesday, February 11, 2009 11:36 AM
To: Duncan Grisby
Cc: OmniORB Support
Subject: Re: [omniORB] Java, Python, CORBA


Duncan,

I went after your advice and changed my python client code to:

javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef"] orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID) obj =
orb.resolve_initial_references("NameService")

However, that throws: omniORB.NO_RESOURCES_InitialRefNotFound. I checked
open ports and as the documentation for orbd says, 900 and 1049 are being
listened by orbd. So I added the info about hte
InitRef:

javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef", "NameService=corbaname::localhost:1049"]

and it still gives me the same error.

I also tried 'orbd -ORBInitialPort 2809" - with the same results, Java
client connects, python throws InitialRefNotFound.

Thanks for help!
Jakub
Post by Duncan Grisby
Post by Jakub Moskal
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried
some other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you
can't use a corbaname URI to resolve it. The Java ORB uses a
proprietary bootstrap mechanism invented by Sun. Luckily for you,
omniORB supports it too. It should work if you use these arguments
instead of the
-ORBInitialHost localhost -ORBInitialPort 900
Post by Jakub Moskal
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be
getting such a strange problem. It's definitely nothing to do with the
omniORB end, though.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
Jakub Moskal
2009-02-11 23:09:02 UTC
Permalink
William,

here is what I get:

javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort" "900"]
orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID)
obj = orb.string_to_object("corbaloc::localhost:900/NameService")
rootContext = obj._narrow(CosNaming.NamingContext) // exception thrown

throws: omniORB.TRANSIENT_ConnectFailed.

I have no idea what is wrong at this point.. Is there anything I need
to do with "-ORBno_bootstrap_agent" ?

Thanks!
Jakub
Post by William Bauder
I don't know how it works with the orb init parameters, but this always
CORBA::Object_ptr
object=orb->string_to_object("corbaloc::localhost:900/NameService");
CosNaming::NamingContext_ptr
rootContext=CosNaming::NamingContext::_narrow(object);
-----Original Message-----
Sent: Wednesday, February 11, 2009 11:36 AM
To: Duncan Grisby
Cc: OmniORB Support
Subject: Re: [omniORB] Java, Python, CORBA
Duncan,
javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef"] orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID) obj =
orb.resolve_initial_references("NameService")
However, that throws: omniORB.NO_RESOURCES_InitialRefNotFound. I checked
open ports and as the documentation for orbd says, 900 and 1049 are being
listened by orbd. So I added the info about hte
javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef", "NameService=corbaname::localhost:1049"]
and it still gives me the same error.
I also tried 'orbd -ORBInitialPort 2809" - with the same results, Java
client connects, python throws InitialRefNotFound.
Thanks for help!
Jakub
Post by Duncan Grisby
Post by Jakub Moskal
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried
some other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you
can't use a corbaname URI to resolve it. The Java ORB uses a
proprietary bootstrap mechanism invented by Sun. Luckily for you,
omniORB supports it too. It should work if you use these arguments
instead of the
-ORBInitialHost localhost -ORBInitialPort 900
Post by Jakub Moskal
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be
getting such a strange problem. It's definitely nothing to do with the
omniORB end, though.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
_______________________________________________
omniORB-list mailing list
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
Jakub Moskal
2009-02-11 23:17:02 UTC
Permalink
I just tried something else - I ran omniNames and connected the Java
server to it (on 2809). Now both Java and Python client connect with
the NameService properly. Somehow my python client didn't want to talk
to orbd, but that's fine. I can use omniNames instead.

Thanks for all your help!
Jakub
Post by Jakub Moskal
William,
javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort" "900"]
orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID)
obj = orb.string_to_object("corbaloc::localhost:900/NameService")
rootContext = obj._narrow(CosNaming.NamingContext) // exception thrown
throws: omniORB.TRANSIENT_ConnectFailed.
I have no idea what is wrong at this point.. Is there anything I need
to do with "-ORBno_bootstrap_agent" ?
Thanks!
Jakub
Post by William Bauder
I don't know how it works with the orb init parameters, but this always
CORBA::Object_ptr
object=orb->string_to_object("corbaloc::localhost:900/NameService");
CosNaming::NamingContext_ptr
rootContext=CosNaming::NamingContext::_narrow(object);
-----Original Message-----
Sent: Wednesday, February 11, 2009 11:36 AM
To: Duncan Grisby
Cc: OmniORB Support
Subject: Re: [omniORB] Java, Python, CORBA
Duncan,
javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef"] orb = CORBA.ORB_init(javaParams, CORBA.ORB_ID) obj =
orb.resolve_initial_references("NameService")
However, that throws: omniORB.NO_RESOURCES_InitialRefNotFound. I checked
open ports and as the documentation for orbd says, 900 and 1049 are being
listened by orbd. So I added the info about hte
javaParams = ["ORBInitialHost", "localhost", "ORBInitialPort", "900",
"ORBInitRef", "NameService=corbaname::localhost:1049"]
and it still gives me the same error.
I also tried 'orbd -ORBInitialPort 2809" - with the same results, Java
client connects, python throws InitialRefNotFound.
Thanks for help!
Jakub
Post by Duncan Grisby
Post by Jakub Moskal
I wrote a server in Java and clients in Java and Python. Clients
connect and invoke methods without any problem when the object
reference is retrieved from a string. When I use 'orbd' and
NameService only the Java client connects, the python clients fails
with "omniORB.TRANSIENT_ConnectFailed". I init the ORB in python with
parameters " ["-ORBInitRef", "NameService=corbaname::localhost:900"]
". What is the port on which 'orbd' runs its NameService? I tried
some other ports but all gave me the same error.
Java's orbd doesn't support the interoperable naming service, so you
can't use a corbaname URI to resolve it. The Java ORB uses a
proprietary bootstrap mechanism invented by Sun. Luckily for you,
omniORB supports it too. It should work if you use these arguments
instead of the
-ORBInitialHost localhost -ORBInitialPort 900
Post by Jakub Moskal
My second question has to do with creating new objects. I wrote an
object factory on client that returns new objects which implement my
interfaces, e.g.
Everything you've done looks fine, so I don't know why you'd be
getting such a strange problem. It's definitely nothing to do with the
omniORB end, though.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
_______________________________________________
omniORB-list mailing list
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
Loading...