<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
There are explicit examples in C++ in the omniORB source tree. If
you mirror that code in Java you should have some success.<br>
<br>
But as something is failing in your Java code you should debug that.
I'll suggest that you confirm that you can retrieve valid
NameComponent pieces from the naming service for each level of the
name you have registered and are trying to retrieve. And unnest the
call to resolve() so you can see what the result of that is. But
first, you could use a naming service listing utility to examine how
the naming service is being used by your server.<br>
<br>
If you are new to CORBA, you will find it very useful to have a
reference book and tutorial. I have found that, no matter which
language you are using, the Advanced CORBA Programming with C++ by
Henning and Vinoski is the book worth having.<br>
<br>
Oh, you *are* using JacORB, right? The ORB shipped with Java is
deficient (or at least used to be and I haven't heard that it has
gotten better).<br>
<br>
hth<br>
<br>
- Tom<br>
<br>
<blockquote
cite="mid:AANLkTi=BLsFLgstj3vWchSBYYC6=j9pWYNfYHeTk+gNC@mail.gmail.com"
type="cite">i'm trying, but i don't know where is my mistake here
is my client in Java:<br>
<br>
EchoClient.java<br>
----------------------<br>
import org.omg.CosNaming.*;<br>
import org.omg.CORBA.*;<br>
<br>
public class EchoClient {<br>
<br>
public static void main(String args[]) {<br>
try {<br>
String SetInfo, ReturnInfo, ref;<br>
org.omg.CORBA.Object objRef;<br>
Echo EchoRef;<br>
ORB orb = ORB.init(args, null);<br>
<br>
objRef =
orb.resolve_initial_references("NameService");<br>
NamingContext ncRef =
NamingContextHelper.narrow(objRef);<br>
<br>
// locate the service<br>
NameComponent nc = new NameComponent("test",
"my_context");<br>
NameComponent nc2 = new NameComponent("Echo",
"Object");<br>
<br>
NameComponent path[] = { nc,nc2 };<br>
EchoRef = EchoHelper.narrow(ncRef.resolve(path));<br>
<br>
if (args.length > 1) {<br>
SetInfo = args[1];<br>
} else {<br>
<br>
}<br>
System.out.println("Client Process Begin: ");<br>
ReturnInfo = EchoRef.echoString("my corba test");<br>
System.out.println(ReturnInfo);<br>
*/<br>
} catch (Exception e) {<br>
System.out.println("ERROR : " + e);<br>
}<br>
}<br>
}<br>
-------------------------------<br>
<br>
When run the client :<br>
<br>
java EchoClient -ORBInitialPort 2809 <br>
<br>
gives this error :<br>
ERROR : org.omg.CosNaming.NamingContextPackage.NotFound: IDL:<a
moz-do-not-send="true"
href="http://omg.org/CosNaming/NamingContext/NotFound:1.0">omg.org/CosNaming/NamingContext/NotFound:1.0</a><br>
<br>
Can anyone help me please?<br>
<br>
Thanks for your attention.<br>
<br clear="all">
<span style="color: rgb(153, 153, 153);"></span>Best regards,<br>
Valter Henrique.<br>
<br>
<div class="gmail_quote">2010/11/24 Valter Henrique <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:valter.bcc@gmail.com">valter.bcc@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">Sorry Duncan, but i don't understand what
you say, i'm new in CORBA.<br>
Could you give me an example, please ?<br>
<br>
Thanks.<br>
<br>
<br>
<div class="gmail_quote">2010/11/24 Duncan Grisby <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:duncan@grisby.org" target="_blank">duncan@grisby.org</a>></span>
<div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt
0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div>On Wed, 2010-11-24 at 05:55 -0800, Valter
Henrique wrote:<br>
<br>
> i'm tryng do build a simple application using
'echo' example.<br>
><br>
> I have my client in Java:<br>
<br>
</div>
[...]<br>
<div>> // locate the service<br>
> NameComponent nc = new
NameComponent("Echo", "");<br>
> NameComponent path[] = {
nc };<br>
> EchoRef =
EchoHelper.narrow(ncRef.resolve(path));<br>
<br>
</div>
[...]<br>
<div>> java EchoClient -ORBInitialPort 2809<br>
> ERROR :
org.omg.CosNaming.NamingContextPackage.NotFound:<br>
> IDL:<a moz-do-not-send="true"
href="http://omg.org/CosNaming/NamingContext/NotFound:1.0"
target="_blank">omg.org/CosNaming/NamingContext/NotFound:1.0</a><br>
<br>
</div>
As the exception says, the name you have looked up is
not found. The eg3<br>
example uses the name test.my_context/Echo.Object .
You need to either<br>
create the two NameComponents separately, or use the<br>
NamingContextExt::resolve_str method that will take
the string form.<br>
<br>
Cheers,<br>
<br>
Duncan.<br>
<font color="#888888"><br>
--<br>
-- Duncan Grisby --<br>
-- <a moz-do-not-send="true"
href="mailto:duncan@grisby.org" target="_blank">duncan@grisby.org</a>
--<br>
-- <a moz-do-not-send="true"
href="http://www.grisby.org" target="_blank">http://www.grisby.org</a>
--<br>
<br>
<br>
</font></blockquote>
</div>
</div>
</div>
<br>
</blockquote>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
omniORB-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:omniORB-list@omniorb-support.com">omniORB-list@omniorb-support.com</a>
<a class="moz-txt-link-freetext" href="http://www.omniorb-support.com/mailman/listinfo/omniorb-list">http://www.omniorb-support.com/mailman/listinfo/omniorb-list</a>
</pre>
</blockquote>
<br>
</body>
</html>