Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2006, 08:30 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default First RMI Program

I have written a simple program for server and client .When
i run the program it is showing the error

The code for the server is


public class CustWorkImpl implements CustWork {
    public CustWorkImpl() throws RemoteException {
        UnicastRemoteObject.exportObject(this);
    }
    public String getSvrMsg() throws RemoteException {
        String threadName = Thread.currentThread().getName();
        String currTime = Calendar.getInstance().getTime().toString();
        System.out.println(threadName + "A Client Connected At: " + currTime);
        return (threadName + "A Client Connected At: " + currTime);
    }
    public static void main(String args[]) {
        try {
            if (System.getSecurityManager() == null) {
                System.setSecurityManager(new RMISecurityManager());
            }
            CustWorkImpl impl = new CustWorkImpl();
            Naming.rebind("workObj", impl);
            System.out.println("Server is Waiting");
        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println(ex);
        }
    }
}


java.security.AccessCont********************ception: access denied (java.net.SocketPermission 127.0.0.1:9000 connect,resolve)

what should be done to resolve this.

 
Old April 4th, 2006, 03:41 AM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should use the policy file .This file extenstion is policy And in this file
you set permission and Access level.For more information visit this link:

http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html








Similar Threads
Thread Thread Starter Forum Replies Last Post
call remote native program, rmi? shi Java Espanol 1 March 28th, 2005 09:42 PM
RMI newbie NickTheBubble J2EE 0 December 17th, 2004 07:59 AM
Why rmi don't run? Edward King J2EE 2 December 7th, 2004 05:41 AM
java.rmi.UnmarshalException malar J2EE 1 August 10th, 2004 07:27 AM
Problem running RMI melida J2EE 0 September 23rd, 2003 09:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.