[omniORB] Java & omniORB
José Alberto Pérez de Acha
japerez@triger.com.mx
Wed, 21 Jul 1999 21:13:13 -0600
This is a multi-part message in MIME format.
------=_NextPart_000_0106_01BED3BD.D7B8BA40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I have been trying to connect a Java Client (JDK 1.2) to omniORB 2.7.1 =
on a Windows NT 4.0 Server but it can not seem to work (please see =
source code).
I have already started OMNINAMES (on port 900) and my corba server =
(Validacion). They work fine if I use my C++ client. but I do not know =
why it does not work with my java client (it fails between step 6 and =
7).
Can somebody help me and tell me what I am doing wrong?
Regards from Mexico.
Jose Alberto Perez de Acha
TRIGER, S.C.
Blvd. Manuel Avila Camacho 88-8
Col. Lomas de Chapultepec
11000 Mexico City, Mexico
Tel 5202-7333
Source code:
//Title: Corba Client
// Version: 1.0
//Copyright: Copyright (c) 1999
//Author: Jose Alberto Perez de Acha
//Company: TRIGER, S.C.
//Description: Programaci=F3n con CORBA
package Corba;
import Seguridad.*; // Package of java classes =
(after compiling Seguridad.idl)
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
public class SeguridadClient {
public SeguridadClient() {
}
public static void main(String args[]) {
try{
// create and initialize the ORB
System.out.println("Step 1") ;
ORB orb =3D ORB.init(args, null);
// get the root naming context
System.out.println("Step 2") ;
// org.omg.CORBA.Object objRef =3D orb.string_to_object(c_ior);
org.omg.CORBA.Object objRef =3D =
orb.resolve_initial_references("NameService");
System.out.println("Step 3") ;
NamingContext ncRef =3D NamingContextHelper.narrow(objRef);
// resolve the Object Reference in Naming
System.out.println("Step 4") ;
NameComponent nc =3D new NameComponent("Validacion", "Object");
System.out.println("Step 5 [" + nc.toString() + "]") ;
NameComponent path[] =3D {nc};
System.out.println("Step 6 [" + path[0].toString() + "]") ;
// THE PROGRAM FAILS HERE
Validacion validacionRef =3D =
ValidacionHelper.narrow(ncRef.resolve(path));
System.out.println("Step 7") ;
// call the Validacion server object and print results
String buffer =3D "SEPARREG|";
org.omg.CORBA.StringHolder results =3D new StringHolder("");
int result =3D validacionRef.ParametroCORBA(buffer, results);
System.out.println(results);
}
catch (Exception e) {
System.out.println("ERROR : " + e) ;
e.printStackTrace(System.out);
}
}
}
------=_NextPart_000_0106_01BED3BD.D7B8BA40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>Hi,</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>I have been trying to connect a Java =
Client (JDK=20
1.2) to omniORB 2.7.1 on a Windows NT 4.0 Server but it can not seem to =
work=20
(please see source code).</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>I have already started OMNINAMES (on =
port 900)=20
and my corba server (Validacion). They work fine if I use my C++ client. =
but I=20
do not know why it does not work with my java client (it fails between =
step 6=20
and 7).</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Can somebody help me and tell me what I am doing=20
wrong?</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>Regards from Mexico.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>Jose Alberto Perez de =
Acha</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>TRIGER, =
S.C.</FONT></DIV>
<DIV><FONT size=3D2>Blvd. Manuel Avila Camacho 88-8</FONT></DIV>
<DIV><FONT size=3D2>Col. Lomas de Chapultepec</FONT></DIV>
<DIV><FONT size=3D2>11000 </FONT><FONT size=3D2>Mexico City, =
Mexico</FONT></DIV>
<DIV><FONT size=3D2>Tel 5202-7333</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>Source code:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2><BR><A=20
href=3D"file://Title:">//Title:</A> &n=
bsp; =20
Corba Client<BR><A href=3D"file:// Version:">//=20
Version:</A> 1.0<BR><A=20
href=3D"file://Copyright:">//Copyright:</A> =
Copyright (c)=20
1999<BR><A=20
href=3D"file://Author:">//Author:</A> =
=20
Jose Alberto Perez de Acha<BR><A=20
href=3D"file://Company:">//Company:</A> TRIGER, =
S.C.<BR><A=20
href=3D"file://Description:">//Description:</A> =
Programación con=20
CORBA<BR>package Corba;</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>import=20
Seguridad.*; &=
nbsp; =20
// Package of java classes (after compiling Seguridad.idl)<BR>import=20
org.omg.CosNaming.*;<BR>import org.omg.CORBA.*;</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>public class SeguridadClient =
{</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> public SeguridadClient() =
{<BR> =20
}</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> public static void main(String =
args[]) {<BR> =
try{<BR> //=20
create and initialize the ORB<BR> =20
System.out.println("Step 1") ;<BR> ORB orb =3D=20
ORB.init(args, null);</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> // get the root naming=20
context<BR> System.out.println("Step =
2")=20
;<BR> // org.omg.CORBA.Object objRef =3D=20
orb.string_to_object(c_ior);<BR> =20
org.omg.CORBA.Object objRef =3D=20
orb.resolve_initial_references("NameService");<BR> &=
nbsp; =20
System.out.println("Step 3") =
;<BR> =20
NamingContext ncRef =3D NamingContextHelper.narrow(objRef);</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> // =
resolve the=20
Object Reference in Naming<BR> =20
System.out.println("Step 4") =
;<BR> =20
NameComponent nc =3D new NameComponent("Validacion",=20
"Object");<BR> =20
System.out.println("Step 5 [" + nc.toString() + "]") =
;<BR> NameComponent path[] =3D=20
{nc};<BR> System.out.println("Step 6 =
["=20
+ path[0].toString() + "]") ;</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> // =
THE PROGRAM=20
FAILS HERE</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20
size=3D2> Validacion validacionRef =3D=20
ValidacionHelper.narrow(ncRef.resolve(path));<BR> =
=20
System.out.println("Step 7") ;</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> // call the Validacion =
server=20
object and print results<BR> String buffer =3D=20
"SEPARREG|";<BR> org.omg.CORBA.StringHolder =
results =3D new=20
StringHolder("");<BR> int result =3D=20
validacionRef.ParametroCORBA(buffer, results);<BR> =20
System.out.println(results);<BR> }<BR> catch (Exception e)=20
{<BR> System.out.println("ERROR : " + e)=20
;<BR> =
e.printStackTrace(System.out);<BR> =20
}<BR> }<BR>}<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_0106_01BED3BD.D7B8BA40--