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 ?

Similar Messages

  • RMI Server Basic Problem

    Hi,
    I have a special problem for which I have no idea at the moment how to solve, although I am pretty new to RMI.
    I get this error message
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: rmikochbuch.RemoteDateImpl_Stub
    when I try to start an executable jar-file.
    What I have is:
    On my development PC (Win2k WS) I run
    java -jar RMI_Server_Test_01.jar
    (of course after "start rmiregistry") and it works. Now I take this jar file and copy it to two other PCs (Win XP / Win2k Server). So when I try to start my jar file on these machines too, I get the error messages you see above. All three machines have the same SDK 1.4.2_07 installed.
    I have neither an explanation why it does not work on the other machines nor do I have any idea how to solve this problem. :(
    Additional info:
    The error message occurs in this code block:
          RemoteDateImpl im = new RemoteDateImpl();
          System.out.println( "DateServer starting..." );
          Naming.rebind( RemoteDate.LOOKUPNAME, im );The "DateServer starting..." gets displayed but then the program crashes and exits.

    Got this problem solved now.
    What I had to do - and this is not mentioned in the Java cookbook (O'Reilly):
    Copy the Interface, the Implementation plus Stub + Skel .class files to the CLASSPATH on the server.
    Now comes the second part - connect from a client to this server...

  • 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

  • Could anybody suggest how I must fix the outgoing mail server-SMTP problem, when it indicates to be offline? I couldn't manage to turn it on. Thank you!

    Hello everybody!
    Could anybody suggest how I must fix the outgoing mail server-SMTP problem, when it indicates to be offline?
    I tried everythind and still couldn't manage to turn it on.
    Thank you!

    Hopefully I solved it....

  • 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

  • Urgent Help Required For Starting RMI server from servlet.

    I am currently working on rmi project.
    I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
    I am writing servlet and inside it i am binding object to registry for rmi server.
    which will be deployed on remote server.
    code ....
    Registry reg;
    reg=LocateRegistry.createRegistry(1099);
    Server server=new Server("server");//class whose remote object to be accessed
    //extends unicast remote object.Implement ServerInt interface which extends Remote.
    reg.bind("server",server);
    When i am trying to access this object i am getting following exception.
    javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
    on: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: ServerModule.ServerInt]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at RequstReplication.main(RequstReplication.java:27)
    Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
    tion is:
    java.lang.ClassNotFoundException: ServerModule.ServerInt
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    ... 4 more
    Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
    at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    ... 5 more
    I can access naming enumeration of registry and object bound to it.
    by following program.I shows corect objects.
    Context namingContext=new InitialContext();
    NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
    while(e.hasMore())
    System.out.println(e.next().getName());
    While when i start RMI server from simple java program i can access these objects from registry.
    I am not getting what is problem problem.Is there any other way to send request?
    Plese give quick response.

    I am currently working on rmi project.
    I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
    I am writing servlet and inside it i am binding object to registry for rmi server.
    which will be deployed on remote server.
    code ....
    Registry reg;
    reg=LocateRegistry.createRegistry(1099);
    Server server=new Server("server");//class whose remote object to be accessed
    //extends unicast remote object.Implement ServerInt interface which extends Remote.
    reg.bind("server",server);
    When i am trying to access this object i am getting following exception.
    javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
    on: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: ServerModule.ServerInt]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at RequstReplication.main(RequstReplication.java:27)
    Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
    tion is:
    java.lang.ClassNotFoundException: ServerModule.ServerInt
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    ... 4 more
    Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
    at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    ... 5 more
    I can access naming enumeration of registry and object bound to it.
    by following program.I shows corect objects.
    Context namingContext=new InitialContext();
    NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
    while(e.hasMore())
    System.out.println(e.next().getName());
    While when i start RMI server from simple java program i can access these objects from registry.
    I am not getting what is problem problem.Is there any other way to send request?
    Plese give quick response.

  • Windows 8/8.1: Printer Offline Problems

    Windows 8/8.1: Printer Offline Problems
    Are you getting an error that your network or wireless printer is offline when you try to print?
    When you print to your network printer, does it fail, and when you check the printer status it says Offline?
    Do you have problems printing to your wireless printer after your PC has been asleep?
    If you answered YES to any of the above questions, then you have a problem with your network printer being offline.  After some investigation into this problem, we recommend updating windows.  Run Windows update to check that your version of Windows 8 is up to date.
    There are a few windows updates that may help with this problem
    1)    Install this Microsoft patch to make sure this private-public-private network issue does not reoccur. It is part of the April 2014 Windows Update package for Windows 8.1 and Server2012 R2 (http://support.microsoft.com/kb/2919355).
    2)      Install this Microsoft patch for the WSD service.  http://support.microsoft.com/kb/3000461
    If this does not help, then please follow the steps list below which will give you a Workaround that may help with this problem.
    Assign the printer a static IP address
    An IP address is an Internet network address that the computer can use to communicate with the printer. Enter a static IP address to make sure that the wireless connection remains stable. Follow these steps to assign the printer a static IP address.
    Get the printer IP address.
    Press the Wireless button on the printer control panel to view the network settings.
    Access the Network menu on the printer control panel.
    Print a Network Configuration Page or Wireless Test Report page.
    Once you have the printer's IP address, open a new web browser window or tab.
    Type the IP address in your web browser's address bar, and then press Enter.
    Make sure that you type the IP address into the browser's address box. If you type it into a tool bar search box, the EWS will not open.
    If the message 'There is a problem with this website's security certificate' appears in the web browser when you try to open the embedded web server (EWS), or when you navigate within the EWS, click ' Continue to this website (not recommended)'.
     note:
    Choosing 'Continue to this website (not recommended)' will not harm your computer while you navigate within the EWS for your printer. If you encounter this error outside of your printer's EWS, your computer could be at risk.
    If the browser fails to open the EWS after you click 'Continue to this website (not recommended)', refresh the browser window.
    The Embedded Web Server (EWS) for the printer opens and confirms that the printer is on the same network as the computer.
    In the EWS, click the Network tab.
    In the Wireless section, click the Network Address (IP) or IPv6 configuration, depending on your network setup.
    Click Manual IP, and then click Suggest a Manual IP Address. A manual IP address, Subnet Mask, and Default Gateway displays.
    After the manual IP address populates, click Manual DNS Server.
     note:
    Keep a record of the manual IP address for reference.
    On the Network Configuration Page you printed earlier, locate the DNS Server addresses, type the DNS addresses in the Manual Preferred DNS Server and Manual Alternate DNS Server fields, and then click Apply.
    If the DNS addresses are not listed on the Network Configuration Page, or if you have trouble accessing the network or Internet with the original DNS addresses, use one of the following methods to obtain DNS addresses.
    Method one: Use publicly available DNS server addresses
    Configure the printer using publicly available DNS server addresses. To find available DNS server addresses, search online for 'public DNS servers'.
    After you find public DNS server addresses, type the addresses in the Manual Preferred DNS Server and Manual Alternate DNS Server fields, and then click Apply.
    Method two: Get the network DNS information via your computer
    Select your operating system, and then use the following directions to obtain the DNS server addresses.
    Right-click the Start button () or the lower left corner of the screen, click Run, type cmd, and then press Enter.
    When the command window opens, type ipconfig /all, and then press Enter. Information about the computer's network displays.
    Scroll to and locate the DNS Server addresses.
    In the EWS, type the DNS addresses in the Manual Preferred DNS Server and Manual Alternate DNS Server fields, and then click Apply.
    Print a test page to make sure that the printer's IP address is the same as you assigned.
    Right-click the Start button () or the lower left corner of the screen, click Search, type HP and click your printer in the results. Click Utilities, and then click Update IP address to update the address in the software.
    Adding a Wireless Network Printer using Control Panel
    Go to Control Panel and choose Devices and Printers
    Click on Add Printer
    The PC will search the local network and display the network printers.
    Choose the printer and select Next
    The system will then try and auto select a compatible driver
    Select the current driver and Click Next
    The system will then ask for a name for the printer. The user can change the name and then click Next
    The User can then choose to share the printer
    The user can select to make this new printer the default and then click Finish.
    The new printer is now setup but this printer may be using the In OS driver (Class) rather than the HP Full Function driver.
    To change the printer to use the HP Full Function driver follow the following instructions. I would recommend changing the driver to the HP Full Function driver as the User can then use features such as Custom paper sizes.
    Go back into Control Panel and choose devices and Printers, right click on the newly created printer and choose Printer Properties
    Choose the Advanced Tab
    Click on the driver section drop down and choose the Driver for the printer that does not have the words Class driver after it.
    Click apply and then OK and the driver will be changed to the HP Full Function driver for the printer.
    The user should try this configuration and see if they still experience problems.
    Please Note:
    DO NOT Remove the Original Printer Icon from Devices and Printers as the HP Printer Assistant will stop working.
    JonW
    I work for HP

    I have the printer offline problem. It started when I ran out of toner. I have now installed a new toner cartridge.
    Your solution does not help me because I have tried to install Win8.1 and it failed.
    I would just reinstall my printer but I have a long list of items in my print queque and I don't want to lose them.
    Is there another solution? 
    Or is there a way I can save the print queue?
    Mike

  • Cant create JDBC Connections in RMI Server

    I am having a pretty weird problem which I am struggling with for the last three days. In the main method of the Server object, following three things are supposed to happen:
    1) Creation of a JDBC Connection
    2) Creation of a Remote Object and then publishing the same to Registry.
    3) Creation of another JDBC Connection (exactly same as in step1)
    step 1 and 2 successfully executes and the third one always errors out. I just simply get a NullPointerException.
    If I comment out step 2, step 3 executes successfully. Can someone please tell me the mystery? I need your response really urgently so please help me.
    TIA
    Code Snippet:
     public static void main(String[] args) {
      System.setSecurityManager(new RMISecurityManager());
      try {
       Properties dbProps = new Properties();
       dbProps.put("user", "SDAWOODI");
       dbProps.put("password", "SDAWOODI");
       java.sql.Connection connection =    java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps);
      catch (Exception sqle) {
       System.out.println("[11111]"+sqle.toString());
      Properties props = new Properties();
      props.put("java.rmi.server.codebase", rmiCodeBase);
      System.setProperties(props);
      try {
       SchedulerRImpl schedulerR = new SchedulerRImpl(ssce_sch1);
       String nameStr = "s-sce-scheduler";
       try {
        Naming.bind(nameStr, schedulerR);
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler bound with RMI registry!!!");
       catch (AlreadyBoundException abe) {
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler is already bound with RMI registry ... trying RE-bind ...");
        try {
         Naming.rebind(nameStr, schedulerR);
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler RE-bound with RMI registry!!!");
        catch (Exception e) {
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Rcheduler RE-binding failed :(((");
      catch (Exception e) {
       if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] SchedulerR instantiation failed:((( : "+e.toString());
      Properties dbProps2 = new Properties();
      dbProps2.put("user", "SDAWOODI");
      dbProps2.put("password", "SDAWOODI");
      try {
       java.sql.Connection connection2 = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps2);
       if (connection2==null) {
       System.out.println("connection is NULL");
      else {
       System.out.println("connection is NOT null");
     catch (Exception sqle2) {
      System.out.println("[22222]"+sqle2.toString());
    }

    In reply to reply #4:
    You can also quote the other part of my reply when it comes to snippets. There are so many pieces of code missing from your snippet that I simply cannot guess what is wrong. (Please do not put your entire class structures here.)
    We get connections in many different classes at many different times. It is after all an application that does user work and the user work involves database accesses. Some of those accesses are before RMI (to establish repositories, etc). Most are after.
    This URL (jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV) appears to use a network connection (yes?). Is the 1521 a port? Are you trying to reuse this port? (the first conn uses the same URL). What port does RMI use?
    There is nothing in your snippet that stands out obviously as "this is wrong".
    RMI uses networking. JDBC uses networking.
    Try substituting some other networking code in place of the RMI code and see if you still get a null trying the second connection. As you say, if you leave out the RMI code the second get.conn works.
    Try leaving out the first get.conn. Do the RMI and second get.conn.
    Try this and try that and try some more. I once had this problem with a network printer that would not print. The code was fine. The URL was fine. The response from the network and printer were both fine. The damn thing just wasn't printing. Turns out there was this bit, yes a single bit, in one word of a property called the "start print bit". If this bit wasn't on, nothing happened. I tried every combination until I finally found it.
    I wish you the best.

Maybe you are looking for

  • Hands On Lab: JD Edwards EnterpriseOne Business Services Development

    I am attempting to complete the tasks in the lab listed in this thread's title, but I am having trouble with it. My EOne versions are: App. Vers.: 8.12 Tools Vers.: 8.97.10 When attempting to add a published business service object to my project, whe

  • Extension Panel Not Shown in InDesign Extensions Window

    I finally managed to view Maria Gutierrez' tutorial on building a plug-in. The demo <sarcasm>very cleverly</sarcasm> does not provide instructions or a downloadable sample file for either the manifest.xml or the <my-project>.mxml file. I actually had

  • Bluetooth control of MacBook Pro

    I do a lot of lectures, and my Sony Ericsson mobile runs Keynote shows on my MacBook via Bluetooth. This feature is important to me, as it means I don't have to carry yet another bit of kit around. Although I seed the new iPhone has bluetooth, there

  • Discoverer Plus - Creating URL's with Multiple Dimension values

    We are using the "Manage Links" feature in Discoverer Plus (10.1.2.2.0) to send dimension value names in a URL. As part of the "Manage Links" feature, the user is given the opportunity to choose which dimension values for the selected cells they want

  • Nokia 6124 - duplicate menu items

    Hi! I have a little problem with my 6124, HighRoller Casino game appears twice (I have two icons) and I can't delete the duplicate even if I uninstall the game. How do I remove the duplicate?  Thanks and sorry for my bad english.