473,320 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Getting Started with Java IDL:Developing the Hello World Server

oll3i
679 512MB
i m trying to write a hello world server but i get the following 3 errors
cd u please help me

javac HelloServer.java HelloApp/*.java
HelloServer.java:52: cannot find symbol
symbol: class _HelloImplBase
class HelloServant extends _HelloImplBase
^
HelloServer.java:26: connect(org.omg.CORBA.Object) in org.omg.CORBA.ORB cannot b
e applied to (HelloServant)
orb.connect(helloRef);
^
HelloServer.java:35: rebind(org.omg.CosNaming.NameComponent[],org.omg.CORBA.Obje
ct) in org.omg.CosNaming.NamingContextOperations cannot be applied to (org.omg.C
osNaming.NameComponent[],HelloServant)
ncRef.rebind(path, helloRef);
^
Note: HelloApp\HelloPOA.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
Mar 21 '07 #1
3 2493
oll3i
679 512MB
and the hello server looks like this

Expand|Select|Wrap|Line Numbers
  1. // The package containing our stubs.
  2. import HelloApp.*;
  3.  
  4. // HelloServer will use the naming service.
  5. import org.omg.CosNaming.*;
  6.  
  7. // The package containing special exceptions thrown by the name service.
  8. import org.omg.CosNaming.NamingContextPackage.*;
  9.  
  10. // All CORBA applications need these classes.
  11. import org.omg.CORBA.*;
  12.  
  13.  
  14.  
  15. public class HelloServer 
  16. {
  17.   public static void main(String args[])
  18.   {
  19.     try{
  20.  
  21.       // Create and initialize the ORB
  22.       ORB orb = ORB.init(args, null);
  23.  
  24.       // Create the servant and register it with the ORB
  25.       HelloServant helloRef = new HelloServant();
  26.       orb.connect(helloRef);
  27.  
  28.       // Get the root naming context
  29.       org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
  30.       NamingContext ncRef = NamingContextHelper.narrow(objRef);
  31.  
  32.       // Bind the object reference in naming
  33.       NameComponent nc = new NameComponent("Hello", " ");
  34.       NameComponent path[] = {nc};
  35.       ncRef.rebind(path, helloRef);
  36.  
  37.       // Wait for invocations from clients
  38.       java.lang.Object sync = new java.lang.Object();
  39.       synchronized(sync){
  40.         sync.wait();
  41.       }
  42.  
  43.     } catch(Exception e) {
  44.         System.err.println("ERROR: " + e);
  45.         e.printStackTrace(System.out);
  46.       }  
  47.   }
  48. }
  49.  
  50.  
  51.  
  52. class HelloServant extends _HelloImplBase
  53. {
  54.   public String sayHello()
  55.   {
  56.     return "\nHello world!!\n";
  57.  
  58.   }
  59. }
  60.  
  61.  
  62.  
Mar 21 '07 #2
oll3i
679 512MB
idlj -fall Hello.idl didnt generate the _HelloImplBase.java
Mar 21 '07 #3
Instead of trying "idlj -fall Hello.idl" command try this command "idlj -fall -oldImplBase -keep Hello.idl". This command will generate _HelloImplBase.java. Then go to HelloServer.java --->> add one more empty member function to the class "HelloServant"
public void shutdown()
{

}
Hope this will help. :-)
Feb 20 '14 #4

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

Similar topics

6
by: Robert Maas, see http://tinyurl.com/uh3t | last post by:
System login message says PHP is available, so I tried this: http://www.rawbw.com/~rem/HelloPlus/h.php It doesn't work at all. Browser just shows the source. What am I doing wrong?
0
by: Benoît | last post by:
Hi, I have a problem with the string array type. I want to send a string array from the php client to the java server (Webservice with SOAP). Here is the code : ----- Java server method : -----...
5
by: kaiwing18 | last post by:
Hi, I have a simple java server program, i want to ask how can i output a simple HTML page of error message, without calling a html file. That means i want to type HTML codes in the program...
2
by: Rajesh | last post by:
Hi, We have a socket server app in Java and the client application in C++. When we try to connect 60 clients simultaneously from C++ using threads, only 55-56 connections are successfull, rest...
1
by: tmb | last post by:
Is there a Java Server that will run on the clients machine for doing web development without having up upload the web page to an actual server for testing? Microsoft once had one called...
4
by: sai | last post by:
Hi.. Thanks to all I am a fresher want to build my carrier in programming field .. please give me u r valuable suggisition .. that.. how can i build my career in java world?
0
by: Vinutha | last post by:
I have designed one xhtml page using frameset, where i have included 3 frames to make one page, ie. one for header, one for menuTree & one for body, This is my code, <!DOCTYPE html PUBLIC...
1
by: Yonin | last post by:
Hi all, A question about hybrid systems: Any idea how I can make my JAVA server talk with my MMI client, that must be written in C#? Thank's. Yoni
1
by: nelsonbrodyk | last post by:
Hey All, I currently have C# clients, and I want them to talk to a Java server side running on Glassfish application server. I am wondering if anyone has some options outside of webservices, as...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.