Duplex RMI applications

Hi,
I'm new to RMI and I have got the basic applications running well. I need to create two objects running in two hosts (Say x and y), and when an action occurs at object x, that calls a method of object y (in the other host). Then object y will respond by calling a method of the original object x.
I bound the clint to the registry and tried to implementy the client like behaviour in the server side appImpl class. But when the Server class calls the Impl, it waits forever!! after a while it comes up with the following exceptions:
java.rmi.ConnectException: Connection refused to host: (remote IP); nested Exception is: java.net.ConnectException: Connection timed out
cant the server listen to client calls as well as send its own client like calls at the same time?

Don't run a registry on the first host. Instead, on the first host, define an object that implements UnicastRemoteObject. Have your first host pass a reference to the other host. The other host can then make remote "callbacks" to the first host.
This pattern assumes that communications are really initiated by one host.

Similar Messages

  • Help needed in running the RMI application with multiple clients

    Hi
    I have my RMI application with one server and 6 clients. I keep all the server and client programs in the same directory. When i run the clients, the first 2 clients work properly but when the third or the fourth client starts, it works normally in getting the data and after a while it crashes. If teh third crashes the 4th works and if the 4th crashes the 3rd, 4th and 5th works ...randomly atleast one or 2 clients crash always.
    following is the error message generated for a client named controller:
    [ code ]
    Exception in thread "main" java.lang.NullPointerException
    at PostOfficeImpl.isinputAvail(PostOfficeImpl.Java:315)
    at PostOfficeImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun,rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun,rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun,rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    at sun,rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:595)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
    at PostOfficeImpl_Stub.isinputAvail(Unknown Source)
    at CONTROLLER.main(CONTROLLER.java:167)
    my ser ver program is as follows:
    class PostOfficeServer extends java.rmi.server.UnicastRemoteObject implements java.rmi.Remote {
    // Instance of ourselves
    public static String name;
    private static PostOfficeServer rmi;
    // public No-argument constructor
    public PostOfficeServer() throws RemoteException {
         super();
    public static void main(String[] args){
    if(System.getSecurityManager() == null) {
         System.setSecurityManager(new RMISecurityManager());
    try {
         new PostOfficeServer();
         PostOffice postOfficeserver = new PostOfficeImpl();
    try {
         getIP ipAdd1 = new getIP();
         String ip1 = ipAdd1.getIP();
         name = "//" + ip1 + "/PostOffice";
    catch (Exception e){
         System.out.println();
    Naming.rebind(name, postOfficeserver);
    System.out.println("RemoteServer bound");
    System.out.println("initialise Data Structure");
    postOfficeserver.initDatastructure();
    System.out.println("initilised");
    catch (java.rmi.RemoteException e) {
         System.out.println("Cannot create remote server object");
    catch (java.net.MalformedURLException e) {
         System.out.println("Cannot look up server object");
    System.out.println("Server started.");
    System.out.println("Enter <CR> to end.");
    try {
         int serve2end = System.in.read();
    }catch (IOException ioException) {
    System.exit(0);
    //endoffilePlease advise as this is very urgent

    Hi
    the following is the code for PostOfficeImpl...its a long code but i include it so that I get your help please...
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.rmi.RemoteException;
    import java.util.HashMap;
    import java.util.*;
    public class PostOfficeImpl extends java.rmi.server.UnicastRemoteObject implements PostOffice {
    //Implementations must have an explicit constructor in order to declare the
    //RemoteException exception
    public PostOfficeImpl() throws java.rmi.RemoteException {
         super();
    public static LinkedListImpl list = new LinkedListImpl();
    public static oListImpl ovarList  = new oListImpl();
    public static iListImpl ivarList =new iListImpl();
    public static lipsList llfirst;
    public static oList opchannel, ofirst, onext;
    public static iList ipchannel, ichan, ifirst;
    public static  String[] variNumber= new String[100];
    public static String[] inoutChan, inChan, outChan,inVAR, invarLIST,outVAR, outvarLIST ;
    public static String[][] driveMat;
    DriverMatrix_mthds drive = new DriverMatrix_mthds();
    private static  Boolean All_Vacant;
    private static  Boolean tAll_Vacant;
    public void sendAll_Vacant(Boolean All_Vacant) throws RemoteException {
         tAll_Vacant = All_Vacant;
    public Boolean getAll_Vacant() throws RemoteException{
          return tAll_Vacant;
    public  void initDatastructure() throws RemoteException{
    ifirst = null;
    ofirst=null;
    int i=0, j=0, k=0, ind1=0, ind2=0;
    try{/// initialise list
         drive = new DriverMatrix_mthds();
         drive.VarTypeArray();
         drive.nodeHeadVarType();
         String[] variablel = drive.Variablelist();
         drive.lipsvariablist();
         drive.NodeOrigin();
    drive.nodeInput();
         drive.numOfnodes();
         drive.noOfVariables();
         drive.Assignlist();
         drive.novarType();
         drive.varNameType();
         drive.nodeNumName();
         drive.driverMat();
         String[][] lookupvar = drive.varNameType();
         //tempdrive = drive.driverMat();
         long leng1 = variablel.length;
         int varlistlength = (int) leng1;
         int counter;
         String s1="";
         String s2="";
         String s3 = "";
         String s4 = "";
         String s6 = "";
         int s5=0, c=0;
         while(variablel[k] !=null){
              k=k+1;
         int i1, j1;
         String  varname, varnumber;
         varnumber = "";
    while(i<=variablel.length-1){
         if(variablel!=null){
         c=c+1;
         i=i+1;
    try{
         ind1=0; ind2 = 0;i=0;
    while(!(variablel[i].equals("end of file"))){
         s1 = variablel[i];
         i=i+1;
         s2 = variablel[i];
         i=i+1;
         System.out.println("     " + s1+"     "+s2);
    while(!(variablel[i].equals("end of input variable"))){
         s4 = variablel[i];
         i1=0;
         Brkwhile:while(i1<=lookupvar.length-1){
         j1=1;
         if(lookupvar[i1][j1] != null){
         if(lookupvar[i1][j1].equals(s4)){
              s3 = lookupvar[i1][0];
              break Brkwhile;
         i1=i1+1;
    //ifirst.varNum = varnumber;
    s5 = 0;
    s6 = null;
    ifirst= new iList(s3,s4, s5, s6);
    ivarList.add(ifirst);
    System.out.println(s3+"     "+s4+"     "+s5+"     "+s6);
    i=i+1;
    i = i + 1;
    System.out.println("input list finished ");
    while(!(variablel[i].equals("end of output variable"))){
         s4 = variablel[i];
         i1=0;
         j1=1;
         Brkwhile:while(lookupvar[i1][j1] != null){
              if(lookupvar[i1][j1].equals(s4)){
              s3 = lookupvar[i1][0];
              break Brkwhile;
         i1=i1+1;
         s5 = 0;
         s6 = null;
         ofirst= new oList(s3,s4, s5, s6);
         ovarList.add(ofirst);
         System.out.println(s3+"     "+s4+"     "+s5+"     "+s6);
         i=i+1;
         llfirst = new lipsList(s1, s2, ivarList, ovarList);
         list.add(llfirst);
         System.out.println("output list finished ");
         i=i+1;
         catch (NullPointerException ne){
         catch (Exception d){}
    public int isitOK(reqPacket sndNodetail)
         throws RemoteException{
         String nodnum = sndNodetail.srcNum;
         String varnum = sndNodetail.varNum;
         int status = 0;
         llfirst = list.getFirst();
         try{mainbegin:while (llfirst != null){
              if((llfirst.nodeNum).equals(nodnum)){
              ofirst = ovarList.getFirst();
              while(ofirst != null){
                   if((ofirst.varNum).equals(varnum)){
                   if(ofirst.varVal==null){
                   status = 1;
                   break mainbegin;
         ofirst = ofirst.next;
         llfirst = llfirst.next;
         catch (NullPointerException nl){}
         return status;
    public int senData(dataPacket sendToRTS)
         throws RemoteException{
    dataPacket datDetail = sendToRTS;
    String nnum, vnum,typename, dval;
    String dtype = "";
    nnum = datDetail.nodeNum;
    vnum = datDetail.varNum;
    typename = datDetail.dataType;
    dval = String.valueOf(datDetail.dataVal);
    String [][] tempdrive, varnametype;
    int status =0;
    System.out.println("data received is from node " nnum " is "+ dval+"var num " +vnum);
    status =0;
    try{
    //DriverMatrix_mthds drive = new DriverMatrix_mthds();
    drive.VarTypeArray();
    drive.Variablelist();
    drive.NodeOrigin();
    drive.nodeInput();
    drive.numOfnodes();
    drive.noOfVariables();
    String[][] lookupvar = drive.novarType();
    drive.varNameType();
    drive.nodeNumName();
    drive.driverMat();
    tempdrive = drive.driverMat();
    String varname="";
    int i,j;
    //with the recived var name get the var num
    for(i=0; i<=lookupvar.length-1; i++){
         j=0;
         if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(typename)){
                   dtype = lookupvar[i][1];
         }//varname is moved to dtype n used for checking
         for(i=0; i<=tempdrive.length-1; i++){j=0;
         if (tempdrive[i][j] != null){
         if (tempdrive[i][0].equals(vnum)){
              if (tempdrive[i][1].equals(nnum)){
              if(tempdrive[i][2].equals(dtype)){
              status = 1;
         }//System.out.println("received data " vnum " "+ nnum +" " + dtype +" "+dval);// after checking status if the status is 1 then set the counter n olist// to no of times the value has to be ditributed
    int Ccount =0;
    //opchannel = llfirst.olist;
    try{
         System.out.println("status"+status);
         if (status == 1){
              llfirst = list.getFirst();
         mainWhile: while (llfirst != null){
              if((llfirst.nodeNum).equals(nnum)){
                   ofirst = ovarList.getFirst();
                   while(ofirst != null){
                   if((ofirst.varNum).equals(vnum)){
                        ofirst.varVal =dval;
                        //setting the counter for the varname
                        //check driver matrix fr the no of occurances
                   for(i=0; i<=tempdrive.length-1; i++){
                   j=0;
                   if (tempdrive[i][j] != null){
                        if (tempdrive[i][0].equals(vnum)){
                        for(j= j+3;j<=tempdrive.length-1;j++){
                        if(tempdrive[i][j] != null){
                        if(tempdrive[i][j].equals("1")){
                        Ccount = Ccount + 1;
    System.out.println("count"+Ccount);
    ofirst.counter = Ccount;
    ofirst.varNum = vnum;for(i=0; i<=lookupvar.length-1; i++){
    for(j=0; j<=2; j++){
         if(lookupvar[i][j] != null){
         if(lookupvar[i][j].equals(vnum)){
              varname = lookupvar[i][1];
         ofirst.varName = varname;
         Ccount=0;
         break mainWhile;
         ofirst = ofirst.next;
         llfirst = llfirst.next;
         catch(NullPointerException s){}
    /*use the vnum in the driver matrix and find out the nodes to which this variable
    *has been sent as input , i mean destination nodes..
    *find the node numbers ..knowing the node numbers parse through data structure
    and set the input values to value and status 1./
    llfirst = list.getFirst();
    while(llfirst != null){
         ifirst = llfirst.ilist.getFirst();
         while(ifirst != null){
              if (ifirst.varNum.equals(vnum)){
              ifirst.varStat = 1;
              ifirst.varVal = dval;
              //     System.out.println("nodenum "+llfirst.nodeNum+" varval     " + ifirst.varVal +"     stat "+ifirst.varStat+" vnum " + ifirst.varNum);
         ifirst=ifirst.next;
         llfirst=llfirst.next;
         catch (Exception e){};
         return status;
    public int isinputAvail(reqPacket inputReq)
         throws RemoteException{
         String srcnum = inputReq.srcNum;
         String varnum = inputReq.varNum;
         int availstatus =0;
         llfirst = list.getFirst();
         //System.out.println("llfirst.nodeNum     "+ llfirst.nodeNum);
         whileloop:while (llfirst != null){
              if((llfirst.nodeNum).equals(srcnum)){
              ifirst = llfirst.ilist.getFirst();
              breakloop: while(ifirst != null){
              //System.out.println("var num " + varnum + "     " + "status outside" + ifirst.varStat);
              if((ifirst.varNum).equals(varnum)){
              if (ifirst.varStat == 1){
                   availstatus = 1;
                   ifirst.varStat = 0;
                   // System.out.println("var num " + varnum + "     " + "status" + availstatus);
                   break whileloop;
         ifirst = ifirst.next;
         llfirst = llfirst.next;
         //System.out.println("var num " + varnum + "     " + "status" + availstatus);
         return availstatus;
    public dataPacket senDatatoNode(reqPacket sendFromRTS)
         throws RemoteException {
         String nnum, vnum, dtype, dval;
         //nnum = "";
         dtype="";
         //opchannel = llfirst.olist;
         //     ipchannel = llfirst.ilist;
         reqPacket sendfromrts = sendFromRTS;
         nnum = sendfromrts.srcNum;
         vnum = sendfromrts.varNum;
         //     dtype = sendFromRTS.dataType;
         dval = "";
         int ctrchk=0;
         try{
         //send data to process node n reduce the counter by 1
         llfirst = list.getFirst();
              mainWhile: while (llfirst != null){
              if((llfirst.nodeNum).equals(nnum)){
              ofirst = llfirst.olist.getFirst();
         whileofirst: while(ofirst != null){
              if((ofirst.varNum).equals(vnum)){
              dval = ofirst.varVal;
              ofirst.counter = ofirst.counter - 1;
              //     System.out.println(ofirst.counter);
              ctrchk=ofirst.counter;
              break whileofirst;
         ofirst = ofirst.next;
    //set the status of respective input channel to 0 as data has been sent
         ifirst = llfirst.ilist.getFirst();
         if(ctrchk == 0){
         whileifirst: while(ifirst != null){
              if((ifirst.varNum).equals(vnum)){
              //ifirst.varVal = dval;
              ifirst.varStat =0;
              break whileifirst;
         llfirst = llfirst.next;
         //System.out.println(llfirst);
         catch(NullPointerException s){}
    //find type
    try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType()     ;
         String[][] lookupvar = driver.varNameType();
         int i, j;
         String varNum = vnum;
         for(i=0; i<=lookupvar.length-1; i++){
              j=0;
              if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(vnum)){
              dtype = lookupvar[i][2];
         catch (Exception d){}
         dataPacket retpac = new dataPacket(nnum, vnum, dtype, dval);
         System.out.println("msg sent "+ nnum +"     " + vnum+" "+ dtype+"     "+ dval);
         return retpac;
    public String findnodeName(String nodeNum)
         throws RemoteException{
    String nnum = nodeNum;
    llfirst = list.getFirst();
    while (llfirst != null){
         if((llfirst.nodeNum).equals(nnum)){
         return llfirst.nodeName;
         llfirst = llfirst.next;
         System.out.println("node Number does not match with the list of node numbers generated..try again");
         return null;
    //find the nodenum given the node name
    public String findnodenum(String nodename)
         throws RemoteException{
         String nodenumber ="";
         String nodname = nodename;
         try{DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType()     ;
         driver.varNameType();
         String[][] lookupnode = driver.nodeNumName();
         int i, j;
         for(i=0; i<=lookupnode.length-1; i++){
         for(j=0; j<=2; j++){
              if(lookupnode[i][j] != null){
              if(lookupnode[i][j].equals(nodname)){
                   nodenumber = lookupnode[i][2];
         catch (Exception d){}
         return nodenumber;
    public String findvarnum(String variablename)
         throws RemoteException{
         String varnumber = "";
         try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType()     ;
         String[][] lookupvar = driver.varNameType();
         int i, j;
         String varname = variablename;
         for(i=0; i<=lookupvar.length-1; i++){
         for(j=0; j<=2; j++){
              if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(varname)){
                   varnumber = lookupvar[i][0];
    catch (Exception d){}
    return varnumber;
    public String findvartype(String varname)
         throws RemoteException{
         String vartype = "";
         try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         driver.novarType();
         String[][] lookupvar = driver.varNameType();
         int i, j;
         String varName = varname;
         for(i=0; i<=lookupvar.length-1; i++){
         for(j=0; j<=2; j++){
              if(lookupvar[i][j] != null){
              if(lookupvar[i][j].equals(varName)){
                   vartype = lookupvar[i][2];
    catch (Exception d){}
    return vartype;
    public String findtypenum(String vartype){
    String varnum = "";int i;
    try{
         DriverMatrix_mthds driver = new DriverMatrix_mthds();
         driver.VarTypeArray();
         driver.Variablelist();
         driver.NodeOrigin();
         driver.nodeInput();
         driver.numOfnodes();
         driver.noOfVariables();
         String varNum[][] =      driver.novarType()     ;
         String varType = vartype;
         for(i=0; i<=9-1; i++){
              if(varNum[i][0] != null){
              if(varNum[i][0].equals(varType)){
                   varnum = varNum[i][1];
    catch (Exception d){}
    return vartype;
    //return input variable list
    public String[] inoutchanlist(String nodenum, String nodenam)
         throws RemoteException{
    try{
         DriverMatrix_mthds drive = new DriverMatrix_mthds();
         String[] varLIST = drive.Variablelist();
         int i=0;int j;
         while(varLIST[i]!=null){
              i=i+1;
         int arrlength = i;
         inoutChan = new String[arrlength];
         i=0; j=0;
         WHILELOOP:
         while(!(varLIST[i].equals("end of file"))){
         while(varLIST[i].equals(nodenum)){
              i=i+1;
              while(varLIST[i].equals(nodenam)){
                   i=i+1;
                   while(!(varLIST[i].equals("end of input variable"))){
                        inoutChan[j] = varLIST[i];
                        i=i+1;
                        j=j+1;
              System.out.println("endofinput");
              inoutChan[j]="endofinchan";
              j=j+1;
              i=i+1;
              while(!(varLIST[i].equals("end of output variable"))){
         inoutChan[j] = varLIST[i];
         i=i+1;
         j=j+1;
         System.out.println("endofoutput");
         inoutChan[j]="endofoutchan";
         break WHILELOOP;
         i=i+1;
         arrlength =j;
         for(j=0; j<=arrlength-1; j++){
         System.out.println(inoutChan[j]);
         catch (Exception e){}
         return inoutChan;
    public String[] inchannel(String[] inoutChan) throws RemoteException{
    int count=0;int i=0, j=0;
    System.out.println("entered");
    while(inoutChan[count]!=null){
         System.out.println(count + " " +inoutChan[count]);
         count=count+1;
         inChan = new String[count];
         while(!(inoutChan[i].equals("endofinchan"))){
         inChan[j] =inoutChan[i];
         j=j+1; i=i+1;
    return inChan;
    public String[] outchannel(String[] inoutChan) throws RemoteException{
    int count=0;int i=0, j=0;
    System.out.println("entered");
    while(inoutChan[count]!=null){
         System.out.println(count + " " +inoutChan[count]);
         count=count+1;
         outChan = new String[count+1];
         while(!(inoutChan[i].equals("endofinchan"))){
              i=i+1;
         i=i+1;
         while(!(inoutChan[i].equals("endofoutchan"))){
              outChan[j] =inoutChan[i];
              j=j+1; i=i+1;
         return outChan;
    public String[] invarChan(String nodename, int guardno)throws RemoteException{
    try{
    DriverMatrix_mthds drive = new DriverMatrix_mthds();
    invarLIST = drive.invarlist();
    int i=0;int j;
    while(invarLIST[i]!=null){
         i=i+1;
         int arrlength = i;
         inVAR = new String[arrlength];
         i=0; j=0;
              WHILELOOP: while(!(invarLIST[i].equals("end of file"))){
                   if (invarLIST[i].equals(nodename)){
         i=i+1;
         while(!(invarLIST[i].equals(nodename+String.valueOf(guardno)))){
         i=i+1;}
         i=i+1;
         while(!(invarLIST[i].equals("endofguard"))){
         System.out.println(invarLIST[i]);inVAR[j]=invarLIST[i]; i=i+1; j=j+1;}
         break WHILELOOP;}
         i=i+1;}
    }catch (Exception d){}
    return inVAR;
    public String[] outvarChan(String nodename, int guardcount)throws RemoteException{
         try{
         DriverMatrix_mthds drive = new DriverMatrix_mthds();
         outvarLIST = drive.outvarlist();
         int i=0;int j;
         while(outvarLIST[i]!=null){
              i=i+1;
         int arrlength = i;
         outVAR = new String[arrlength];
         i=0; j=0;
         WHILELOOP: while(!(outvarLIST[i].equals("end of file"))){
              if (outvarLIST[i].equals(nodename)){
                   i=i+1;
                   while(!(outvarLIST[i].equals(nodename+String.valueOf(guardcount)+"guard"))){
                        i=i+1;}
              i=i+1;
              while(!(outvarLIST[i].equals("end guard"))){
              System.out.println(outvarLIST[i]);outVAR[j]=outvarLIST[i]; i=i+1; j=j+1;}
              break WHILELOOP;}
         i=i+1;}
    }catch (Exception d){}
    return outVAR;
    private static Boolean start;
    private static Boolean tstart;
    public void sendstart(Boolean start) throws RemoteException {
         tstart = start;
    public Boolean getstart() throws RemoteException{
         return tstart;
    private static Boolean done;
    private static Boolean tdone;
    public void senddone(Boolean done) throws RemoteException {
         tdone = done;
    public Boolean getdone() throws RemoteException{
         return tdone;
    private static Boolean vac_busy1;
    private static Boolean tvac_busy1;
    public void sendvac_busy1(Boolean vac_busy1) throws RemoteException {
         tvac_busy1 = vac_busy1;
    public Boolean getvac_busy1() throws RemoteException{
         return tvac_busy1;
    private static int cus1_rit1;
    private static int tcus1_rit1;
    public void sendcus1_rit1(int cus1_rit1) throws RemoteException {
         tcus1_rit1 = cus1_rit1;
    public int getcus1_rit1() throws RemoteException{
         return tcus1_rit1;
    private static int cus1_rit2;
    private static int tcus1_rit2;
    public void sendcus1_rit2(int cus1_rit2) throws RemoteException {
         tcus1_rit2 = cus1_rit2;
    public int getcus1_rit2() throws RemoteException{
         return tcus1_rit2;
    private static int cus1_rit3;
    private static int tcus1_rit3;
    public void sendcus1_rit3(int cus1_rit3) throws RemoteException {
         tcus1_rit3 = cus1_rit3;
    public int getcus1_rit3() throws RemoteException{
         return tcus1_rit3;
    private static int cus1_it1;
    private static int tcus1_it1;
    public void sendcus1_it1(int cus1_it1) throws RemoteException {
         tcus1_it1 = cus1_it1;
    public int getcus1_it1() throws RemoteException{
         return tcus1_it1;
    private static int cus1_it2;
    private static int tcus1_it2;
    public void sendcus1_it2(int cus1_it2) throws RemoteException {
         tcus1_it2 = cus1_it2;
    public int getcus1_it2() throws RemoteException{
         return tcus1_it2;
    private static int cus1_it3;
    private static int tcus1_it3;
    public void sendcus1_it3(int cus1_it3) throws RemoteException {
         tcus1_it3 = cus1_it3;
    public int getcus1_it3() throws RemoteException{
         return tcus1_it3;
    private static int stkit_11;
    private static int tstkit_11;
    public void sendstkit_11(int stkit_11) throws RemoteException {
         tstkit_11 = stkit_11;
    public int getstkit_11() throws RemoteException{
         return tstkit_11;
    private static int stkit_12;
    private static int tstkit_12;
    public void sendstkit_12(int stkit_12) throws RemoteException {
         tstkit_12 = stkit_12;
    public int getstkit_12() throws RemoteException{
         return tstkit_12;
    private static int stkit_13;
    private static int tstkit_13;
    public void sendstkit_13(int stkit_13) throws RemoteException {
         tstkit_13 = stkit_13;
    public int getstkit_13() throws RemoteException{
         return tstkit_13;
    private static int c1_it1;
    private static int tc1_it1;
    public void sendc1_it1(int c1_it1) throws RemoteException {
         tc1_it1 = c1_it1;
    public int getc1_it1() throws RemoteException{
         return tc1_it1;
    private static int c1_it2;
    private static int tc1_it2;
    public void sendc1_it2(int c1_it2) throws RemoteException {
         tc1_it2 = c1_it2;
    public int getc1_it2() throws RemoteException{
         return tc1_it2;
    private static int c1_it3;
    private static int tc1_it3;
    public void sendc1_it3(int c1_it3) throws RemoteException {
         tc1_it3 = c1_it3;
    public int getc1_it3() throws RemoteException{
         return tc1_it3;
    //endoffile

  • Java.security.AccessControlException in a RMI application

    Hello,
    I have the following error, while I'm launching my RMI application :
    access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044)
    at java.net.Socket.<init>(Socket.java:262)
    I was trying the following instruction :
    if (System.getSecurityManager() == null)
    System.setSecurityManager(new RMISecurityManager());
    try{
    Recepteur obj = new Recepteur();
    Naming.rebind("//localhost/Recepteur", obj);
    However, I have written in the java.policy file :
    grant codeBase "http://127.0.0.1:1099/-" {
         permission java.security.AllPermission;
    Does anyone know how to solve this problem ?
    Thx

    Help him please or he would be obliged to give me the dukes...

  • I want to make RMI application in NetBeans.helps needed

    Hi
    I want to make RMI application in NetBeans.So plz tell me how to build, run & deploy RMI in this IDE.
    Awaiting 4 ur reply.

    Hi
    When I can see the formats that can I watch with flash.
    Is there any comercial or not component, that embebed in a flash application allows to watch other video formats ?

  • Simple RMI application

    Hi all
    I've wrote a simple RMI application; I've made a stub and a skeleton and I've started a rmiregistry; when I'm execute a server, I have this exception:
    java.rmi.UnmarshalException: error unmarshalling arguments; ecc.
    Where is the problem?

    Ok, but I'm a student and my teacher wants ....I'm 49 years old and have blond, long hair (other call it grey, but they are
    loonies) and I drive a Ford that doens't want to start when it's freezing
    but that's still no excuse for the RMI mechanism not to work properly ;-)
    Anyway, the problem was an sub-directory; now I catch a
    ConnectException: connection refused (to 127.0.0.1);
    any ideas?Yep, you have to start the server part first and then start your client. I also
    suspect that you don't have the 'rmiregistry' running ... (we can talk about
    that later).
    kind regards,
    Jos

  • How to find Port numbers used by RMI application

    Hi, hope u all find me a solution, how to find port numbers used in the RMI application, that is port number which the RMI application communicates between RMIserver and RMIclient. ur answers would b highly appreciated

    Currently RMI transport layer does not directly expose any public methods to get the listening ports of the exported RMI objects, but the application can always export RMI server objects at certain designated ports instead of relying on the RMI runtime by specifying them to UnicastRemoteObjcect at the time of exporting.
    RMI transport layer try to optimize the number of listeing sockets by exporting all RMI server objects on a single port if no explicit ports were chosen. If the application is really interested in knowing the listeing ports, it can always specify the client and server socket factories to be used for creating Socket and ServerSocket to the RMI runtime at the time of exporting. When a RMI server object is exported, but the listening socket is not yet created, RMI transport layer invokes the createServerSocket(host, port) of server socket factory by passing the host and port details. If no explicit port is specified, underlying socket implementation choses anonymous port. At this point of time application can log these listeing ports to some log file.
    Similarly when the stub to the remote object is de-serialized in the client address space, it does also contain the client socket factory along with the end point details (host, port and server object ID). RMI runtime in the client address space needs to establish connection with the remote server object, it try to get the socket from client socket factory by invoking createSocket() on the client socket factory. Now the application can call getLocalPort() on the socket before returning it to the RMI transport layer.
    There is a undocumented class RMIStat to dump RMI runtime state information. It provides a lot of static methods to dump RMI state information like object table, transports, threads etc. You can download the source code of this utility from RMI archives, but remember this is not a comman-line utility, you must invoke these static methods as part of the application code.
    -- Srinath Mandalapu

  • Java Profiler for RMI Applications

    I am looking for a profiler to monitor the bottlenecks and the memory usage when running my RMI application.
    What would you recommend to use and a comprehensive tool

    Couple of thoughts on scaling:
    1. Change the mx setting to 1200m -- this is the most you can scale a single instance on 32-bit
    2. Use a 64-bit platform you can set memory settings really high (AIX/Solaris)
    3. Multiple servers with planning on it using a load balancer
    Regards,
    John A. Booth
    http://www.metavero.com

  • RMI application

    Is the java card RMI deprecated?
    I have read on one site it was written RMI-deprecated
    but not much information was provided related to it.
    And also it was written that RMI application cant be tested on emulators.
    Does anyone know any information regarding this?
    As i want to use RMI , i need some help.

    Hi,
    It is worth noting that an RMI client and Applet still communicate with APDU's, it is just that the APDU's are abstracted away from the developer so they do not need to worry about (or even understand) them. As such it is more the RMI framework that would be the issue in testing against an emulator. As far as I am aware, you can use OCF to communicate with the CREF emulator as well and this is the communication layer used by the JCDK RMI host samples.
    Cheers,
    Shane

  • How to deploy a RMI application

    I really need help here as I am at a complete loss. I have developed my RMI application and everything works on one single machine. Can somebody put me in the right direction as to how to deploy this to run on differnt machines probably located at different places? Will i definitely need a web server?
    How do I go about this? Please help!!!

    Can somebody put me in the right direction as to how to deploy this to run on differnt machines probably located at different places?You need to separate your application into 3 JAR files
    (a) common: the remote interface(s), the stub(s), and every application class named in them, and so on until closure
    (b) server: the server Impl classes and everything they depend on that isn't already in (a)
    (c) client: the client classes and everything they depend on that isn't already in (a)
    The server JAR goes at the server. The client JAR file goes at the client. The common JAR file goes at the server. Whether it goes to the client too depends on:
    Will i definitely need a web server?Not unless you want to use the codebase feature, i.e. java.rmi.server.codebase. If you use this, it has to be the URL of the common JAR file, ending I believe in .jar!, and the web server needs to deliver that JAR file in response to that URL.
    If you don't use the codebase feature, you don't need a WEB server, and the common JAR file is also required at the client, and on the Registry's classpath too if you're not using LocateRegistry.createRegistry().

  • Running RMI applications

    Hi everyone,
    I'm new at RMI and I can't seem to be able to get this right. I followed the following steps in creating a test RMI application:
    1) Create an interface which extends java.rmi.Remote
    2) Code the implementation of this interface which will act as an RMI server (this class extends UnicastRemoteObject and implements the interface created in step 1)
    3) compile these files using javac.exe
    4) create stubs and skeletons for the this RMI server using rmic
    5) create policy security file with the following entries:
    grant {
    permission java.net.SocketPermission "*:1024-65535", "connect,accept";
    permission java.net.SocketPermission "*:80", "connect";
    6) run the rmiregistry utility
    7) run the RMI server using java <classname>
    However, I keep getting the error:
    access denied (java.net.SocketPermission myhost resolve)
    Can anyone tell me what this means? I already place security permission in my policy security file earlier.
    Thanks for any help!

    Thanks for the reply. I did what you said and now I receive the ff. error messages:
    RMI exception: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.net.MalformedURLException: no protocol: .
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.net.MalformedURLException: no protocol: .
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.net.MalformedURLException: no protocol: .
    java.net.MalformedURLException: no protocol: .
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
    at sun.rmi.server.UnicastRef.invokeUnicastRef.java:354)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:160)
    at RMI.main(RMI.java:23)

  • Unable to generate Skeleton for RMI application

    Hello Friends,
    I used one interface and implementation class to invoke RMI they are as follows
    package com.rmi;
    import java.rmi.Remote;
    public interface CountRMI extends Remote {
         public int sum() throws java.rmi.RemoteException;
         public void sum(int _val) throws java.rmi.RemoteException;
         public int increment() throws java.rmi.RemoteException;
    package com.rmi;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.*;
    public class CountRMImpl extends UnicastRemoteObject implements CountRMI {
         private int sum;
         public CountRMImpl(String name) throws RemoteException{
              super();
              try{
                   Naming.rebind(name, this);
                   sum=0;
              catch(Exception e){
                   System.out.println("Exception:" + e.getMessage());
                   e.printStackTrace();
                   public int sum() throws RemoteException{
                        return sum;
                   public void sum(int _val) throws RemoteException{
                        sum = _val;
                   public int increment() throws RemoteException{
                        return ++sum;
    Implementation class, when I compile both and run rmic CountRMImpl I got the following error,
    public class CountRMImpl extends UnicastRemoteObject implements CountRMI
    ^
    Error is stated at CountRMI
    please help me to over come this.
    Thanks,
    Bhargavi.

    package com.rmi;
    public interface CountRMI extends java.rmi.Remote {
    public int sum() throws java.rmi.RemoteException;
    public void sum(int _val) throws java.rmi.RemoteException;
    public int increment() throws java.rmi.RemoteException;
    //Three methods to implement later ok
    -------------------------------------------------javac----------------------------------------------------------------------------
    package com.rmi;
    public class CountRMImpl extends java.rmi.server.UnicastRemoteObject implements CountRMI
    private int sum;
    public CountRMImpl() throws Exception
    super(); //it will call the constructor of the UnicastRemoteObject
    sum=0;
    public int sum() throws java.rmi.RemoteException
    return sum;
    public void sum(int _val) throws RemoteException
    sum = _val;
    public int increment() throws RemoteException
    return ++sum;
    -----------------------------javac and rmic-------------------------------------------------------------------------------
    I think we need to write the rmiRegistry Application
    But after compiling the below iam able to generate only the stub not the skeleton i dont understand why it is. But it is working whenever i use the Registry application i.e given below
    public class Myregistry
    public static void main(String args[]) throws Exception //Exception is RemoteException , bind so on
    CountRMImpl c1=new CountRMImpl();
    java.rmi.Naming.bind("uniquename",c1);
    System.out.println("Hey binded the object CountRMImpl to the Registry");
    now we need to run the rmiregistry first then check whether i.e binded correctly or not
    start rmiregistry
    java Myregistry
    output: Hey binded the object CountRMImpl to the Registry
    I asks the experts in the above every thing i got success but what happend to the skeleton that is not created by the command "rmic"
    please give the information why

  • Please Help with RMI Application?

    I'm require to develop an application to simulate system services such as changing passwords and executing remote commands. ie. an application to let the client change a password on a remote machine.
    May problem is i'm very very new to java programming and wouldn't know where to start. If anybody knows of a similar application or can have the source code please please reply me with a copy.
    Thanks

    Well, the place to start is by breaking it down a little bit, and then breaking it down some more, ...
    You need something on the client computer - sounds like some kind of a command-line program, or perhaps a batch script wrapped around a command-line program. You could start by defining your comand-lines.
    You need something on the server host - another program. Needs to do all the things your client program requests, so there are some pretty clear functions to be written.
    The two programs need to communicate. Since you posted to an RMI forum, I guess you want to use RMI. You can either design your server to have one method per client-request type, or - more likely - one remotely callable server routine. You decide, and design your command protocol.
    Then, your server has to do some mechanical things: At startup, register itself with an RMIRegistry.
    Your client, when invoked, will have to get from the user the server host, and look up the server in the registry. Then it will have to make a request and - I guess - just hang waiting for a result.
    Ypou may need user ID and/or password so that your server can authenticate the user.
    Final suggestion: Pick just ONE remote function you would like to implement first, and do the smallest possible implementation just for that function.

  • RMI + Application Server

    Can RMI server application be deployed into an application server.
    or any other option of accessing the Server without using the CMD Promt.

    Can RMI server application be deployed into an application server.
    or any other option of accessing the Server without using the CMD Promt.

  • Accessing RMI Application through an Applet hosted on Apache web server

    Hi All,
    Just to let you know, I'm a complete novice at RMI. Ok, heres the story...I have an applet which is deployed on Apache Webserver (localhost), with the neccessary files needed for the RMI app in the same directory - htdocs(i.e. Applet class, RMI Interface, and Stub). I have the object server running on the same machine - which is in the directory C:/pumps. For the binding I'm using rmi://localhost/PumpService. I'm running the rmiregistry in the C directory. The problem is that when I access the applet through localhost(i.e. http://localhost/pumps.htm) it doesnt work, doesnt seem to access the remote object. However, if I directly load the html page from C:/Apache2/htdocs/pumps.htm - it works perfectly. Any ideas on the way I could get it working through the localhost?
    Thanks...

    The problem is that
    when I access the applet through localhost(i.e.
    http://localhost/pumps.htm) it doesnt work, doesnt
    seem to access the remote object.Are the exception and the line of code you get it on a secret?

  • How can I close BDB  Environment and EntityStore in RMI Application

    Hi,all.
    I create Only one instance of the Environment object and one instance of the EntityStore Object when the RMI server is first started,like this:
    public class CalculatorServer {
    protected Environment env;
    protected EntityStore store;
    public CalculatorServer() {
    try {
    initBDB();
    String hostkey = "java.rmi.server.hostname";
    String rmisHost = "127.0.0.1";
    int port = 30000;
    Registry reg = (Registry) null;
    System.setProperty(hostkey, rmisHost);
    reg = LocateRegistry.createRegistry(port);
    reg.bind("/service/testrmi", new CalculatorImpl().initObject());
    } catch (RemoteException e) {
    e.printStackTrace();
    } catch (AlreadyBoundException e) {
    e.printStackTrace();
    public void initBDB() {
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    /** 设置事务 **/
    envConfig.setTransactional(false);
    envConfig.setLockTimeout(5, TimeUnit.SECONDS);
    env = new com.sleepycat.je.Environment(new File("test1"), envConfig);
    StoreConfig storeConfig = new StoreConfig();
    storeConfig.setAllowCreate(true);
    /** 设置事务 **/
    storeConfig.setTransactional(false);
    /** 是否开启延迟写入**/
    storeConfig.setDeferredWrite(true);
    store = new EntityStore(env, "entityStore", storeConfig);
    public static void main(String args[]) {
    new CalculatorServer();
    1) in this approach,Do I need to close Environment and EntityStore?
    thanks

    The code you posted is not the BDB JE code you're using, so it doesn't help to diagnose the problem you're having. Please post your EnvironmentConfig and StoreConfig setup code, and your code to use Transactions, if any.
    If your store is not transactional (EntityStore.setTransactional(true)), the data is not guaranteed to be durable/persistent until you call Environment.sync, or close the Environment cleanly. If your store is transactional, then durability is controlled by the TransactionConfig you use, or the Durability parameter of the Transaction.commit method. The default durability is set using EnvironmentMutableConfig.setDurability.
    Be sure to close the EntityStore and Environment cleanly when your program exists, as I mentioned earlier.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Can't connect Sony TRV900

    For several years I have often used my Sony TRV900 miniDV camera to capture video onto my hard drive using FCP. Occasionally FCP would not recognize the device, but I was always able to resolve the problem. Now, however, I am completely unable to get

  • Diffrnce btwn copy cntrl item catgr(vtfa) n asgnmnt item categories(vov4)

    Dear All Gurus, This is my copy control screen(VTFA) Copying control: Sales document to billing document Target billing type          ZJF2 Job Work Invoice From SalesDoc Type     ZJOR Job Work Order ALES     ALE Third Party TAD     Service TADC     C

  • Integrate p6SPY with Sun Java System Application Server 7 ...?

    Dear PALs, Let me know how can I Integrate p6SPY (w3.p6spy.com) with "Sun Java System Application Server 7 2004Q2" on Windows ? When I try to follow the steps given at http://www.p6spy.com/documentation/install.htm#unspec ,my server throws INFO ( 182

  • After upgrade Script No Longer Works

    After I upgraded CS4 to .605 my script no longer works. I get: Error Number:45 Error String: Object is Invalid Line 12 Source: myParStyle.baselineshift = -1; Here are my first 12 lines: var doc = app.documents[0] var color = doc.colors.item("C=100 M=

  • Dual Layered DVDs

    I'm trying to burn a Dual Layer Disc project using 2 DVDs but a "Layer 0 is too large" ERROR keeps coming up during the muxing process. Since then I have shortened the video on the first track (1st Side) 2 times, but it still gives me the error. This