Thanks for the replies.

The problem appears to be related to the double quotes that ant puts around
my arguments. This is what I got:

Ant version 1.4.1 compiled on October 11 2001
Buildfile: build.xml
Detected Java version: 1.4 in: /usr/local/j2sdk1.4.1_01/jre
Detected OS: Linux
parsing buildfile /home/mbowman/javaDce1.1/build.xml with URI =
file:/home/mbowman/javaDce1.1/build.xml
Project base dir set to: /home/mbowman/javaDce1.1
 [property] Loading /home/mbowman/javaDce1.1/build.properties
 [property] Override ignored for compile.debug
 [property] Override ignored for compile.deprecation
 [property] Override ignored for compile.optimize
Build sequence for target `test1' is [test1]
Complete build sequence is [test1, todo, clean, init, compile, javadocs,
run]

test1:
     [echo] Using -ORBInitialHost spoonrest
     [echo] Using -ORBInitialPort 12345
     [java] Forking /usr/local/j2sdk1.4.1_01/jre/../bin/java -classpath
/home/mbowman/javaDce1.1/classes Test1 "-ORBInitialHost spoonrest"
"-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: 2 seconds

The quotes don't show up when I list the arguments from within the program,
but their presence causes the program to fail, even from the command line.
Can I tell ant to omit the quotes?

> -----Original Message-----
> From: Sebastien BLANC [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 09, 2003 4:01 PM
> To: Ant Users List
> Subject: Re: Problems running CORBA program with ant
> 
> 
> use ant -v (verbose) to see the exact command that ant is lanching.
> copy paste into a shell script and see wat's ur pb.
> 
> check if the ORB.init is not a blocking call, it may be that 
> some of ur port
> nbrs are still open (when do u shutdown the ORB) ?
> 
> seb.
> 
> "Bowman, Michael W. (MBOWMAN)" wrote:
> 
> > 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
> > [EMAIL PROTECTED]
> > (410) 266-4876
> >
> > --
> > To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to