ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bowman, Michael W. (MBOWMAN)" <MBOW...@arinc.com>
Subject Problems running CORBA program with ant
Date Thu, 09 Jan 2003 20:55:07 GMT
Hello all,

I'm having problems running a simple test program using the Java 1.4.1_01
implementation on Linux.

The small test program looks like this:

//Test1.java
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
import java.util.*;

public class Test1 {
   public static void main(String[] args) {
      System.out.print("args: ");
      for(int i = 0; i < args.length; i++) {
         System.out.print(args[i] + " ");
      }
      System.out.println("");
      try {
         ORB orb = ORB.init(args, null);
         System.out.println("Initialized orb");
         String[] services = orb.list_initial_services();
         System.out.println("Got list of services:");
         for(int i = 0; i < services.length; i++) {
            System.out.println("  " + services[i]);
         }
      } catch(Exception e) {
         System.out.println("Exception thrown " + e);
      }
   }
}

All this is doing is listing the initial services available when the orb is
started.

When I run this from the command line using: 
   java Test1 -ORBInitialHost spoonrest -ORBInitialPort 12345
I get:
   args: -ORBInitialHost spoonrest -ORBInitialPort 12345 
   Initialized orb
   Got list of services:
     ServerActivator
     ServerLocator
     NameService
     InitialNameService
     ServerRepository
     TNameService
     RootPOA
     CodecFactory
     DynAnyFactory
     POACurrent
     PICurrent

Everythink works OK. But, when I use the following Ant task:
   <target name="test1">
      <echo message="Using -ORBInitialHost ${cosname.host}"/>
      <echo message="Using -ORBInitialPort ${cosname.port}"/>
      <java fork="true" classname="Test1">
         <classpath refid="run.classpath"/>
         <arg value="-ORBInitialHost ${cosname.host}"/>
         <arg value="-ORBInitialPort ${cosname.port}"/>
      </java>
   </target>

I get:
   Buildfile: build.xml

   test1:
     [echo] Using -ORBInitialHost spoonrest
     [echo] Using -ORBInitialPort 12345
     [java] args: -ORBInitialHost spoonrest -ORBInitialPort 12345 
     [java] Initialized orb
     [java] Exception thrown org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor
code: 201  completed:    No

   BUILD SUCCESSFUL

   Total time: 3 seconds

You can see that the program is getting the command line arguments from Ant
correctly. The Ant properties appear to be set up correctly. Does anyone
have any idea why this doesn't work?

Thanks in advance for the help.
---------------------------------
Michael Bowman
mbowman@arinc.com
(410) 266-4876

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message