Problem communicating Entity beam to RMI Server

Hi,
I have attached the document describing my problem with this mail. Please have
look at that.
Please do let me know if you have any clue what could be wrong.
Thanks and regards,
Atul
[Question.doc]

Process.getInputStream() gives the parent JVM read access to what the subprocess is writing to its System.out, and Process.getOutputStream() gives the parent JVM write access to what the subprocess is reading (if anything) from its System.in.

Similar Messages

  • Safari cannot open the page ~ The error was: "There was a problem communicating with the web proxy server (HTTP)

    Help!  I was cruzing along just fine and went out tonight only to receive the message above:
    Cannot open Page
    Safari cannot open the page
    The error was: "There was a problem communicating with the web proxy server (HTTP)."
    I have had all the Apple iPhone phone.  Have never encountered anything like this. 
    All systems are GO as soon as I log on to wifi. 
    Can anyone help, please. 

    I am also fixed.  I also loaded Onavo, but that was the other day ... this is what I did with the help of online chat with AT&T ...
    I went to:
    Settings
    Wifi
    I selected the network I was working on by hitting the blue arrow located on right side
    At the detail page of that network I scolled down to the bottom to find HTTP Proxy boxes
    I was on Off and changed it to Auto and it worked! 
    I was soo jazzed!!
    Instructions said if it was already on AUTO, to change it to Manual and make your Port = 80 but I didn't have to do that!
    YIPPIE!!  I'm a new man!!
    Go to settings -----> WI-FI  -----> select the network you're using  ------> hit the blue arrow located on the right-side of the network name (ie: show details of that network), this takes you to another page.  
    --------> at the bottom of the page you'll see "HTTP Proxy" boxes (located below the "renew lease" button) ---------------> change the proxy to AUTO.   Note: if you're already at AUTO, change it to "Manual" and make your Port = 80.

  • RMI Communication failed Through Orion RMI Server( as a part of OC4J)

    I tried to bind an object (an instance of MyRemoteObj) implementing java.rmi.Remote interface with the code:
    Properties prop = new Properties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
          prop.put(Context.PROVIDER_URL,"ormi://192.168.238.238:23891");
          prop.put(Context.SECURITY_PRINCIPAL,"admin");
          prop.put(Context.SECURITY_CREDENTIALS,"welcome");
          Context context = new InitialContext(prop);
          MyRemoteObj myRemoteObj = new MyRemoteObj();
          context.rebind("myRemoteObj", myRemoteObj);
          System.out.println("context provided and obj bound");which is working fine, at least no exception or error is displayed and the last message is appearing on the standart output.
    On the same JVM, i have client querying the rm, registry with the code:
    Properties prop = new Properties();
            prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
            prop.put(Context.PROVIDER_URL,"ormi://sun:23891");
            prop.put(Context.SECURITY_PRINCIPAL,"admin");
            prop.put(Context.SECURITY_CREDENTIALS,"welcome");
            Context context = new InitialContext(prop);
            System.out.println("context provided");
            Object objFound = context.lookup("myRemoteObj");
            ((MyRemoteObj)objFound).doSomethin();
            System.out.println("object found");The seaching process is stuck in the line where "lookup" is called. There is neither an exception nor an error, but a silent running with no response. The message "context provided" is appearing in the standart output but the last message never comes. I tried to construct the stubs and skeletons of theRemoteObject but it did not either.
    Where did i go wrong? 

    I tried to bind an object (an instance of MyRemoteObj) implementing java.rmi.Remote interface with the code:
    Properties prop = new Properties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
          prop.put(Context.PROVIDER_URL,"ormi://192.168.238.238:23891");
          prop.put(Context.SECURITY_PRINCIPAL,"admin");
          prop.put(Context.SECURITY_CREDENTIALS,"welcome");
          Context context = new InitialContext(prop);
          MyRemoteObj myRemoteObj = new MyRemoteObj();
          context.rebind("myRemoteObj", myRemoteObj);
          System.out.println("context provided and obj bound");which is working fine, at least no exception or error is displayed and the last message is appearing on the standart output.
    On the same JVM, i have client querying the rm, registry with the code:
    Properties prop = new Properties();
            prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
            prop.put(Context.PROVIDER_URL,"ormi://sun:23891");
            prop.put(Context.SECURITY_PRINCIPAL,"admin");
            prop.put(Context.SECURITY_CREDENTIALS,"welcome");
            Context context = new InitialContext(prop);
            System.out.println("context provided");
            Object objFound = context.lookup("myRemoteObj");
            ((MyRemoteObj)objFound).doSomethin();
            System.out.println("object found");The seaching process is stuck in the line where "lookup" is called. There is neither an exception nor an error, but a silent running with no response. The message "context provided" is appearing in the standart output but the last message never comes. I tried to construct the stubs and skeletons of theRemoteObject but it did not either.
    Where did i go wrong? 

  • Connecting to MYSQL from RMI Server results SQL Communication fail

    Hi ,
    I have an RMI Server which exports a remote method, which in-turn needs to access content
    from the MYSQL Database.
    PROBLEM: The code snip for RMI Server is given below. In this getChief() is the remote method called
    by the RMI Client running on my same Windows XP machine (ie., localhost).
    I get a slew of exceptions when the DriverManager.getConnection() API call occurs in getChief()
    via the remote method call from the RMI Client. Two exceptions are the SQL Communications failure and Access Denied Socket Exceptions.
    I checked my policy file is OK and MySQL Server is running and my username/password is right in code?
    Can you please let me know what am I missing in the RMI Server code?
    I also found my code works if the Database Connection API is used within main() rather than inside a Remote
    Method...
    The Source and Binary are available in my local Windows XP Machine
    RMI Server: c:/workspace/DirectoryJava/src/server for and c:/workspace/DirectoryJava/bin/server
    RMI Client: c:/workspace/DirectoryJava/src/client for and c:/workspace/DirectoryJava/bin/client
    My security policy file is:
    grant codeBase "file:/workspace/DirectoryJava/bin" {
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
    permission java.net.SocketPermission "*","listen,connect,accept,resolve";
    grant codeBase "file:/workspace/DirectoryJava/bin/client" {
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
    permission java.net.SocketPermission "*","listen,connect,accept,resolve";
    grant codeBase "file:/workspace/DirectoryJava/bin/server" {
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
    permission java.net.SocketPermission "*","listen,connect,accept,resolve";
    grant codeBase "file:/workspace/DirectoryJava/bin/directory" {
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
    permission java.net.SocketPermission "*","listen,connect,accept,resolve";
    grant codeBase "file:/workspace/DirectoryJava/src/client" {
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
    permission java.net.SocketPermission "*","listen,connect,accept,resolve";
    grant codeBase "file:/workspace/DirectoryJava/src/server" {
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
    permission java.net.SocketPermission "*","listen,connect,accept,resolve";
    grant codeBase "file:/workspace/DirectoryJava/src/directory" {
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
    permission java.net.SocketPermission "*","listen,connect,accept,resolve";
    };I checked that mysqld.exe is running at port 3306 and am able to connect to and use it via
    MySQL Command Client successfully.
    Thanks in advance.
    The Exception list is pasted below.
    c:\workspace\DirectoryJava\bin>java -cp "c:/workspace/Directory
    Java/bin/Directory.jar;c:/workspace/DirectoryJava/bin/server;c:/workspac
    e/DirectoryJava/bin;C:/Program Files/MySQL/mysql-connector-java-5.1.6/my
    sql-connector-java-5.1.6-bin.jar" -Djava.rmi.server.codebase=file:/c:/workspace/
    DirectoryJava/bin/Directory.jar -Djava.security.policy=wideopen.policy
    server.DirectoryEngine
    DirectoryEngine bound
    getChief() Called
    SQLException: Communications link failure
    Last packet sent to the server was 0 ms ago.
    SQLState: 08S01
    VendorError: 0
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link fai
    lure
    Last packet sent to the server was 0 ms ago.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
    rce)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1
    074)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2103)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
    rce)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :282)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at server.DirectoryEngine.getChief(DirectoryEngine.java:91)
    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 sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Sou
    rce)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
    ce)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.net.SocketException: java.security.AccessControlException: acces
    s denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve)
    at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndT
    hrowIt(StandardSocketFactory.java:404)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:265)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2026)
    ... 26 moreCODE SNIP:
    =========
    public class DirectoryEngine implements Directory {
    public DirectoryEngine() {
    super();
    public Employee getChief() throws RemoteException {
    Statement stmt = null;
    ResultSet rs = null;
    Employee emp = null;
    // TODO Auto-generated method stub
    try {
    System.out.println("getChief() Called");
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306",
    "<username>","<password>");
    // Username and Password were replaced with root username and password in my original code
    System.out.println("getConnection() Called");
    stmt = conn.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    System.out.println("createStatement() Called");
    rs = stmt.executeQuery("use mysql");
    } catch (SQLException ex) {
    // handle any errors
    System.out.println("SQLException: " + ex.getMessage());
    System.out.println("SQLState: " + ex.getSQLState());
    System.out.println("VendorError: " + ex.getErrorCode());
    ex.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    // it is a good idea to release
    // resources in a finally{} block
    // in reverse-order of their creation
    // if they are no-longer needed
    if (rs != null) {
    try {
    rs.close();
    } catch (SQLException sqlEx){
    // ignore
    rs = null;
    if (stmt != null) {
    try {
    stmt.close();
    } catch (SQLException sqlEx) {
    // ignore
    stmt = null;
    return emp;
    } /* getChief() ends */
    public static void main(String[] args) {
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new SecurityManager());
    try {
    String name = "Directory";
    Directory engine = new DirectoryEngine();
    Directory stub =
    (Directory) UnicastRemoteObject.exportObject(engine, 0);
    Registry registry = LocateRegistry.getRegistry();
    registry.rebind(name, stub);
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    System.out.println("DirectoryEngine bound");
    } catch (Exception e) {
    System.err.println("DirectoryEngine exception:");
    e.printStackTrace();
    } /* end DirectoryEngine class */

    It looks there is some permission issue.
    Can you please try once with below policy and let me know the result.
    grant {
      permission java.security.AllPermission;
    };

  • RMI Server and RMI Client Problem

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.xxx; nested exception is: java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides, it works again. But I have to keep doing that. I have to keep copying the class file to the servlet directory every 2nd time I try to run it for it to work.
    Anyone know what am I doing wrong?

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it
    works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time
    but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host:
    xxx.xxx.xxx.xxx; nested exception is:
    java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides,which class file ? u mean RMIServer's class files ??
    I have faced the same problem too. In my case if i just restart my Tomcat webserver the error goes and the servlet is very well able to connect back to the RMI Server
    it works again. But I have to keep doing that. I have
    to keep copying the class file to the servlet
    directory every 2nd time I try to run it for it to
    work.
    Anyone know what am I doing wrong?

  • My first RMI server: problem

    Hi,
    I'm just trying to create my first RMI program, but I got already blocked immediately:
    It's just a stupid program with a function that returns "ok".
    So what I did is the following:
    1)I created a class OkServer.java
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface OkServer extends Remote {
    public String getOk() throws RemoteException;
    2)I created a class OkServerImpl.java
    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);
    3) I compiled everything with javac *.java
    i use java version below:
    java version "1.5.0_12"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
    Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode)
    4)I opened a cmd window and started the registry with the command c:\rmiregistr
    (a cursor starts blinking, so I think it runs correctly)
    5)then I start the program with the command: C:\java OkServerImpl
    but I get the error below !!
    C:\Temp\rmitester>java OkServerImpl
    Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
    at java.security.AccessController.checkPermission(AccessController.java:427)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
    at java.net.Socket.connect(Socket.java:513)
    at java.net.Socket.connect(Socket.java:469)
    at java.net.Socket.<init>(Socket.java:366)
    at java.net.Socket.<init>(Socket.java:179)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:111)
    at OkServerImpl.main(OkServerImpl.java:18)
    What's wrong???

    solved, but i don't understand why i encountered this particular issue (that isn't mentioned to happen or to configure in my book):
    i had to create a custom policy file:
    make a file "c:\temp\rmitester\policy.all" and past the text below in it:
    grant {
    permission java.security.AllPermission "", "";
    thereafter launch the server with this command:
    c:\temp\rmitester\java -Djava.security.policy=policy.all OkServerImpl
    and the client with this command:
    c:\temp\rmitester\java -Djava.security.policy=policy.all OkClient localhost
    Can anyone explain if it was normal that i encountered this problem or was it seldom behaviour that happens only to me?

  • Registry on RMI Server problem

    I have a rmi server app. running 24/7 on a Win2K box with clients connecting locally and over the Internet. Every so often the clients cannot connect and/or currently connected clients cannot communicate with the server. Sometimes we go a month without this happening and sometimes it happens twice in a day. When it does happen, the server app. is still fully functionally. It appears that the registry is locked or corrupt. Clients attempting to connect suceed with the Naming.lookup, but fail after that. When this happens I stop and restart the server app. and the clients can then automatically reconnect. I see other people have had this problem but I haven't seen any solution.
    Thanks.

    Seems as if a bug.
    For more details refer to
    http://developer.java.sun.com/developer/technicalArticles/RMI/rmi/

  • Problem with lost of the access to the RMI server

    Hi to all.
    We have two applications. First one (master) provides to second (slave) through RMI service their data or other resources.
    In the ordinary way all works fine. But if we need for some reason restart master application, slave can't access to the RMI service and calling of the method Naming.lookup(...) throws java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException
    Interestingly, calling of method Namig.list(...) at this moment correctly returns an array of the names bound in the registry.
    For completeness, in the time of restarting master application, classes of the RMI services are not changed and thus Stub/Skeleton classes are same on both sides.
    What is reason for this behaviour? It is way to restart/restore RMI access of the slave application to the master without restarting server (Tomcat) of both applications?
    Thank, Roman

    Thank for your reply, but your suggestion not helped me now.
    For registering and binding I used usual practices. Following snippets of code are inside method that perform initialization on application startup. I was trying three versions.
    First version creates registry and binds service classes only. Without any checks.
    try {
      LocateRegistry.createRegistry(rmiPort);
      String ip = Functions.getCurrentEnvironmentNetworkIp();
      if (ip.startsWith("?"))
        throw new Exception("Can't retrieve application IP address.");
      logger.info("Application IP address: " + ip);+
      RMIServiceCommonImpl rmiServiceCommon = new RMIServiceCommonImpl();
      String name = "rmi://" + ip + ":" + rmiPort + "/";
      Naming.rebind(name + IRMIServiceCommon.RMI_SERVICE_COMMON_NAME, rmiServiceCommon);
    catch (Exception e) {
      logger.error("Failed to register RMI services: ", e);
    }On first application start all is OK and client has no problem to access RMI service.
    But if master application is restarted, calling of the method LocateRegistry.createRegistry(rmiPort); throws
    java.rmi.server.ExportException: internal error: ObjID already in use
    Since that, client can't access to the RMI service and following code (method Naming.lookup) throws
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException
      String name = "rmi://" + ConfigServlet.getProperty("rmiHostUrl") + "/";
      IRMIServiceCommon service = (IRMIServiceCommon) Naming.lookup(name + IRMIServiceCommon.RMI_SERVICE_COMMON_NAME);Second version checks if registry exist and trying to get list of registered services. If services not exist Register is created.
    try {
      Registry reg = LocateRegistry.getRegistry(rmiPort);
      String[] list = null;
      try {
        list = reg.list();
      catch (Exception ex) {
        // ignore
      if (list == null || list.length == 0)
        LocateRegistry.createRegistry(rmiPort);
      String ip = Functions.getCurrentEnvironmentNetworkIp();
      if (ip.startsWith("?"))
        throw new Exception("Can't retrieve application IP address.");
      logger.info("Application IP address: " + ip);
      String name = "rmi://" + ip + ":" + rmiPort + "/";
      RMIServiceCommonImpl rmiServiceCommon = new RMIServiceCommonImpl();
      Naming.rebind(name + IRMIServiceCommon.RMI_SERVICE_COMMON_NAME, rmiServiceCommon);
    catch (Exception e) {
      logger.error("Failed to registering RMI services: ", e);
    }Again, first start is OK.
    In this case, after application restart, calling of method Naming.rebind() throws
    java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1272)
    INFO: Illegal access: this web application instance has been stopped already. Could not load eu.arachne.rmi.RMIServiceCommonImpl_Stub.
    This exception is followed by similar exceptions, but differs in class names (stubs) - java.rmi.server.RemoteStub, java.rmi.server.RemoteObject, java.rmi.dgc.Lease, java.rmi.dgc.VMID, java.rmi.server.UID
    Of course, client application can't access to the service.
    The third version first unbinds all services and then performs binding again.
    if (list == null || list.length == 0)
      LocateRegistry.createRegistry(rmiPort);
    else {
      for (int ii = 0; ii < list.length; ii++)
        Naming.unbind(name + list[ii]);
    }But again, rebinding fail as I mentioning above.
    I don't know... :-( How I can solve this problem?
    Thank, Roman

  • RMI Server Offline Problem

    Hello all, I am e newbie in the world of RMI programming. I have developed an application that can control two devices over the internet. The code files are given below :
    Parallel.java
    import java.rmi.*;
    public interface Parallel extends Remote
         void relayDriver(byte k) throws RemoteException;
         byte currentStatus() throws RemoteException;
    ParallelImpl.java
    import parport.ParallelPort;
    import java.rmi.*;
    import java.rmi.server.*;
    public class ParallelImpl extends UnicastRemoteObject implements Parallel
         private Byte ctrlValue;
         ParallelPort lpt1 = new ParallelPort(0x378); // 0x378 is normally the base address for the LPT1 port
         public ParallelImpl(byte a) throws RemoteException
              ctrlValue = a;
              lpt1.write(ctrlValue);
              System.out.println("Device Actuation Code "+ctrlValue);
         public void relayDriver(byte k) throws RemoteException
              ctrlValue = k;
              System.out.println("Device Actuation Code "+ctrlValue);
              lpt1.write(ctrlValue);
         public byte currentStatus() throws RemoteException
    return ctrlValue;
    ParallelClient.Java
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ParallelClient extends JApplet implements ActionListener
         Byte g;
         String url = "rmi://169.254.196.149/";
         private Container container;
         private javax.swing.JTextArea resultArea;
         public void init()
              container = getContentPane();
              container.setLayout( new BorderLayout() );
              resultArea = new javax.swing.JTextArea();
              JRadioButton buttonZero = new JRadioButton("No Device
    On");
         buttonZero.setMnemonic(KeyEvent.VK_A);
         buttonZero.setActionCommand("0");
         buttonZero.setSelected(true);
         JRadioButton buttonOne = new JRadioButton("Device 1 On
    Only");
         buttonOne.setMnemonic(KeyEvent.VK_B);
         buttonOne.setActionCommand("1");
         JRadioButton buttonTwo = new JRadioButton("Device 2 On
    Only");
         buttonTwo.setMnemonic(KeyEvent.VK_C);
         buttonTwo.setActionCommand("2");
         JRadioButton buttonThree = new JRadioButton("Device 1
    and 2 Both On");
         buttonThree.setMnemonic(KeyEvent.VK_D);
         buttonThree.setActionCommand("3");
         //Group the radio buttons.
         ButtonGroup group = new ButtonGroup();
         group.add(buttonZero);
         group.add(buttonOne);
         group.add(buttonTwo);
         group.add(buttonThree);
         //Register a listener for the radio buttons.
         buttonZero.addActionListener(this);
         buttonOne.addActionListener(this);
         buttonTwo.addActionListener(this);
         buttonThree.addActionListener(this);
              JPanel radioPanel = new JPanel(new GridLayout(0, 1));
         radioPanel.add(buttonZero);
         radioPanel.add(buttonOne);
         radioPanel.add(buttonTwo);
         radioPanel.add(buttonThree);
         container.add(radioPanel, BorderLayout.LINE_START);
              container.add(resultArea, BorderLayout.SOUTH);
         public void actionPerformed(ActionEvent e)
              try
                   Parallel r1 = (Parallel)Naming.lookup(url +
    "inival");
                   if(r1.currentStatus()==0)
                             resultArea.setText("Previous
    Status: No Devices Online....");
                        else if(r1.currentStatus()==1)
                             resultArea.setText("Previous
    Status: Device 1 Online. Device 2 Offline.");
                        else if(r1.currentStatus()==2)
                             resultArea.setText("Previous
    Status: Device 2 Online. Device 1 Offline.");
                        else
                             resultArea.setText("Previous
    Status: Device 1 & 2 both are Online.");
                   g = Byte.parseByte(e.getActionCommand());
                   r1.relayDriver(g);
                   if(r1.currentStatus()==0)
                             resultArea.setText("Current
    Status: No Devices Online....");
                        else if(r1.currentStatus()==1)
                             resultArea.setText("Current
    Status: Device 1 Online. Device 2 Offline.");
                        else if(r1.currentStatus()==2)
                             resultArea.setText("Current
    Status: Device 2 Online. Device 1 Offline.");
                        else
                             resultArea.setText("Current
    Status: Device 1 & 2 both are Online.");
              catch(Exception et)
                   resultArea.setText("Server OffLine");
    ParallelServer.java
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    public class ParallelServer
         public static void main(String args[])
              try
                   System.out.println("Constructing Server Implementations ....");
                   ParallelImpl p1 = new ParallelImpl((byte)0);
                   System.out.println("Binding Server Implementation to registry ....");
                   Naming.rebind("inival",p1);
                   System.out.println("Waiting for invocations from Client ....");     
              catch(Exception e)
                   System.out.println("Server is Offline or Line has broken. Error : "+ e);
    The corresponding stub files, class files have been loaded on the internet. http://rcviproject.110mb.com/
    On the server machine the rmi registry is on and the ParallelServer program is also running. But when the applet at the URL is actuated then it shows 'server offline'. Why is this happening? Please help.

    That did not print anything. The server when started by the following commands :
    start rmiregistry
    start java ParallelServer
    continues to run at Waiting for invocation from client ...... no error msg is shown.
    do i need tomcat on the server machine in addition to this ?

  • Rmi server problem

    hi
    Can anybody tell me how to stop the Jvm to free the Rmi server port and the remote object?

    Hi,
    The first step: unbind the bound object from the registry!
    As far as I know the UnicastRemoteObject calls the exportObject() method in its constructor. If you want to force the unregistering call the UnicastRemoteObject's unexportObject() method on the server object.
    After these two calls (Naming.unbind(), UnicastRemoteObject.unexportObject()) the server object surely is no longer listening the remote calls, the JVM exits smothly...
    Sany

  • Problem in starting RMI server, please help!

    Hi , all:
    I am learning RMI from SUN's tutorial. I set all of program packages as same as the tutorial, compiled all of programs . and built all of the jar files, the server classes and the client classes.When I run the server, ComputeEngine, it did not work ,and the following messages were showed at command lines:
    C:\RMI\doc>java -Djava.rmi.server.codebase=file:/c:\rmi\ann\public_html\classes/
    -Djava.rmi.server.hostname=localhost -Djava.security.policy=java.policy eng
    ine.ComputeEngine
    ComputeEngine exception: access denied (java.net.SocketPermission 127.0.0.1:1099
    connect,resolve)
    java.security.AccessControlException: access denied (java.net.SocketPermission 1
    27.0.0.1:1099 connect,resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.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)
    at java.net.Socket.<init>(Socket.java:100)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
    SocketFactory.java:25)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
    SocketFactory.java:120)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:160)
    at engine.ComputeEngine.main(ComputeEngine.java:25)
    Please give helps .
    Thanks!

    Thank.
    Thank.
    I have put them at the same directory, but is deos not work.
    Something I am not sure.
    On the SUN's tutorial , the follows is given:
    Win32:
    java -Djava.rmi.server.codebase=file:/c:\home\ann\public_html\classes/
    -Djava.rmi.server.hostname=zaphod.east.sun.com
    -Djava.security.policy=java.policy
    engine.ComputeEngine
    I changed hostname = localhost
    I also changed the code of the server class given by tutorial :
    String name = "//host/Compute" ;
    to:
    String name = "//localhost/Compute";
    Should I make such changes?
    Here is the server class given by the tutorial:
    package engine;
    import java.rmi.*;
    import java.rmi.server.*;
    import compute.*;
    public class ComputeEngine extends UnicastRemoteObject
    implements Compute
    public ComputeEngine() throws RemoteException {
    super();
    public Object executeTask(Task t) {
    return t.execute();
    public static void main(String[] args) {
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new RMISecurityManager());
    String name = "//host/Compute";
    try {
    Compute engine = new ComputeEngine();
    Naming.rebind(name, engine);
    System.out.println("ComputeEngine bound");
    } catch (Exception e) {
    System.err.println("ComputeEngine exception: " +
    e.getMessage());
    e.printStackTrace();

  • Problem in starting RMI server, help please

    Hi , all:
    I am learning RMI from SUN's tutorial. I set all of program packages as same as the tutorial, compiled all of programs . and built all of the jar files, the server classes and the client classes.When I run the server, ComputeEngine, it did not work ,and the following messages are showed at command lines:
    C:\RMI\doc>java -Djava.rmi.server.codebase=file:/c:\rmi\ann\public_html\classes/
    -Djava.rmi.server.hostname=localhost -Djava.security.policy=java.policy eng
    ine.ComputeEngine
    ComputeEngine exception: access denied (java.net.SocketPermission 127.0.0.1:1099
    connect,resolve)
    java.security.AccessControlException: access denied (java.net.SocketPermission 1
    27.0.0.1:1099 connect,resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.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)
    at java.net.Socket.<init>(Socket.java:100)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
    SocketFactory.java:25)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
    SocketFactory.java:120)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:160)
    at engine.ComputeEngine.main(ComputeEngine.java:25)
    Please give helps .
    Thanks!

    You are setting the security policy to the file named
    java.policy, make sure that it is in the same
    directory where you are invoking the java compiler.Thank.
    I have put them at the same directory, but is deos not work.
    Something I am not sure.
    On the SUN's tutorial , the follows is given:
    Win32:
    java -Djava.rmi.server.codebase=file:/c:\home\ann\public_html\classes/
    -Djava.rmi.server.hostname=zaphod.east.sun.com
    -Djava.security.policy=java.policy
    engine.ComputeEngine
    I changed hostname = localhost
    I also changed the code of the server class given by tutorial :
    String name = "//host/Compute" ;
    to:
    String name = "//localhost/Compute";
    Should I make such changes?
    Here is the server class given by the tutorial:
    package engine;
    import java.rmi.*;
    import java.rmi.server.*;
    import compute.*;
    public class ComputeEngine extends UnicastRemoteObject
    implements Compute
    public ComputeEngine() throws RemoteException {
    super();
    public Object executeTask(Task t) {
    return t.execute();
    public static void main(String[] args) {
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new RMISecurityManager());
    String name = "//host/Compute";
    try {
    Compute engine = new ComputeEngine();
    Naming.rebind(name, engine);
    System.out.println("ComputeEngine bound");
    } catch (Exception e) {
    System.err.println("ComputeEngine exception: " +
                   e.getMessage());
    e.printStackTrace();

  • Problem connecting RMI-Server using a servlet

    Hi All..
    I have a RMI-client server model woring fine in AIX box.I am currently in a need to create one web client(may be with servlet or JSP).
    I wrote a sample servlet which try to connect to the RMI server. But when I run the servlet Its simply try to connect and then wait for unlimited time,not even print any exception/error.
    Both my RMI sevrer and Tomcat are in the same box.
    I am sending the servlet code for your reference.
    import java.rmi.*;
    import java.rmi.registry.Registry;
    import java.rmi.registry.LocateRegistry;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import ir77.mon.engine.*;
    public class WebClient extends HttpServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    XmlServerIntf xmlServerIntf = null;
    PrintWriter out = res.getWriter();
    res.setContentType("text/plain");
    try{
    out.println("Connecting to server......");
    //Seems this one is sufficient.(either this code or the below one)
    //String strServerUrl = "rmi://" + "192.168.100.22" + "/ir77.mon.engine";
    //xmlServerIntf = (XmlServerIntf) Naming.lookup(strServerUrl);
    //Try with this one also
    Registry reg = LocateRegistry.getRegistry("192.168.100.22", 2004);
    xmlServerIntf = (XmlServerIntf) reg.lookup("rmi://192.168.100.22/ir77.mon.engine");
    out.println("Connected to server");
    catch (Exception e){
    System.out.println("Exception in WebClient"+e);
    when I run the servlet in the browser with "http://192.168.100.22:8080/WebClient" its simply prints " Connecting to server......" and waits.
    Note : 192.168.100.22 - where my rmi server starts and 2004 -where I created by rmiregistry.I created it using LocateRegistry.createRegistry(2004);
    I have tried starting tomcat with "-security" option too but no responds as well.
    Do I have to provide some grant permission in catlina.policy file?If yes what?
    currently I have tried with giving all permission..
    Do I need to change the RMI server code?
    Any help will be highly appreciated....

    Hi genady,
    Oh....Ya I like to...I thought no body was interested...as I didn't get any reply from anybody....
    Well The first thing is that with the look up method in the servlet
    it should be like :
    Registry reg = LocateRegistry.getRegistry("ip address of the rmi server", port number);
    RMIServerInterface = (type cast with RMIServerInterface) reg.lookup("rmi binding string");
    Now you are able to get the server interface object & you can call any method.
    Next you have to provide the grant permission in the catalina.policy file to the folder where you have your application like....
    grant codeBase "file:${catalina.home}/webapps/ROOT/WEB-INF/classes/-" {
    permission java.security.AllPermission;
    Or you can give specific permissions also.
    Finally you have to run the tomcat as : $catalina.sh start -security
    Note: One more thing you have to keep in mind that's the structure of your application. ie com.mon.yourapp.......u have to create the same structure in tomcat's classes folder .
    Its done...........

  • J2EE problem while accessing RMI server

    Hi,
    I have a J2EE application in Oracle 9iAS server, I have created an application which access a RMI Server runs in a different PC, it works fine in my /dev site, I moved the same files to /test site (Same machine but different context), which also access the same RMI Server, now my application throws the following error in /test site where as it is working perfectly in /dev site.
    If you have any idea on this please let me know. Thanks in advance.
    Regards,
    Venkat
    ----------- Exception throws in server --------------------
    500 Internal Server Error
    java.lang.ClassFormatError: com/sgsap/feed/server/IFeed (Extra bytes at the end of the class file)     at java.lang.ClassLoader.defineClass0(Native Method)     at java.lang.ClassLoader.defineClass(ClassLoader.java:493)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].naming.ContextClassLoader.findClass(ContextClassLoader.java:250)     at java.lang.ClassLoader.loadClass(ClassLoader.java:299)     at java.lang.ClassLoader.loadClass(ClassLoader.java:255)     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)     at java.lang.ClassLoader.defineClass0(Native Method)     at java.lang.ClassLoader.defineClass(ClassLoader.java:493)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].naming.ContextClassLoader.findClass(ContextClassLoader.java:250)     at java.lang.ClassLoader.loadClass(ClassLoader.java:299)     at java.lang.ClassLoader.loadClass(ClassLoader.java:255)     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)     at java.lang.Class.forName0(Native Method)     at java.lang.Class.forName(Class.java:195)     at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:654)     at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:121)     at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)     at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)     at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)     at java.rmi.Naming.lookup(Naming.java:84)     at com.sgsap.feed.client.FeedClient.getData(FeedClient.java:99)     at ReportManager.updatePostTradeFeedServerValues(ReportManager.java:998)     at ReportManager.updatePostTradeFeedValues(ReportManager.java:961)     at ReportManager.getPostTradeData(ReportManager.java:1449)     at /html/Trade/PostTradeReportExcel.jsp._jspService(/html/Trade/PostTradeReportExcel.jsp.java:84) (JSP page line 44)     at com.orionserver[Oracle9iAS (1.0.2.2) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:54)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpApplication.serviceJSP(HttpApplication.java:5458)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.JSPServlet.service(JSPServlet.java:31)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)

    Looks like ClassLoader tries to load different class. Check your classpath, check where are classes com/sgsap/feed/server/IFeed and if there are more than one such class, check why if your app is in /dev it is loading different class than when it is in /test.
    Other solution could be that something gone wrong while compilation. Are you sure you was not recompiling any code between testing it on /dev and on /test?
    I do not know, I am just trying to give some clues.
    Regards
    Pawel

  • Rmi server communicating with client

    Is there any way for an rmi server to communicate back to the client? What I mean is, the client connects to the server and calls some method x(). One of the arguments of x() is the client(x(AClient ac)). Assume that AClient is a JFrame and has a method y() which adds a button to the frame or something. If the server calls ac.y(), in my understanding/experience, the server would actually create a local copy of AClient and add the button to the local copy, not to the frame that the client user is looking at.Is this correct? { 
      If so, is there any way to have ac.y() add the button to the client user's frame?
        If not, does anyone have any ideas for how to implement something like this relatively easily? 
    If not, does anyone have any ideas why it's not responding that way for me?I'm trying to avoid programming socket connections for this, and would love to be able to do it with rmi.
    Thanks in advance,
    m

    Not sure exactly what your starting point is. But:
    1. The client must be a UnicastRemoteObject.
    2. If your client is behind a firewall, then the scheme probably won't work. (Explored exhaustively in this forum.)

Maybe you are looking for

  • AP Invoice and AP Credit Memo Reconciliation

    HI Expert, I just want to ask if there's a way to automate reconciliation of AP Invoice and AP Credit Memo related to each other? What I did was just open the AP invoice and i copied to AP Credit Memo. I assumed that this was automatically reconciled

  • BT Parental Controls window won't go away

    Hi there, I use BT Internet and am on wifi. Today I switched on my PC and every time I open a webpage in Google Chrome or Internet Explorer, I get a little window from BTInternet asking me if I want to activate Parental Controls. I click "No" and it

  • Not picking up N signal from router

    I recently purchased a NetGear RangeMax Dual Band Wireless N Router. I live in a three-story townhome, with a Mac mini on the first floor and an Imac with Airport Extreme on the third floor. I hooked up the router to my Comcast modem and the router t

  • Call enhancement class method from Bus. workflow task

    Hi all, I recently enhanced a global class from SAP (add a new method). Now I would like to call it from a workflow task (ABAP Class object used in the task). So it seems that only "native" methods from the class itself can be selected for the object

  • TOC will not align with topic

    Hi I am working with Robohelp X5. I have built a help file and have exported it to a chm file - when I open the help file in the program the top navigation synchonizes with my topics but my TOC on the left side of the screen does not. Is there a way