Link to home
Start Free TrialLog in
Avatar of nikki_agarwal
nikki_agarwal

asked on

Linux and Corba

Hi
Hey I am again stuck in corba world
I do have
1. Jdk 1.2.2 for linux
I developed a small application on windows platform and i am porting on linux. but when i want to run server named HelloServer by command java HelloServer -ORBInitialPort 1050 it raises exception omg/orb/CORBA/ORB class not found. Do i need to install some packages may be jar file to get this program run please help
thanks

Avatar of diakov
diakov

Try to find where your classpath on the unix is. Then look into the archives whether the CORBA supoort is there. If not, you can always install another a pure Java orb, for example Orbacus or JacORB (search for the URLs with yahoo.)

Cheers,
  Nik
Avatar of nikki_agarwal

ASKER

hey there was some problem with the classpath and that is done but again i am in differnt mode. When i tested this program on windows it is working fine
but on linux it is initializing orb correctly

code is something like this

org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
                              NamingContext ncRef = NamingContextHelper.narrow(objRef);
                              NamingContext ncRef1 = NamingContextHelper.narrow(objRef);

NameComponent nc = new NameComponent("Hello","");
                                    NameComponent nc1 = new NameComponent("Bye","");
                                    NameComponent path[] = {nc};
NameComponent path1[] = {nc1};

till here it is working fine but this line is giving error

 Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));

is there some problem with the idl mapping on windows and linux

thanx

Hi, nikki_agarwal. It`s to configure your java 1.2 environment in Unix (C Shell). Try it:

setenv CLASSPATH .:jdk1.2.2/jre/lib/rt.jar:$CLASSPATH

To make this setting permenent, you'd typically put this statement in your ".cshrc" file.

Bye... :)
What does it mean "not working fine"?

Exception? may be the ncRef is null? This means the Naming context hasn't been found correctly.

Did you specify on which machine the Naming service is?
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");

Check it for null.

Cheers,
  Nik
hey there was some problem with the classpath and that is done but again i am in differnt mode. When i tested this program on windows it is working fine
but on linux it is initializing orb correctly

code is something like this

org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
                              NamingContext ncRef = NamingContextHelper.narrow(objRef);
                              NamingContext ncRef1 = NamingContextHelper.narrow(objRef);

NameComponent nc = new NameComponent("Hello","");
                                    NameComponent nc1 = new NameComponent("Bye","");
                                    NameComponent path[] = {nc};
NameComponent path1[] = {nc1};

till here it is working fine but this line is giving error

 Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));

is there some problem with the idl mapping on windows and linux

thanx

Post the stack trace in case of exception.

Nik
Check:

  1.- Check that your pc have its corresponding ip address.
  2.- U have installed TCP/IP protocol (needed by CORBA IIOP).
  3.- Your server starts ok (not your nemeserver), and it runs the name component "Hello".

hey it is giving org.omg.CORBA.COMM_FAILURE minor code: 1 comp
error
i am giving you full code including displaying the text in a textbox.
it displays till
before calling hellohelper.narrow
but narrow function fails i guess

code is

import HelloApp.*;
import java.applet.*;
import java.awt.*;
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
import java.util.*;
import java.awt.event.*;

public class HelloApplet extends Applet

{

      Button bDisp;
        TextArea txterror = new TextArea();
      Button bInit = new Button("Init ORB");
      String args[] = new String[4];
      class ButtonAction implements ActionListener
      {
            public void actionPerformed(ActionEvent e)
            {
            try
            {
                  args[0] = new String("-ORBInitialPort");
                  args[1] = new String("1050");
                  args[2] = new String("-ORBInitialHost");
                  args[3] = new String("10.0.0.185");
                               java.util.Properties prop = new java.util.Properties();
                                   prop.put("org.omg.CORBA.ORBClass","com.sun.CORBA.iiop.ORB");
                              prop.put("org.omg.CORBA.ORBInitialHost","10.0.0.185");
                               prop.put("org.omg.CORBA.ORBInitialPort","1050");
                    txterror.setText(args[0] + args[1] + args[2] + args[3]);
                              ORB orb = ORB.init(args,null);
                  txterror.setText("      before resolve");
                  org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
                  txterror.setText("      after resolve");
                                    NamingContext ncRef = NamingContextHelper.narrow(objRef);
                  txterror.setText("      after naming context");
                                    NamingContext ncRef1 = NamingContextHelper.narrow(objRef);

                                    NameComponent nc = new NameComponent("Hello","");
                  txterror.setText("      after name compnent");
                                    NameComponent nc1 = new NameComponent("Bye","");
                                    NameComponent path[] = {nc};
                  txterror.setText("      after namepATH");
                                    NameComponent path1[] = {nc1};
                  txterror.setText("      before calling hellohelper.narrow");
            
                                    Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));
                  txterror.setText("      after helper");
                                   Bye byeRef = ByeHelper.narrow(ncRef1.resolve(path1));

                                    
                  txterror.setText("after calling sayhello");
                  //bDisp = new Button(hello);
                              String hello = helloRef.sayHello();
                              txterror.setText(hello);

                  
                                    System.out.println(hello);

                        String abuse = helloRef.abuse();
                                    System.out.println(abuse);

                        String dont = helloRef.dont("Why Abuse");
                                    System.out.println(dont);
                                    txterror.setText("             after narrow");
                                    String bye = byeRef.sayBye();
                                    txterror.setText("            " + bye);
            
            }
            catch(Exception ex)
            {
                  ex.printStackTrace();
                  txterror.setText("            " + ex.toString());
            }

            }
      }
      public void init()
      {

            add(bInit);
            add(txterror);
            bInit.addActionListener(new ButtonAction());            
                              
      }        
 }

bye
hey it is giving org.omg.CORBA.COMM_FAILURE minor code: 1 comp
error
i am giving you full code including displaying the text in a textbox.
it displays till
before calling hellohelper.narrow
but narrow function fails i guess

code is

import HelloApp.*;
import java.applet.*;
import java.awt.*;
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
import java.util.*;
import java.awt.event.*;

public class HelloApplet extends Applet

{

      Button bDisp;
        TextArea txterror = new TextArea();
      Button bInit = new Button("Init ORB");
      String args[] = new String[4];
      class ButtonAction implements ActionListener
      {
            public void actionPerformed(ActionEvent e)
            {
            try
            {
                  args[0] = new String("-ORBInitialPort");
                  args[1] = new String("1050");
                  args[2] = new String("-ORBInitialHost");
                  args[3] = new String("10.0.0.185");
                               java.util.Properties prop = new java.util.Properties();
                                   prop.put("org.omg.CORBA.ORBClass","com.sun.CORBA.iiop.ORB");
                              prop.put("org.omg.CORBA.ORBInitialHost","10.0.0.185");
                               prop.put("org.omg.CORBA.ORBInitialPort","1050");
                    txterror.setText(args[0] + args[1] + args[2] + args[3]);
                              ORB orb = ORB.init(args,null);
                  txterror.setText("      before resolve");
                  org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
                  txterror.setText("      after resolve");
                                    NamingContext ncRef = NamingContextHelper.narrow(objRef);
                  txterror.setText("      after naming context");
                                    NamingContext ncRef1 = NamingContextHelper.narrow(objRef);

                                    NameComponent nc = new NameComponent("Hello","");
                  txterror.setText("      after name compnent");
                                    NameComponent nc1 = new NameComponent("Bye","");
                                    NameComponent path[] = {nc};
                  txterror.setText("      after namepATH");
                                    NameComponent path1[] = {nc1};
                  txterror.setText("      before calling hellohelper.narrow");
            
                                    Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));
                  txterror.setText("      after helper");
                                   Bye byeRef = ByeHelper.narrow(ncRef1.resolve(path1));

                                    
                  txterror.setText("after calling sayhello");
                  //bDisp = new Button(hello);
                              String hello = helloRef.sayHello();
                              txterror.setText(hello);

                  
                                    System.out.println(hello);

                        String abuse = helloRef.abuse();
                                    System.out.println(abuse);

                        String dont = helloRef.dont("Why Abuse");
                                    System.out.println(dont);
                                    txterror.setText("             after narrow");
                                    String bye = byeRef.sayBye();
                                    txterror.setText("            " + bye);
            
            }
            catch(Exception ex)
            {
                  ex.printStackTrace();
                  txterror.setText("            " + ex.toString());
            }

            }
      }
      public void init()
      {

            add(bInit);
            add(txterror);
            bInit.addActionListener(new ButtonAction());            
                              
      }        
 }

i guess it will help you in understanding the problem
bye
nikki
hey i am not doing anything with property so don't be confused by that
I see you yous an applet. You have to make sure that the naming server and the orb run on the same machine where the web server is running. Unsigned applet runs in the secure environment of the browser and is not allowed to communicate with hosts different than the host of origin. Thus opening a socket (the orb code does that) is restricted to certified applet code.

Cheers,
  Nik

P.S. Note that my name is Nik, not hey.

ASKER CERTIFIED SOLUTION
Avatar of diakov
diakov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok Nik not hey(just kidding)
it is true that this is in applet but i am also trying from the application which runs on windows machine and tnameserv and server runs on linux.
every things work fine if i port this application on windows NT(server and tnameserv) but not on linux
it prints the error on console like this
org.omg.CORBA.COMM_FAILURE:   minor code: 1  completed: No      at com.sun.CORBA.iiop.ConnectionTable.get(Unknown Source)      at com.sun.CORBA.iiop.GIOPImpl.createRequest(Unknown Source)      at com.sun.CORBA.iiop.GIOPImpl.createRequest(Unknown Source)      at com.sun.CORBA.idl.GenericCORBAClientSC.createRequest(Unknown Source)      at com.sun.CORBA.idl.InitialNamingClient.resolve(Unknown Source)      at com.sun.CORBA.idl.InitialNamingClient.cachedInitialReferences(Unknown Source)      at com.sun.CORBA.idl.InitialNamingClient.resolve_initial_references(Unknown Source)      at com.sun.CORBA.idl.ORB.resolve_initial_references(Unknown Source)      at HelloApplet$ButtonAction.actionPerformed(HelloApplet.java:34)      at java.awt.Button.processActionEvent(Unknown Source)      at java.awt.Button.processEvent(Unknown Source)      at java.awt.Component.dispatchEventImpl(Unknown Source)      at java.awt.Component.dispatchEvent(Unknown Source)      at java.awt.EventQueue.dispatchEvent(Unknown Source)      at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)      at java.awt.EventDispatchThread.run(Unknown Source)


hm, for applet I'm pretty sure it won't work.

Could you try running everything on the Linux machine?

Cheers,
  nik
I mean the application.
Another idea, on the linux, examine the listening sockets, on the NT as well, using netstat. If the expected listening sockets are not there this means the orb is not properly configured.

Also try running the Linux process with 'nohup java blablabla'.

Cheers,
  Nik
Nik
i tried everything in linux it is working. and it is showing the port when using netstat. I didn't get what is nohup java
how can i configure my linux server so that i can run client from windows machine
Hmm, I had a similar problem some time ago. The CORBA connection from our Solaris to the NT serves worked, however the other way around didn't. This does not help you much as my solution was to upgrade the orb to another version where this problem was not present.

To narrow further the problem whether it is a no connection at all or a non-bidirectional connection, you can run your applicaitons with exactly the opposite set-up. I believe it was the client on the NT and the server object on the + orb + NS on the linux. Now try it client on linux, server on NT.

Cheers,
 Nik
No it is not working otherway around
it is working only when i run server and tnameserv on NT and client on windows98
what could be the possible reason
nikki
More ideas:

May be the linux uses the ports of the orb for something else.
Try changing the initial port (on both machines).

Cheers,
  Nik
No it is not working otherway around
it is working only when i run server and tnameserv on NT and client on windows98
what could be the possible reason
nikki
I think I'm lost :-) Too many comments about computers that I cannot touch.

I think, your orb is misconfigured on one of the machines. Anyway, try changing (on each machine) the default orb ports to something like 5333, to see whether this is the problem in the Linux.

Cheers,
  Nik
Lol
Yup I will try
anyway thanx for your support
when i will get the solution i will get back to you
bye
Hi Nik
what is this nohup java
why it is used for and how can i use it
nikki
Hi Nik
what is this nohup java
why it is used for and how can i use it
nikki
I do not know exactly what 'nohup' is, but I do know that it helps sometimes on server processes, especially listening applications. nohup makes the application ignore 'hang-up' signals (if it already hasn't ignored them). In some cases, the kernel of the UNIX is configured to sent these on every process, just in case :-)

So, if you use the following line to start a java app in UNIX:
"java -cp /csad/casd/cas:/casc/casd ORBMainClass"
it shoudl become
"nohup java -cp /csad/casd/cas:/casc/casd ORBMainClass"

Try it out and tell me.

Cheers,
  Nik
Hi Nik
Thanx for yuor help. I got the things working and it was very silly thing.
I have to make entry of Linux server in hosts file in windows directory.
Thanx
bye
nikki
Yeah, tiny little detail.

Take care,
  Nik