exception in thread main

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    #1

    exception in thread main

    when i try to run the client application
    java HelloClient -ORBInitialPort 1050 -ORBInitialHost localhost
    i get an error exception in thread "main" java.lang.NoCla ssDefFoundError :HelloClient

    Code:
    // Copyright and License 
     
    import HelloApp.*;
    import org.omg.CosNaming.*;
    import org.omg.CosNaming.NamingContextPackage.*;
    import org.omg.CORBA.*;
    
    public class HelloClient
    {
      static Hello helloImpl;
    
      public static void main(String args[])
        {
          try{
            // create and initialize the ORB
    	ORB orb = ORB.init(args, null);
    
            // get the root naming context
            org.omg.CORBA.Object objRef = 
    	    orb.resolve_initial_references("NameService");
            // Use NamingContextExt instead of NamingContext. This is 
            // part of the Interoperable naming Service.  
            NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
     
            // resolve the Object Reference in Naming
            String name = "Hello";
            helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
    
            System.out.println("Obtained a handle on server object: " + helloImpl);
            System.out.println(helloImpl.sayHello());
            helloImpl.shutdown();
    
    	} catch (Exception e) {
              System.out.println("ERROR : " + e) ;
    	  e.printStackTrace(System.out);
    	  }
        }
    
    }
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by oll3i
    when i try to run the client application
    java HelloClient -ORBInitialPort 1050 -ORBInitialHost localhost
    i get an error exception in thread "main" java.lang.NoCla ssDefFoundError :HelloClient

    Code:
     
    // Copyright and License 
     
    import HelloApp.*;
    import org.omg.CosNaming.*;
    import org.omg.CosNaming.NamingContextPackage.*;
    import org.omg.CORBA.*;
     
    public class HelloClient
    {
    static Hello helloImpl;
     
    public static void main(String args[])
    {
    try{
    // create and initialize the ORB
    	ORB orb = ORB.init(args, null);
     
    // get the root naming context
    org.omg.CORBA.Object objRef = 
    	 orb.resolve_initial_references("NameService");
    // Use NamingContextExt instead of NamingContext. This is 
    // part of the Interoperable naming Service. 
    NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
     
    // resolve the Object Reference in Naming
    String name = "Hello";
    helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
     
    System.out.println("Obtained a handle on server object: " + helloImpl);
    System.out.println(helloImpl.sayHello());
    helloImpl.shutdown();
     
    	} catch (Exception e) {
    System.out.println("ERROR : " + e) ;
    	 e.printStackTrace(System.out);
    	 }
    }
     
    }
    Did you compile (javac) first?

    Comment

    • oll3i
      Contributor
      • Mar 2007
      • 679

      #3
      yes i did javac HelloClient.jav a HelloApp/*.java

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by oll3i
        yes i did javac HelloClient.jav a HelloApp/*.java
        Did it compile successfully? Also are you using the correct path when calling the java command?

        Comment

        • oll3i
          Contributor
          • Mar 2007
          • 679

          #5
          it complies with 2 notes
          note:HelloApp\H elloPOA.java uses unchecked or unsafe operations
          note:Recompile with -Xlint:unchecked for details

          Comment

          Working...