dcsimg
corba with java : errors on compilation...
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jam_idba
Posted On:   Thursday, February 10, 2005 07:22 AM

when i pass the object parameter to the method connect, it doesnt accept that parameter. i'm sure that connect is defined like this in the java sun doc : void connect(Object obj) Connects the given servant object (a Java object that is an instance of the server implementation class) to the ORB. Here are the errors : D:Documents and SettingsJamalDesktopHello>javac HelloServer.java HelloApp/*. java HelloServer.java:36: connect(org.omg.CORBA.Object) in org.omg.CORBA.ORB cannot b e applied to (HelloServant) orb.connect(helloRef); ^ HelloServer.java:45: rebind(org.omg.CosNaming.NameComponent[],org.omg.CORBA.Obje ct) in org.omg.CosNaming   More>>

when i pass the object parameter to the method connect, it doesnt accept that parameter. i'm sure that connect is defined like this in the java sun doc :


void connect(Object obj)
Connects the given servant object (a Java object that is an instance of the server implementation class) to the ORB.



Here are the errors :

D:Documents and SettingsJamalDesktopHello>javac HelloServer.java HelloApp/*.
java
HelloServer.java:36: connect(org.omg.CORBA.Object) in org.omg.CORBA.ORB cannot b
e applied to (HelloServant)
orb.connect(helloRef);
^



HelloServer.java:45: 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);
^


2 errors




and here's the code :




			


// The package containing our stubs.
import HelloApp.*;


// HelloServer will use the naming service.
import org.omg.CosNaming.*;


// The package containing special exceptions thrown by the name service.

import org.omg.CosNaming.NamingContextPackage.*;


// All CORBA applications need these classes.
import org.omg.CORBA.*;





class HelloServant extends HelloPOA
{
public String sayHello()
{
return "
Hello world!!
";

}
}

public class HelloServer
{
public static void main(String args[])
{
try{

// Create and initialize the ORB
ORB orb = ORB.init(args, null);

// Create the servant and register it with the ORB
HelloServant helloRef = new HelloServant();
//org.omg.CORBA.Object helloRef2 = (org.omg.CORBA.Object)helloRef;
orb.connect(helloRef);

// Get the root naming context
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);

// Bind the object reference in naming
NameComponent nc = new NameComponent("Hello", " ");
NameComponent path[] = {nc};
ncRef.rebind(path, helloRef);

// Wait for invocations from clients
java.lang.Object sync = new java.lang.Object();
synchronized(sync){
sync.wait();
}

} catch(Exception e) {
System.err.println("ERROR: " + e);
e.printStackTrace(System.out);
}
}
}




i followed the tutorial on this site :
http://java.sun.com/j2se/1.3/docs/guide/idl/tutorial/GSserver.html#understand    <<Less

Re: corba with java : errors on compilation...

Posted By:   Anonymous  
Posted On:   Wednesday, March 2, 2005 02:10 PM


I've got the same error when I compile with Javac.


I've got jdk 1.5.0 and it's runing IDL 3.1.



If someone could help,it would be great

About | Sitemap | Contact