Check java.rmi.Remote client alive?

Hi,
I have a Client program which extends java.rmi.Remote and a Server program which has a method Connect(java.rmi.Remote client).
in my Server program, I add the "java.rmi.Remote client" stub reference into a vector when any client calls the remote method Connect(java.rmi.Remote client).
when I am trying to check if the client is still alive, how could i make use of the stub reference to do so? I have check if the reference is null but it doesn't work.
Thank you for any help.

I am checking on the client without client knowing it. i need to use this when any of the client call my server method to shut down.
i will need to check that no client are connected or alive before shutting down the server. this is why the operation have to be transparent to all other client.
Yet i could not change the callback interface as it has been published and there are all sort of clients connecting to the server using this interface.
Probably could I achieve that using socket connection ?
i would appreciate if someone could suggest a solution to it. Thank you.
Message was edited by:
eddy_nyp

Similar Messages

  • Help needed to move a java.rmi.Remote object.....

    Hi,
    I have an object extending java.rmi.Remote on a server. I want to get it onto a client (ie the actual object, not a reference to the object on the server).
    The catch (isn't there always one):
    The client must only get class definitions/interface definitions from the java.rmi.server.codebase
    (ie I don't want to use a network classloader).
    Anyone any ideas?
    Kev.

    If you have a class that implements java.rmi.Remote then the objects of that class by definition are available for Remote access (ie, they are passed by reference). Remote objects can't be passed by value. However, if you want objects of a particular class to be passed by value you could have the class implement java.io.Serializable instead of java.rmi.Remote.
    Hope this helps.

  • Java.rmi.remote error

    Hello,
    I recently wrote a simply Infobus applet which includes a
    LoginDialog.
    1.when i run it in Jdeveloper(not be packed into .jar
    or .zip), i can login but get a error:"java.lang.OutofMemory",
    however,the frame will appear slowly when i reload the applet.
    (128M RAM in my PC).
    2.when i deployed it into myjar2.jar ,then run it in
    Jdeveloper, I can't login and get a error:"Named Connection cn1
    not be opened", (myjar2.jar includes the
    files: "connections.properties", "cn1.xml","Applet2.class ",etc .
    3.when i run it from client browser(IE5 & Netscape 4.7) after
    deployed,i can see the LoginDialog ,but can't login and get
    error:"java.rmi.remote".
    Please help me to resolve!
    Thanks!
    null

    Hi,
    When you run from within JDeveloper, make sure you are running
    the HTML file rather than the applet.java file. I have had
    better luck when using the HTML file to run, especially with the
    login dialog.
    When you run from a browser externally, make sure you are using
    the JDK 1.2 plugin. I think the release notes contain
    information on where to get it and how to use it.
    Laura
    lxd (guest) wrote:
    : Hello,
    : I recently wrote a simply Infobus applet which includes a
    : LoginDialog.
    : 1.when i run it in Jdeveloper(not be packed into .jar
    : or .zip), i can login but get a error:"java.lang.OutofMemory",
    : however,the frame will appear slowly when i reload the applet.
    : (128M RAM in my PC).
    : 2.when i deployed it into myjar2.jar ,then run it in
    : Jdeveloper, I can't login and get a error:"Named Connection cn1
    : not be opened", (myjar2.jar includes the
    : files: "connections.properties", "cn1.xml","Applet2.class ",etc
    : 3.when i run it from client browser(IE5 & Netscape 4.7)
    after
    : deployed,i can see the LoginDialog ,but can't login and get
    : error:"java.rmi.remote".
    : Please help me to resolve!
    : Thanks!
    null

  • Unreported exception java.rmi.RemoteException; must be caught or declared t

    I am receiving an:
    unreported exception java.rmi.RemoteException; must be caught or declared to be thrown
    error when I attempt to compile the Client.java file.
    The Client.java file implements the ATMListener.java interface.
    As you will see below, I've stripped them down by taking out all of the code, yet I still receive this error.
    Any ideas...
    ATMListener.java
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    * @author Eddie Brodie
    * @version %I%, %G%
    public interface ATMListener extends java.rmi.Remote
    Client.java
    import java.net.MalformedURLException;
    import java.rmi.Naming;
    import java.rmi.NotBoundException;
    import java.rmi.RemoteException;
    import java.rmi.UnknownHostException;
    public class Client extends java.rmi.server.UnicastRemoteObject implements ATMListener

    Well first off unless I am missing something in the API java.rmi.Remote is an interface not a class so implements not inherits, but I do not really know these classes so I cannot be sure I am not missing something.
    As for the unreported exception. What could be causing something like this would be an exception thrown by the constructor of the parent class. Even if you have no constructor written for your class it still has a default constructor which will by default call the super constrcutpor meaning an exception could be thrown from the super constrcutor down to your default constructor where you would not know what to do with it.

  • UnmarshalException while using prop  java.rmi.server.ignoreStubClasses=true

    I have created a test program to check the behaviour of setting the java.rmi.server.ignoreStubClasses property to true on the server side and not setting this flag on the client side.
    This requirement is due to updation of an already running system, with stubs to a new version without stubs, without shutting down the system.
    The files used by me are given below.
    File Hello.java
    package example.hello;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface Hello extends Remote {
    String sayHello() throws RemoteException;
    File Server.java
    package example.hello;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    import java.rmi.server.UnicastRemoteObject;
    public class Server implements Hello {
    public Server() {}
    public String sayHello() {
    return "Hello, world!";
    public static void main(String args[]) {
    try {
    LocateRegistry.createRegistry(1099);
    Server obj = new Server();
    Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);
    // Bind the remote object's stub in the registry
    Registry registry = LocateRegistry.getRegistry();
    registry.bind("Hello", stub);
    System.err.println("Server ready");
    catch (Exception e)
    System.err.println("Server exception: " + e.toString());
    e.printStackTrace();
    File Client.java
    package example.hello;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    public class Client {
    private Client() {}
    public static void main(String[] args) {
    String host = (args.length < 1) ? null : args[0];
    try {
    Registry registry = LocateRegistry.getRegistry(host);
    Hello stub = (Hello) registry.lookup("Hello");
    String response = stub.sayHello();
    System.out.println("response: " + response);
    } catch (Exception e) {
    System.err.println("Client exception: " + e.toString());
    e.printStackTrace();
    First I run file Server.java using the following script (server.bat)
    java -Djava.rmi.server.ignoreStubClasses=true -classpath .; example.hello.Server
    pause
    Then the client is run using the following script (client.bat)
    java -classpath .; example.hello.Client 132.186.96.210
    pause
    While running the client, the following exception is obtained.
    Client exception: java.rmi.ServerException: RemoteException occurred in server thread; nested except
    java.rmi.UnmarshalException: error unmarshalling call header; nested exception is:
    java.rmi.UnmarshalException: skeleton class not found but required for client version
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling call header; nested exception is:
    java.rmi.UnmarshalException: skeleton class not found but required for client version
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
    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 sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at example.hello.Client.main(Client.java:52)
    Caused by: java.rmi.UnmarshalException: error unmarshalling call header; nested exception is:
    java.rmi.UnmarshalException: skeleton class not found but required for client version
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
    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)
    Caused by: java.rmi.UnmarshalException: skeleton class not found but required for client version
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:243)
    ... 6 more
    I am not able to figure out why this thing is happening, If i also set the property java.rmi.server.ignoreStubClasses=true on the client side everything goes fine. But this I can't do. I can't set the property on the client side as the system is up and already running.
    I am using JDK version 1.5.0_06. Same exception comes under JDK 6.0
    Any help will be highly appreciated.

    I think this is a bug. When you exported the Registry from your server JVM it was also exported with java.rmi.server.ignoreStubClasses=true, but the Registry bootstrap at the client requires the 1.1 stub protocol for compatiblity reasons so you got this error. I would report this on the Bug Parade.
    You could get around it by setting java.rmi.server.ignoreStubClasses after exporting the Registry.
    BTW java.rmi.server.ignoreStubClasses isn't supposed to do anything at the client whether true or false so you can cut your testing space in half.

  • RemoteException: java.rmi.UnmarshalException in jdk 1.4.2

    i'm implementing an RMI over the jdk 1.4.2 (can't do it in the 1.5 or 1.6) i've seen this topic [http://forum.java.sun.com/thread.jspa?threadID=370196&messageID=1808449] but it didn't help me, or i'm doing something wrong...
    i know the RMI code is ok because it runs on java 1.6 (with the automatic generation of stubs and skeletons) but when i change the platform to 1.4 it throws the exception:
    RemoteException: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
    java.lang.ClassNotFoundException: servidor.MensageiroImpl_Stub
    the VM is configured to use the -Djava.security.policy=C:\Projecto\Policy\permissions.policy both in the client and server
    please help me :S i've been burning my head with this for 3 days
    i leave my code here:
    The interface:
    package rmiinterface;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface Mensageiro extends Remote {
        public void sendMsg(String msg) throws RemoteException;
        public String readMsg() throws RemoteException;
    }the implementation:
    package servidor;
    import rmiinterface.Mensageiro;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class MensageiroImpl extends UnicastRemoteObject implements Mensageiro {
        public MensageiroImpl() throws RemoteException {
            super();
        public void sendMsg(String msg) throws RemoteException {
            System.out.println(msg);
        public String readMsg() throws RemoteException {
            return "This is not a Hello World! message";
    }the server:
    package servidor;
    import rmiinterface.Mensageiro;
    import java.rmi.Naming;
    import java.rmi.RMISecurityManager;
    public class MensageiroServer {
        public MensageiroServer() {
            System.setSecurityManager(new RMISecurityManager());
            try {
                Mensageiro m = new MensageiroImpl();
                java.rmi.registry.LocateRegistry.createRegistry(1099);
                System.out.println("RMI registry successfully initiated");
                Naming.rebind("MensageiroService", m);
                System.out.println("Servidor Online");
            } catch (Exception e) {
                System.out.println("Trouble: " + e.getMessage());
        public static void main(String[] args) {
            new MensageiroServer();
    }and the client:
    package cliente;
    import rmiinterface.Mensageiro;
    import java.rmi.RMISecurityManager;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.rmi.NotBoundException;
    import java.net.MalformedURLException;
    public class MensageiroClient {
        public MensageiroClient() {
        public static void main(String args[]) {
            System.setSecurityManager(new RMISecurityManager());
            try {
                Mensageiro m = (Mensageiro) Naming.lookup("//localhost/MensageiroService");
                System.out.println(m.readMsg());
                m.sendMsg("Hello World!");
            } catch (MalformedURLException e) {
                System.out.println();
                System.out.println("MalformedURLException: " + e.toString());
            } catch (RemoteException e) {
                System.out.println();
                System.out.println("RemoteException: " + e.toString());
            } catch (NotBoundException e) {
                System.out.println();
                System.out.println("NotBoundException: " + e.toString());
            } catch (Exception e) {
                System.out.println();
                System.out.println("Exception: " + e.toString());
    }NOTE: my IDE is Netbeans 6.1. and the client and server are in diffrent projects
    thanks in advance
    Best Regards,
    Carlos Daniel Ribeiro

    the stub and the skeleton are being generated, and they are there, in the server project! i don't know why the class defs for the stub filearen't downloded by the client project...I don't know why you think they will be downloaded. They won't be, unless you're using the codebase feature. The client needs the remote interface and the stub on its classpath, and all classes that the remote interface depends on, and so on recursively until closure. You have to do something about that.
    It works under 1.6 because it doesn't need the stub at all.

  • Exception occured: java.rmi.ConnectException:

    hi
    i got an exception while running rmi client jar file....
    i want to invoke a method in the server..i have created two jar files one for server and another for client..
    i have added the policy file also..i tried by using server and client in the same system
    when i run the client jar i got an exception like given below..and i'm using netbeans 6...
    Exception occured: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
    java.net.ConnectException: Connection refused: connect
    can any one help me to solve this problem?
    thanx in advance...

    hi thanx for the reply..
    i'm using windows XP, netbeans6, jdk6, sql server2000.
    when i started the rmiregistry this exception is over, but another exception comes
    Exception occured: java.rmi.NotBoundException: myebillRMIImpl
    my code is given below..please help me....a similar code worked properly without using netbeans..
    import java.sql.*;
    public interface ebillRMIInterface extends java.rmi.Remote
    public void insert(String str) throws java.rmi.RemoteException;
         public ResultSet select(String str1) throws java.rmi.RemoteException;
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    import java.sql.*;
    public class ebillRMIImpl extends UnicastRemoteObject implements ebillRMIInterface
    public ebillRMIImpl(String name) throws RemoteException
    super();
    try
    Naming.rebind(name, this);
    catch(Exception e)
    System.out.println("Exception occurred: " + e);
                        Statement stmt=null;
                        Connection con=null;
                        ResultSet res=null;
    public void insert(String str)
    try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection("jdbc:odbc:rmidsn", "sa", "");
                   stmt = con.createStatement();
                   stmt.executeUpdate(str);
                   con.close();
              catch (Exception e)
                   System.out.println(e);
              public ResultSet select(String str)
                   try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection("jdbc:odbc:rmidsn", "sa", "");
                   stmt = con.createStatement();
                   res=stmt.executeQuery(str);
                   con.close();
              catch (Exception e)
                   System.out.println(e);
              return res;
    import java.rmi.*;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    import java.rmi.server.UnicastRemoteObject;
    public class ebillRMIServer
    public static void main(String[] argv)
    System.setSecurityManager(new RMISecurityManager());
    try
    //Registry registry =LocateRegistry.getRegistry();
    ebillRMIImpl implementation = new ebillRMIImpl("myebillRMIImpl");
    catch (Exception e)
    System.out.println("Exception occurred: " + e);
    Client function is
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {     
    System.setSecurityManager(new RMISecurityManager());
    int itemid;
    String serverName ="";
    serverName = "localhost";
                        ResultSet res=null;
    String itid=jTextField1.getText();
    itemid=Integer.parseInt(itid);
    try
    //bind server object to object in client//rmi://host:<port>/correlator
    ebillRMIInterface ebillserver = (ebillRMIInterface) Naming.lookup("rmi://"+serverName+"/myebillRMIImpl");
    //invoke method on server object
    System.out.println("Date on server is " + d);*/
                                  String str="select * from Stock where itemid="+itemid;
                                  res=ebillserver.select(str);
    while(res.next())
    jTextField2.setText(res.getString(2));
    Float price=res.getFloat(4);
    String pr=String.valueOf(price);
    jTextField3.setText(pr);
    catch(Exception e)
    System.out.println("Exception occured: " + e);
    System.exit(0);
    System.out.println("RMI connection successful");
    }

  • [RMI] server/client, help me.

    I have done a Chat with RMI, between a server and a client machine on my network.
    The server start normaly, and the client manage to connect the server, but the server failed to connect the client.
    Can Someone explain me why?
    Here are the source files:
    *********Client Distant****************
    import java.rmi.*;
    public interface ClientDistant extends java.rmi.Remote {
    public void msg(Message m) throws RemoteException;
    **********Client DistantImplementation**************
    import java.io.*;
    import java.net.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.rmi.registry.*;
    import java.net.MalformedURLException;
    public class ClientDistantImpl extends java.rmi.server.UnicastRemoteObject implements ClientDistant, Runnable {
    String nom;
    String nomServeur;
    /** Constructs ClientDistantImpl object and exports it on default port.
    public ClientDistantImpl(String nom, String nomServeur) throws RemoteException {
    super();
    this.nom = nom;
    this.nomServeur= nomServeur;
    Thread leThread = new Thread(this);
    leThread.start();
    /** Register ClientDistantImpl object with the RMI registry.
    * @param name - name identifying the service in the RMI registry
    * @param create - create local registry if necessary
    * @throw RemoteException if cannot be exported or bound to RMI registry
    * @throw MalformedURLException if name cannot be used to construct a valid URL
    * @throw IllegalArgumentException if null passed as name
    public static void registerToRegistry(String name, Remote obj, boolean create) throws RemoteException, MalformedURLException{
    if (name == null) throw new IllegalArgumentException("le nom doit etre non vide");
    try {
    Naming.bind(name, obj);
    } catch (AlreadyBoundException ex){
              throw new IllegalArgumentException("le nom est deja utilise");
    } catch (RemoteException ex){
    if (create) {
    Registry r = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
    r.rebind(name, obj);
    } else throw ex;
    /** Main method.
    public static void main(String[] args) {
    System.setSecurityManager(new RMISecurityManager());
    try {
    BufferedReader entree = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Entrez votre nom");
    String nom = entree.readLine();
    System.out.println("Entrez le nom de la machine serveur");
    String nomServeur = entree.readLine();
    ClientDistantImpl obj = new ClientDistantImpl(nom, nomServeur);
    String machineLocale = InetAddress.getLocalHost().getHostAddress();
                   System.out.println("Machine locale : "+machineLocale);
                   String[] tab = Naming.list("//"+nomServeur);
                   for(int i=0; i<tab.length; i++)
                        System.out.println(tab[i] + " est enregistre sur le registre du serveur");
    ServeurChat sc = (ServeurChat) Naming.lookup("//"+nomServeur+"/serveurChat");
    String url = "//"+machineLocale+"/"+nom;
    sc.connect(url);
    System.out.println("Entrez vos messages en terminant par FIN");
    String mess = entree.readLine();
    while(!mess.equalsIgnoreCase("FIN")) {
    Message m = new Message(url, mess);
    sc.msg(m);
    mess = entree.readLine();
    sc.disconnect(url);
              System.exit(1);
    } catch (Exception ex) {
    ex.printStackTrace();
    public void msg(Message m) throws RemoteException {
    System.out.println(m);
    public void run() {
    try {
    registerToRegistry(nom, this, true);
    } catch (Exception ex) {
    ex.printStackTrace();
              System.exit(1);
    ****************Serveur Chat********************
    import java.rmi.*;
    public interface ServeurChat extends ClientDistant {
    public void connect(String url) throws RemoteException;
    public void disconnect(String url) throws RemoteException;
    *****************Serveur Chat Implementation**********
    import java.net.*;
    import java.util.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.rmi.registry.*;
    import java.net.MalformedURLException;
    /** Unicast remote object implementing ServeurChat interface.
    * @author Patrice Torguet
    * @version 1.0
    public class ServeurChatImpl extends UnicastRemoteObject implements ServeurChat {
    Vector clients;
    /** Constructs ServeurChatImpl object and exports it on default port.
    public ServeurChatImpl() throws RemoteException {
    super();
    clients = new Vector();
    public static void registerToRegistry(String name, Remote obj, boolean create) throws RemoteException, MalformedURLException{
    if (name == null) throw new IllegalArgumentException("registration name can not be null");
    try {
    Naming.rebind(name, obj);
    } catch (RemoteException ex){
    if (create) {
    Registry r = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
    r.rebind(name, obj);
    } else throw ex;
    /** Main method.
    public static void main(String[] args) {
    System.setSecurityManager(new RMISecurityManager());
    try {
    String machineLocale = InetAddress.getLocalHost().getHostName();
    System.out.println("Nom du serveur = serveurChat");
    ServeurChatImpl obj = new ServeurChatImpl();
    registerToRegistry("serveurChat", obj, true);
    } catch (Exception ex) {
    ex.printStackTrace();
    public void disconnect(String url) throws RemoteException {
    clients.removeElement(url);
    public void msg(Message m) throws RemoteException {
    Enumeration e = clients.elements();
    String url = null;
    while(e.hasMoreElements()){
    try {
    url = (String) e.nextElement();
    if (!url.equalsIgnoreCase(m.url)) {
    ClientDistant cl = (ClientDistant) Naming.lookup(url);
    cl.msg(m);
    } catch(Exception ex) {
    ex.printStackTrace();
    clients.removeElement(url);
    public void connect(String url) throws RemoteException {
    clients.addElement(url);
    *************Message*********************
    import java.io.*;
    * @author Patrice Torguet
    * @version
    public class Message implements Serializable {
    String url;
    String msg;
    /** Creates new Message */
    public Message(String url, String msg) {
    this.url = url;
    this.msg = msg;
    public String toString() {
    return url + " : " + msg;
    Thx for help.

    This is the exception:
    java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
    java.net.ConnectException: Connection refused
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
    at java.net.Socket.<init>(Socket.java:268)
    at java.net.Socket.<init>(Socket.java:95)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:20)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:115)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:78)
    at ServeurChatImpl_Stub.connect(Unknown Source)
    at ClientDistantImpl.main(ClientDistantImpl.java:85)

  • Please help, I am having java.rmi.UnmarshalException.

    First I would like to show you the interface code i want to implement, following is the code.
    package bis.opencontrol.opcconnector;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import javax.swing.tree.*;
    public interface ReceiveNodeInterface extends Remote
    DefaultMutableTreeNode getRootNode(String x) throws RemoteException;
    The server class which implements this interface is as follows...
    package bis.opencontrol.opcconnector;
    public class RMIServiceToSendNodesHierarchy extends java.rmi.server.UnicastRemoteObject implements ReceiveNodeInterface
    public DefaultMutableTreeNode getRootNode(String x) throws RemoteException
    System.out.println(x);
    return(TimerToGetNodesHierarchy.getRootNode());
    public RMIServiceToSendNodesHierarchy() throws RemoteException
    try
    thisAddress= (InetAddress.getLocalHost()).toString();
    catch(Exception e)
    throw new RemoteException("can't get inet address.");
    thisPort = 1099;
    System.out.println("Starting RMI service at address = "+thisAddress+" and PortNo = "+thisPort);
    System.getProperties().setProperty("java.security.policy", "wideopen.policy");
    if(System.getSecurityManager() == null)
    System.setSecurityManager(new RMISecurityManager());
    try
    registry = LocateRegistry.createRegistry(thisPort);
    registry.rebind("RMIServiceToSendNodesHierarchy", this);
    The client class which will send request to server is as follows...
    package tagbrowser;
    public class TagBrowser extends javax.swing.JFrame
    ReceiveNodeInterface rmiServer;
    public TagBrowser() throws MalformedURLException
    getRootNodeIntoTree();
    void getRootNodeIntoTree() throws MalformedURLException
    String text = "Please, send us the root node.";
    try
    registry = LocateRegistry.getRegistry(serverAddress, 1099);
    String[] list = registry.list();
                   if( list == null )
                        throw new RemoteException( "list == null" );
    else
    for (int k=0; k < list.length; k++)
    System.out.println("registry" + k + ": " + list[k].toString());
    System.getProperties().setProperty("java.security.policy", "wideopen.policy");
    if(System.getSecurityManager() == null)
    System.setSecurityManager(new RMISecurityManager());
    rmiServer = (ReceiveNodeInterface)(registry.lookup("RMIServiceToSendNodesHierarchy"));
    rootNode = rmiServer.getRootNode(text);
    catch(RemoteException e){
    e.printStackTrace();
    catch(NotBoundException e){
    e.printStackTrace();
    Well, when I run this rmi client application I get this following error...
    registry0: RMIServiceToSendNodesHierarchy
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
    java.lang.ClassNotFoundException: bis.opencontrol.opcconnector.ReceiveNodeInterface
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at tagbrowser.TagBrowser.getRootNodeIntoTree(TagBrowser.java:126)
    at tagbrowser.TagBrowser.<init>(TagBrowser.java:39)
    at tagbrowser.Main.main(Main.java:19)
    Caused by: java.lang.ClassNotFoundException: bis.opencontrol.opcconnector.ReceiveNodeInterface
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    ... 4 more
    BUILD SUCCESSFUL (total time: 1 second)

    System.out.println("Starting RMI service at address = "+thisAddress+" and PortNo = "+thisPort);That's not true unless you call super(1099) inside this constructor. So at this point you are printing misleading information.
    System.getProperties().setProperty("java.security.policy", "wideopen.policy");
    if(System.getSecurityManager() == null)
    System.setSecurityManager(new RMISecurityManager());
    }You normally don't need a security manager in an RMI server. You can delete all this.
    package tagbrowser;I would expect to see either import bis.opencontrol.opcconnector.* or import bis.opencontrol.opcconnector.ReceiveNodeInterface here. So there is clearly something wrong with your project structure. I suspect you have copied ReceiveNodeInterface from the server package to the client. That isn't valid. The remote interface is the same at both client and server.
    I am having java.rmi.UnmarshalExceptionWell, actually you are having java.lang.ClassNotFoundException: bis.opencontrol.opcconnector.ReceiveNodeInterface
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    due to the error described above. This also implies that bis.opencontrol.opcconnector.ReceiveNodeInterface needs to be available to the client via its classpath, i.e. usually via the same JAR that the client classes are in.

  • Java.rmi.ConnectionExceptionException:Connect refused to host

    I write a rmi,when server and client runs in the same machine,it runs ok,then I run them in two machines,server runs in 192.168.0.1,like follows:
    C:\>rmiregistry -J-Djava.security.policy=registerit.policy
    C:\>java -Djava.rmi.dgc.leaseValue=1000 -Djava.security.policy=registery.policy RegisterIt
    Object instantiated: HelloServer[RemoteStub [ref: [endpoint:[192.168.0.1:3120](l
    ocal),objID:[0]]]]
    and it ok ,client runs in 192.168.0.2, but it raise errors:
    java -Djava.security.policy=registerit.policy HelloClient
    HelloClient exception :java.rmi.ConnectionException:Connection refused to host:192.168.0.2;nested exception is:java.net.ConnectException:Connection refused:connect
    Why? how to solve it?
    Any idea will be appreciated!
    My code is follows:
    HelloInterface.java
    public interface HelloInterface extends java.rmi.Remote{
    public String sayHello() throws java.rmi.RemoteException;
    HelloServer.java
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.util.*;
    public class HelloServer extends UnicastRemoteObject implements HelloInterface{
    public HelloServer() throws RemoteException{
    super();
    public String sayHello() throws RemoteException{
    return "Hello world, the current system time is "+new Date();
    RegisterIt.java
    import java.rmi.*;
    public class RegisterIt{
    public static void main(String args[]){
    try{
    HelloServer obj=new HelloServer();
    System.out.println("Object instantiated: "+obj);
    Naming.rebind("/HelloServer",obj);
    System.out.println("HelloServer bound in registery");
    catch(Exception e){
    System.out.println(e);
    registerit.policy
    grant{
    permission java.security.AllPermission;
    HelloClient.java
    import java.rmi.*;
    public class HelloClient{
    public static void main(String args[]){
    if(System.getSecurityManager()==null){
    System.out.println("null");
    System.setSecurityManager(new RMISecurityManager());
    try{
    HelloInterface obj=(HelloInterface)Naming.lookup("/HelloServer");
    String message=obj.sayHello();
    System.out.println(message);
    catch(Exception e){
    System.out.println("HelloClient exception: "+e);
    }

    Connection refused means the server is no listening on the port that client tried to connect to. You need to look at your configuration.

  • RMI: multiple clients for one RMI server?

    Hi,
    We're thinking of making a RMI Server.
    However, can multiple clients access the same RMI Server at the same moment?
    So, if one client is connected to the RMI Server, what will happen with the other clients that want to work to do the same thing at the same moment ?

    all over the same port?
    so for example, 100 clients can work simultaneously on this simple server?
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface OkServer extends Remote {
        public String getOk() throws RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.RMISecurityManager;
    import java.rmi.RemoteException;
    import java.rmi.Naming;
    public class OkServerImpl extends UnicastRemoteObject implements OkServer {
        public OkServerImpl() throws RemoteException {
        public String getOk() {
         return "ok";
        public static void main (String args[]) throws Exception {
              System.setSecurityManager(new RMISecurityManager());
              OkServerImpl OkSvr = new OkServerImpl();
              Naming.bind("OkServer", OkSvr);
    }

  • Must redeploy app or get java.rmi.AccessException: CORBA NO_PERMISSION 9998

    Hello. I'm hoping someone can give me a clue to the source of this problem.
    I have a very simple test application which consists of one EJB which is just a stateless session bean that has a method which return the String "Hello". This method can only be run by a user in the "test" role.
    I have a simple commandline client packaged in the application. I use deploytool to extract the Client.jar and I can run it with appclient - client myClient.jar. This little class connects to the bean in the server (via jndi lookup as per all tutorial example) and calls the sayHello() method. A login dialog appears in order to authenticate the user as it should and everything works perfectly ... BUT ...
    If I stop the server and start it again and try to run the client exactly the same way (appclient - client myClient.jar), I get the error message below. The application is running and I confirm that its there using deploytool and asadmin to list components, etc. The only way I can get it work again is by redeploying the application.
    I've looked around and found nothing about this regarding Sun Java System Application Server Platform Edition 8 2004Q4 Beta (which is what I'm using). I found some vague references to a similar sounding problem from people using Application Server 7, but the work around in those posts references switches and settings in deploytool that dont seem to be there in my version.
    Can anyone suggest a fix? I'd like the application to work upon starting up the server each morning for example without having to redeploy it. I'm glad to provide my test application archives and sources to anyone who would find them useful for solving this problem.
    Thanks!
    Error:
    java.rmi.AccessException: CORBA NO_PERMISSION 9998 Maybe; nested exception is:
    org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.NO_PERMISSION: vmcid: 0x2000 minor code: 1806 completed: Maybe
    at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:179)
    at com.sun.ejb.containers.BaseContainer.authorizeRemoteMethod(BaseContainer.java:908)
    at com.sun.ejb.containers.StatelessSessionContainer.createEJBObjectImpl(StatelessSessionContainer.java:274)
    at com.sun.ejb.containers.EJBHomeImpl.createEJBObjectImpl(EJBHomeImpl.java:89)
    at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:140)
    at $Proxy15.create(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1683)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1543)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:925)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:697)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:454)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1188)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:398)
    Caused by: java.rmi.AccessException: Client is not authorized for this invocation.
    at com.sun.ejb.containers.BaseContainer.authorizeRemoteMethod(BaseContainer.java:906)
    ... 19 more
    ----------END server-side stack trace---------- vmcid: 0x2000 minor code: 1806 completed: Maybe
    at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:195)
    at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:142)
    at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source)
    at com.dcit.bmj.bmo.interfaces._HelloWorldHome_DynamicStub.create(_HelloWorldHome_DynamicStub.java)
    at com.dcit.bmj.client.WasUpClient.main(WasUpClient.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:237)
    at com.sun.enterprise.appclient.Main.<init>(Main.java:423)
    at com.sun.enterprise.appclient.Main.main(Main.java:96)
    Caused by: org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.NO_PERMISSION: vmcid: 0x2000 minor code: 1806 completed: Maybe
    at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:179)
    at com.sun.ejb.containers.BaseContainer.authorizeRemoteMethod(BaseContainer.java:908)
    at com.sun.ejb.containers.StatelessSessionContainer.createEJBObjectImpl(StatelessSessionContainer.java:274)
    at com.sun.ejb.containers.EJBHomeImpl.createEJBObjectImpl(EJBHomeImpl.java:89)
    at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:140)
    at $Proxy15.create(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1683)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1543)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:925)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:697)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:454)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1188)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:398)
    Caused by: java.rmi.AccessException: Client is not authorized for this invocation.
    at com.sun.ejb.containers.BaseContainer.authorizeRemoteMethod(BaseContainer.java:906)
    ... 19 more
    ----------END server-side stack trace---------- vmcid: 0x2000 minor code: 1806 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:902)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:99)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:575)
    at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:430)
    at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:326)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:132)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:129)
    ... 10 more

    Hi Raja.
    So Sorry for the delay. Anyway, I've come back to try to do this now and just cant make the problem happen! I'm tearing my hair out to figure out what has changed. In the meantime, I'm going to just move past this. If it shows up again, I'll be sure to post all related files back in this forum.
    Thanks!

  • Problem running remote client.

    Hi,
    I'm trying to use remoting and have come across a problem and i was hoping someone could help me out.
    When i try to run my Server App. I get the following Error:
    Connection refused to host: localHost; nested exception is:
    java.net.ConnectException: Connection refused: connect
    My runService class is : -
    package DAO;
    import java.rmi.*;
    public class runService {
         * @param args the command line arguments
        public static void main(String[] args) {
           try
             {Naming.rebind("//localHost:8100/dataAccess", new DataAccessObjectImpl());
              System.out.println( "Data Access Server is ready" );
             catch(Exception e){
             System.out.println(e.getMessage());}
    }I have trimmed the classes down to three methods as the post can only have 5000 :)
    the DataAccessObject interface is : -
    package DAO;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.sql.*;
    import com.sun.rowset.CachedRowSetImpl;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface dataAccessObject extends Remote{
        public String generateConnectionString()throws RemoteException  ;
        public String getUserPassword(String username)throws RemoteException  ;
        public void ExecuteDML(String username, String sql)throws RemoteException  ;
       }the DataAccessObjectImpl class reads as : -
    package DAO;
    import java.sql.*;
    import java.util.Properties;
    import java.io.*;
    import com.sun.rowset.CachedRowSetImpl;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.rmi.*;
    import java.rmi.server.*;
    public class DataAccessObjectImpl extends UnicastRemoteObject implements dataAccessObject{
    Connection conn ;
        String  driver = "oracle.jdbc.driver.OracleDriver";
        CachedRowSetImpl ds ;
        String theString;
        int theNumber;
        Date theDate;
        ResultSet rs;
        String theConnectionURL;
        String thePassword;
        public DataAccessObjectImpl() throws RemoteException{
        public String generateConnectionString() throws RemoteException  {
            Properties configFile = new Properties();
            try {
                configFile.load(this.getClass().getClassLoader().getResourceAsStream("app_config.properties"));
            } catch (IOException error) {
                throw new RemoteException(error.getMessage());
            String connection = configFile.getProperty("JTSTORESConnection");
            return connection;
        public String getUserPassword(String username)throws RemoteException  {
            Properties configFile = new Properties();
            try {
                configFile.load(this.getClass().getClassLoader().getResourceAsStream("app_config.properties"));
            } catch (IOException error) {
                throw new RemoteException(error.getMessage());
            String pwd = configFile.getProperty(username.toUpperCase() + "_PWD");
            return pwd;
        public void ExecuteDML(String username, String sql) throws RemoteException  {
            try {
                Class.forName(driver); // load Oracle driver
                theConnectionURL = generateConnectionString();
                thePassword = getUserPassword(username);
                conn = DriverManager.getConnection(theConnectionURL, username, thePassword);
                Statement s = conn.createStatement();
                s.executeUpdate(sql);
                conn.commit();
                s.close();
                conn.close();
            } catch (SQLException error) {
                throw new RemoteException(error.getMessage());
            } catch (ClassNotFoundException error) {
                throw new RemoteException(error.getMessage());
       If anyone can enlighten me unto what is happening i would be very grateful
    thanks
    James

    Hi,
    I'm trying to use remoting and have come across a problem and i was hoping someone could help me out.
    When i try to run my Server App. I get the following Error:
    Connection refused to host: localHost; nested exception is:
    java.net.ConnectException: Connection refused: connect
    My runService class is : -
    package DAO;
    import java.rmi.*;
    public class runService {
         * @param args the command line arguments
        public static void main(String[] args) {
           try
             {Naming.rebind("//localHost:8100/dataAccess", new DataAccessObjectImpl());
              System.out.println( "Data Access Server is ready" );
             catch(Exception e){
             System.out.println(e.getMessage());}
    }I have trimmed the classes down to three methods as the post can only have 5000 :)
    the DataAccessObject interface is : -
    package DAO;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.sql.*;
    import com.sun.rowset.CachedRowSetImpl;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface dataAccessObject extends Remote{
        public String generateConnectionString()throws RemoteException  ;
        public String getUserPassword(String username)throws RemoteException  ;
        public void ExecuteDML(String username, String sql)throws RemoteException  ;
       }the DataAccessObjectImpl class reads as : -
    package DAO;
    import java.sql.*;
    import java.util.Properties;
    import java.io.*;
    import com.sun.rowset.CachedRowSetImpl;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.rmi.*;
    import java.rmi.server.*;
    public class DataAccessObjectImpl extends UnicastRemoteObject implements dataAccessObject{
    Connection conn ;
        String  driver = "oracle.jdbc.driver.OracleDriver";
        CachedRowSetImpl ds ;
        String theString;
        int theNumber;
        Date theDate;
        ResultSet rs;
        String theConnectionURL;
        String thePassword;
        public DataAccessObjectImpl() throws RemoteException{
        public String generateConnectionString() throws RemoteException  {
            Properties configFile = new Properties();
            try {
                configFile.load(this.getClass().getClassLoader().getResourceAsStream("app_config.properties"));
            } catch (IOException error) {
                throw new RemoteException(error.getMessage());
            String connection = configFile.getProperty("JTSTORESConnection");
            return connection;
        public String getUserPassword(String username)throws RemoteException  {
            Properties configFile = new Properties();
            try {
                configFile.load(this.getClass().getClassLoader().getResourceAsStream("app_config.properties"));
            } catch (IOException error) {
                throw new RemoteException(error.getMessage());
            String pwd = configFile.getProperty(username.toUpperCase() + "_PWD");
            return pwd;
        public void ExecuteDML(String username, String sql) throws RemoteException  {
            try {
                Class.forName(driver); // load Oracle driver
                theConnectionURL = generateConnectionString();
                thePassword = getUserPassword(username);
                conn = DriverManager.getConnection(theConnectionURL, username, thePassword);
                Statement s = conn.createStatement();
                s.executeUpdate(sql);
                conn.commit();
                s.close();
                conn.close();
            } catch (SQLException error) {
                throw new RemoteException(error.getMessage());
            } catch (ClassNotFoundException error) {
                throw new RemoteException(error.getMessage());
       If anyone can enlighten me unto what is happening i would be very grateful
    thanks
    James

  • Invoking a BPEL Process via Java Remote Client

    Hi everyone!
    I want to invoke a BPEL process from my Java Application which is not running on the same Application-Server (not the same Java RE) as the BPEL processmanager does.
    For Applications running on the same AS there is the IDeliveryService class to which you can send a XML-request in order to invoke a BPEL process.
    Is the only way to invoke a BPEL Process from an external application to use a webservice client or is there a similar class for java remote clients?
    For access to the users worklist I use
    IWorkflowServiceClient wfClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT);
    it works fine an I thought there might be a similar way to invoke a bpel process via remote too.
    If anyone knows if it's possible or not please tell me ;)
    Thanks in advance
    Markus

    Hello,
    Here is the code I use:
    Properties props = new Properties();
    Locator locator = null;
    props.put("orabpel.platform", "ias_10g" );
    props.put("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory" );
    props.put("java.naming.provider.url","opmn:ormi://host:port/orabpel" );
    props.put("java.naming.security.principal", "adminuser" );
    props.put("java.naming.security.credentials", "mdp" );
    String securityCredentials = "adminuser";
    String selectedDomain = "default";
    locator = new Locator(selectedDomain,securityCredentials,props);
    IBPELProcessHandle procs[] = locator.listProcesses();
    The error is:
    Exception in thread "main" java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.oracle.bpel.client.BPELProcessHandle; local class incompatible: stream classdesc serialVersionUID = 5429682712928177644, local class serialVersionUID = 8176841433835717563
    at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:82)
    at com.oracle.bpel.client.Locator.listProcesses(Locator.java:309)
    Thanks for help.
    Edited by: 857737 on 14 sept. 2012 10:00

  • Java.rmi.ConnectException using webstart Swing client with WL 8.1 SP2 in a

    Hi all,
    I'm receiving the following exception when invoking a remote method on
    a cached remote stub. This only happens if there are at least two
    nodes running in a cluster. It happens more often the more nodes are
    running.
    It seems that the exception occurs if for a call to a remote method a
    cached stub is used, and if that call is referred to a different node
    in the cluster by the load balancer than the one that the stub
    originally came from. But I'm not completely sure about that...
    Client side config:
    Webstart
    JDK 1.4.2_05
    weblogic.jar (we're experiencing other problems already discussed in
    this group when using wlclient.jar)
    Server side config:
    Weblogic 8.1 SP2
    cluster on Sun Solaris machines (two nodes, one manager)
    Here is the exception stacktrace:
    java.rmi.ConnectException: Could not establish a connection with
    2198062098923170717S:shebea219:[7001,7001,-1,-1,7001,-1,-1,0,0]:SHEBEA219,SHEBEA334:DaGama:DaGamaNode1,
    java.security.AccessControlException: access denied
    (java.net.SocketPermission shebea219 resolve)
    at weblogic.rjvm.RJVMImpl.getOutputStream(RJVMImpl.java:316)
    at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:488)
    at weblogic.rjvm.RJVMImpl.getOutboundRequest(RJVMImpl.java:584)
    at
    weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:91)
    at
    weblogic.rmi.internal.activation.ActivatableRemoteRef.invoke(ActivatableRemoteRef.java:69)
    at
    de.conet.dagama.interesengine.nativesession.SBNativeSession_8da95c_EOImpl_812_WLStub.isConnected(Unknown
    Source)
    at
    de.conet.dagama.agent.flight.nativ.FlightNativeListener.doExitNativeSession(FlightNativeListener.java:244)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
    de.objektpark.framework.command.CommandInvoker.invoke(CommandInvoker.java:132)
    at
    de.objektpark.framework.command.CommandProcessor.doService(CommandProcessor.java:169)
    at
    de.objektpark.framework.command.CommandProcessor.service(CommandProcessor.java:131)
    at
    de.objektpark.framework.command.CommandProcessor.execute(CommandProcessor.java:71)
    at
    de.conet.webactiv.swing.command.GUICommandProcessor.execute(GUICommandProcessor.java:87)
    at
    de.conet.webactiv.swing.controller.GUICommandController.execute(GUICommandController.java:98)
    at
    de.conet.webactiv.swing.controller.GUICommandController.execute(GUICommandController.java:124)
    at
    de.conet.dagama.agent.flight.nativ.FlightFreeNativeView.this_windowClosing(FlightFreeNativeView.java:84)
    at
    de.conet.dagama.agent.flight.nativ.FlightFreeNativeView$1.windowClosing(FlightFreeNativeView.java:73)
    at java.awt.AWTEventMulticaster.windowClosing(Unknown Source)
    at java.awt.Window.processWindowEvent(Unknown Source)
    at javax.swing.JFrame.processWindowEvent(Unknown Source)
    at java.awt.Window.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    Has anyone ever come across the same problem and possibly found a
    solution?
    Any help would be greatly appreciated.
    Thanks in advance
    Rolf

    Hi all,
    I'm receiving the following exception when invoking a remote method on
    a cached remote stub. This only happens if there are at least two
    nodes running in a cluster. It happens more often the more nodes are
    running.
    It seems that the exception occurs if for a call to a remote method a
    cached stub is used, and if that call is referred to a different node
    in the cluster by the load balancer than the one that the stub
    originally came from. But I'm not completely sure about that...
    Client side config:
    Webstart
    JDK 1.4.2_05
    weblogic.jar (we're experiencing other problems already discussed in
    this group when using wlclient.jar)
    Server side config:
    Weblogic 8.1 SP2
    cluster on Sun Solaris machines (two nodes, one manager)
    Here is the exception stacktrace:
    java.rmi.ConnectException: Could not establish a connection with
    2198062098923170717S:shebea219:[7001,7001,-1,-1,7001,-1,-1,0,0]:SHEBEA219,SHEBEA334:DaGama:DaGamaNode1,
    java.security.AccessControlException: access denied
    (java.net.SocketPermission shebea219 resolve)
    at weblogic.rjvm.RJVMImpl.getOutputStream(RJVMImpl.java:316)
    at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:488)
    at weblogic.rjvm.RJVMImpl.getOutboundRequest(RJVMImpl.java:584)
    at
    weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:91)
    at
    weblogic.rmi.internal.activation.ActivatableRemoteRef.invoke(ActivatableRemoteRef.java:69)
    at
    de.conet.dagama.interesengine.nativesession.SBNativeSession_8da95c_EOImpl_812_WLStub.isConnected(Unknown
    Source)
    at
    de.conet.dagama.agent.flight.nativ.FlightNativeListener.doExitNativeSession(FlightNativeListener.java:244)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
    de.objektpark.framework.command.CommandInvoker.invoke(CommandInvoker.java:132)
    at
    de.objektpark.framework.command.CommandProcessor.doService(CommandProcessor.java:169)
    at
    de.objektpark.framework.command.CommandProcessor.service(CommandProcessor.java:131)
    at
    de.objektpark.framework.command.CommandProcessor.execute(CommandProcessor.java:71)
    at
    de.conet.webactiv.swing.command.GUICommandProcessor.execute(GUICommandProcessor.java:87)
    at
    de.conet.webactiv.swing.controller.GUICommandController.execute(GUICommandController.java:98)
    at
    de.conet.webactiv.swing.controller.GUICommandController.execute(GUICommandController.java:124)
    at
    de.conet.dagama.agent.flight.nativ.FlightFreeNativeView.this_windowClosing(FlightFreeNativeView.java:84)
    at
    de.conet.dagama.agent.flight.nativ.FlightFreeNativeView$1.windowClosing(FlightFreeNativeView.java:73)
    at java.awt.AWTEventMulticaster.windowClosing(Unknown Source)
    at java.awt.Window.processWindowEvent(Unknown Source)
    at javax.swing.JFrame.processWindowEvent(Unknown Source)
    at java.awt.Window.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    Has anyone ever come across the same problem and possibly found a
    solution?
    Any help would be greatly appreciated.
    Thanks in advance
    Rolf

Maybe you are looking for