Hi Waimun,
In pramati server 2.5 there is no RMI registry running in a separate VM.
When you tried to bind the remote object/server RMI could not locate the
RMIRegistry and Exception was thrown. Any remote object that you want to
bind have to be bound to the Pramati Naming service and binding permission
is required.
Please use the following properties inside the initialize method.
public void initialize() {
Properties env = new Properties();
try{
env.put("java.naming.factory.initial","com.pramati.naming.client.PramatiClie
ntContextFactory");
env.put("java.naming.provider.url","rmi://127.0.0.1:9191");
env.put(Context.SECURITY_PRINCIPAL,"root");
env.put(Context.SECURITY_CREDENTIALS,"pramati");
env.put("com.pramati.naming.realm","system");
Context initialContext = new InitialContext(env);
SimpleSvr ls = new SimpleSvr();
initialContext.rebind("SimpleSvr", ls);
}catch(){}
Please make sure Context.SECURITY_PRINCIPAL has binding permission.
In case of any problem please get back to me.
Regards,
Gautam
Server Team
www.pramati.com
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, July 05, 2001 8:56 AM
Subject: Binding rmi server to rmiregistry during startup hook
> Hi Gautam,
>
> I've sent a mail with the address <[EMAIL PROTECTED]> previously,
but
> i'm sending this again to add more details.
>
> Basically, I've created a simple class ("SimpleSvr") that extends
> UnicastRemoteObject and implements a remote interface. At the Application
> startup hook,
> i instantiated the class and binds it to the rmiregistry. Below is the
> initialize method of my startup hook.
>
> public void initialize() {
> env = new Hashtable();
>
>
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.pramati.naming.client.PramatiCl
ientContextFactory");
> env.put(Context.PROVIDER_URL, "rmi://localhost:9191/");
> try {
> ctx = new InitialContext(env);
> }
> catch(Exception e) {
> System.out.println("Init: could not create naming context");
> }
> try {
> reg = LocateRegistry.getRegistry("localhost", 9191);
> try {
> SimpleSvr ls = new SimpleSvr();
> reg.rebind("SimpleSvr", ls);
> System.out.println("SimpleSvr bounded to registry");
> } catch (Exception e) {
> System.out.println("SimpleSvr err: " + e.getMessage());
> e.printStackTrace();
> }
> } catch(Exception e) {
> try {
> reg = LocateRegistry.createRegistry(9191);
> } catch(Exception e2) {
> System.out.println(
> "Init: could not create/get RMI registry ");
> }
> }
>
>
> I've set the codebase system property in the ./runadmin.sh of Pramati2.5
as
> shown.
>
/usr/local/jdk1.3/bin/java -Djava.rmi.server.codebase=file:///home/pramati/
> -Djava.security.policy=/home/pramati/policy com.pramati.ManagementConsole
> $1 $2
>
> And i've put the stub and implementation classes of SimpleSvr under the
> codebase.
> Also, the stub classes are not included anywhere in the classpath.
>
> In case you have not receive my previous mail, the error msg was this:
>
> java.rmi.MarshalException: Error marshaling transport header; nested
> > exception is:
> > java.net.SocketException: Connection reset by peer: Connection
> > reset by peer
> > java.net.SocketException: Connection reset by peer: Connection reset by
> > peer
> > at java.net.SocketInputStream.socketRead(Native Method)
> > at java.net.SocketInputStream.read(SocketInputStream.java:86)
> > at
> > java.io.BufferedInputStream.fill(BufferedInputStream.java:186)
> > at
> > java.io.BufferedInputStream.read(BufferedInputStream.java:204)
> > at java.io.DataInputStream.readByte(DataInputStream.java:222)
> > at
> > sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:206)
> > at
> > sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
> > at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
> > at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
> > at java.rmi.Naming.bind(Naming.java:111)
>
>
> I would greatly appreciate if you can reply me promptly.
> Thanks so much in advance!!
>
> regards,
> Waimun
>
>
>