Помогите, плз, пример "с книжки" не работает!
Сервер:
// The package containing our stubs.
import HelloWorld.*;
// 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.*;
import org.omg.PortableServer.*;
public class HelloServer
{
public static void main(String args[])
{
try{
// Create and initialize the ORB
ORB orb = ORB.init(args, null);
// Create the servant object
HelloServant helloRef = new HelloServant();
POA rootpoa=POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
org.omg.CORBA.Object ref= rootpoa.servant_to_reference(helloRef);
Hello href=HelloHelper.narrow(ref);
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
NameComponent path[] = ncRef.to_name("HelloWorld");
ncRef.rebind(path, href);
System.out.println("HelloServer is running...");
orb.run();
} catch(Exception e) {
System.err.println("ERROR: " + e);
e.printStackTrace(System.out);
}
}
}
class HelloServant extends HelloPOA
{
int i=0;
public String sayHello(String Name)
{
i++;
return "The world says HELLO to " + Name + " for the " + i + ". time.";
}
}
создаю апплет- клиент>
// The package containing our stubs.
import HelloWorld.*;
// HelloClient 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.*;
// Needed for the applet.
import java.awt.Graphics;
public class HelloApplet extends java.applet.Applet
{
public void init()
{
try{
// Create and initialize the ORB
// The applet 'this' is passed to make parameters from the tag
// available to initialize the ORB
ORB orb = ORB.init(this, null);
// Get the root naming context
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
// Resolve the object reference in naming
NameComponent nc = new NameComponent("HelloWorld", " ");
NameComponent path[] = {nc};
Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));
// Call the Hello server object and print the results
message = helloRef.sayHello(" Applet! ");
} catch(Exception e) {
System.out.println("HelloApplet exception: " + e);
e.printStackTrace(System.out);
}
}
String message = " ";
public void paint(Graphics g)
{
g.drawString(message, 25, 50);
}
}
HTML >
<HTML>
<!--Copyright 2000, Sun Microsystems, Inc. -->
<HEAD>
<TITLE>Getting Started with Java IDL: Running HelloApplet</TITLE>
<X-SAS-WINDOW TOP=42 BOTTOM=477 LEFT=4 RIGHT=534>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1 ALIGN=CENTER>Running the Hello World Applet</H1>
<HR>
<P>If all goes well, the applet appears below:
<P>
<APPLET CODE=HelloApplet.class
WIDTH=500
HEIGHT=300>
<PARAM name="org.omg.CORBA.ORBInitialHost" value="127.0.0.1">
<PARAM name="org.omg.CORBA.ORBInitialPort" value=1050>
</APPLET>
</BODY>
</HTML>
В броузере Mozilla получаю ошибку>
com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.0.1; port: 1050"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
... 14 more
и т.п.
дело в том что без броузера все по туториалу работает, так что фишка в нем (не пропускает IIOP что ли, тогда как установить?...)
обьясните плз!