469,964 Members | 1,827 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

exception in thread main

oll3i
679 512MB
when i try to run the client application
java HelloClient -ORBInitialPort 1050 -ORBInitialHost localhost
i get an error exception in thread "main" java.lang.NoClassDefFoundError:HelloClient

Expand|Select|Wrap|Line Numbers
  1.  
  2. // Copyright and License 
  3.  
  4. import HelloApp.*;
  5. import org.omg.CosNaming.*;
  6. import org.omg.CosNaming.NamingContextPackage.*;
  7. import org.omg.CORBA.*;
  8.  
  9. public class HelloClient
  10. {
  11.   static Hello helloImpl;
  12.  
  13.   public static void main(String args[])
  14.     {
  15.       try{
  16.         // create and initialize the ORB
  17.     ORB orb = ORB.init(args, null);
  18.  
  19.         // get the root naming context
  20.         org.omg.CORBA.Object objRef = 
  21.         orb.resolve_initial_references("NameService");
  22.         // Use NamingContextExt instead of NamingContext. This is 
  23.         // part of the Interoperable naming Service.  
  24.         NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
  25.  
  26.         // resolve the Object Reference in Naming
  27.         String name = "Hello";
  28.         helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
  29.  
  30.         System.out.println("Obtained a handle on server object: " + helloImpl);
  31.         System.out.println(helloImpl.sayHello());
  32.         helloImpl.shutdown();
  33.  
  34.     } catch (Exception e) {
  35.           System.out.println("ERROR : " + e) ;
  36.       e.printStackTrace(System.out);
  37.       }
  38.     }
  39.  
  40. }
  41.  
  42.  
  43.  
Apr 16 '07 #1
4 2425
r035198x
13,262 8TB
when i try to run the client application
java HelloClient -ORBInitialPort 1050 -ORBInitialHost localhost
i get an error exception in thread "main" java.lang.NoClassDefFoundError:HelloClient

Expand|Select|Wrap|Line Numbers
  1.  
  2. // Copyright and License 
  3.  
  4. import HelloApp.*;
  5. import org.omg.CosNaming.*;
  6. import org.omg.CosNaming.NamingContextPackage.*;
  7. import org.omg.CORBA.*;
  8.  
  9. public class HelloClient
  10. {
  11. static Hello helloImpl;
  12.  
  13. public static void main(String args[])
  14. {
  15. try{
  16. // create and initialize the ORB
  17.     ORB orb = ORB.init(args, null);
  18.  
  19. // get the root naming context
  20. org.omg.CORBA.Object objRef = 
  21.      orb.resolve_initial_references("NameService");
  22. // Use NamingContextExt instead of NamingContext. This is 
  23. // part of the Interoperable naming Service. 
  24. NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
  25.  
  26. // resolve the Object Reference in Naming
  27. String name = "Hello";
  28. helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
  29.  
  30. System.out.println("Obtained a handle on server object: " + helloImpl);
  31. System.out.println(helloImpl.sayHello());
  32. helloImpl.shutdown();
  33.  
  34.     } catch (Exception e) {
  35. System.out.println("ERROR : " + e) ;
  36.      e.printStackTrace(System.out);
  37.      }
  38. }
  39.  
  40. }
  41.  
  42.  
  43.  
Did you compile (javac) first?
Apr 16 '07 #2
oll3i
679 512MB
yes i did javac HelloClient.java HelloApp/*.java
Apr 16 '07 #3
r035198x
13,262 8TB
yes i did javac HelloClient.java HelloApp/*.java
Did it compile successfully? Also are you using the correct path when calling the java command?
Apr 17 '07 #4
oll3i
679 512MB
it complies with 2 notes
note:HelloApp\HelloPOA.java uses unchecked or unsafe operations
note:Recompile with -Xlint:unchecked for details
Apr 17 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Joe Wong | last post: by
5 posts views Thread by Dan Cimpoiesu | last post: by
44 posts views Thread by craig | last post: by
9 posts views Thread by Claudio Di Flumeri | last post: by
5 posts views Thread by Lucvdv | last post: by
16 posts views Thread by Chuck Cobb | last post: by
2 posts views Thread by Mahesh Devjibhai Dhola | last post: by
1 post views Thread by Frank Millman | last post: by
7 posts views Thread by Brendon Costa | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.