RMI - String seralization

Hi !
I have a big problem.
I�m running a RMI-Server for converting documents in RTF, PDF ....
With my Apache/ Enhydra WebServer i�m calling a method from my RMI Server which looks like this :
public String convertXMLtoPDF ( String xmlDocument )
As everyone see�s, a convert a XML Document into PDF.
The method return me my PDF Document as a String.
So far so good, everything works fine, but if I set the response MIME Type to application/pdf and the response.setOutputStream ... to my PDF String, the Acrobat Reader Plugin opens and say that : "The document was false coded" or so. I�ve checked everything, the only possibility is, that the RMI Communication destroyed something in my PDF Document. Is this possible ?!?
Is there maybe a problem with 8 / 16bit encoding ?!?
Please HELP me !!!
Thnx
Ren�

If you are using any JDK prior to 1.3, there is a bug in the
String serialization for Strings longer than 64k.
We had the same problem and used Byte Arrays for the RMI
communication instead.

Similar Messages

  • Org.omg.CORBA.MARSHAL exception For JMX Notification

    I am running Weblogic 9.2 java version 1.5.0_04 and I am tring to recieve JMX Notifications from a Custom MBean running in Weblogic but I keep recieving the following exception:
    Jan 5, 2007 12:55:25 PM ClientNotifForwarder NotifFetcher-run
    SEVERE: Failed to fetch notification, stopping thread. Error is: java.rmi.MarshalException: CORBA MARSHAL 0 Maybe; nested exception is:
         org.omg.CORBA.MARSHAL: vmcid: 0x0 minor code: 0 completed: Maybe
    java.rmi.MarshalException: CORBA MARSHAL 0 Maybe; nested exception is:
         org.omg.CORBA.MARSHAL: vmcid: 0x0 minor code: 0 completed: Maybe
         at com.sun.corba.se.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:197)
         at javax.rmi.CORBA.Util.mapSystemException(Util.java:67)
         at org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub.fetchNotifications(Unknown Source)
         at javax.management.remote.rmi.RMIConnector$RMINotifClient.fetchNotifs(RMIConnector.java:1285)
         at com.sun.jmx.remote.internal.ClientNotifForwarder$NotifFetcher.fetchNotifs(ClientNotifForwarder.java:508)
         at com.sun.jmx.remote.internal.ClientNotifForwarder$NotifFetcher.run(ClientNotifForwarder.java:399)
         at com.sun.jmx.remote.internal.ClientNotifForwarder$LinearExecutor$1.run(ClientNotifForwarder.java:83)
    Caused by: org.omg.CORBA.MARSHAL: vmcid: 0x0 minor code: 0 completed: Maybe
    I received this first by trying JConsole that comes with JDK 1.5. This only occurs with JMX Notifications because I am able to execute the MBean operation of the MBean and I can see my custome MBean being executed in WebLogic but my custom mbean sends out a JMX Notifications and that causes
    the above exception.
    I wrote my own NotificationListener program to make sure that it is not a JConsole problem and I got the same problem. I tried using t3 and rmi protocol to see if one of them would work but neither worked. See the code below for the Notification Listener:
              // String protocol = "t3";
              //String jndiroot = "/jndi/";
              String protocol = "rmi";
              String jndiroot = new String("/jndi/iiop://" + hostName + ":" + port + "/");
              String myserver = "weblogic.management.mbeanservers.domainruntime";
              JMXServiceURL serviceURL = null;
              try {
                   serviceURL = new JMXServiceURL(protocol, hostName, port, jndiroot + myserver);
              } catch (MalformedURLException e1) {
                   logger.debug("malformedURLexception caught");
                   e1.printStackTrace();
              Hashtable h = new Hashtable();
              h.put(Context.SECURITY_PRINCIPAL, userName);
              h.put(Context.SECURITY_CREDENTIALS, password);
              // h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
              try {
                   connector = JMXConnectorFactory.connect(serviceURL, h);
                   connection = connector.getMBeanServerConnection();
              } catch (IOException e1) {
                   e1.printStackTrace();
              logger.debug("The connection is : " + connection.toString());
              ObjectName mbeanName = null;
              try {
                   mbeanName = new ObjectName("Mbean:Name=com.test.bean,Type=TestMBean,Location=AdminServer");
                   logger.debug("Created MBeanObjectName: " + mbeanName.toString());
              } catch (MalformedObjectNameException e) {
                   e.printStackTrace();
              } catch (NullPointerException e) {
                   e.printStackTrace();
              try {
                   logger.debug("The mbean is registered " + connection.isRegistered(mbeanName));
              } catch (IOException e1) {
                   e1.printStackTrace();
              try {
                   connection.addNotificationListener(mbeanName, this,null, null);
                   logger.debug("the connection is added a listener : " + connection.isInstanceOf(mbeanName, "com.test.bean.MBean"));
                   logger.debug("Listener registered ...");
                   //Keeping the remote client active.
                   System.out.println("waiting for notifications, got to log file for details....");
                   System.in.read();
              } catch (InstanceNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
              public void handleNotification(Notification n, Object arg1) {
                   logger.debug("******************************************");
                   logger.debug("* Notification count : " + counter++ + ", Notification received at "
                             + new Date().toString());
                   logger.debug("* type = " + n.getType());
                   logger.debug("* message = " + n.getMessage());
                   logger.debug("* source = " + n.getSource());
                   logger.debug("* seqNum = "
                             + Long.toString(n.getSequenceNumber()));
                   logger.debug("* timeStamp = " + new Date(n.getTimeStamp()));
                   logger.debug("* userData = " + n.getUserData());
                   logger.debug("*******************************************");
    I commented out the t3 protocol but it doesn't work for both protocol types. I implemented a Notification Listener within WebLogic and that
    worked right away using the following code below:
         InitialContext ctx = new InitialContext();
    rmbs = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");
    As the document "Developing Custom Management Utilities with JMX" on page 4-7 "Make Local Connections to the Runtime MBean Server" described.
    Has anyone seem the above exception "Failed to fetch notification, stopping thread. Error is: java.rmi.MarshalException: CORBA MARSHAL 0" when a client is trying to receive JMX Notification? All help would be greatly appreciated.
    Thanks,
    Ajay

    Hi ajay,
    How did u manage to access the mbeanserver in BEA ? Can u pls brief on that. Even I am trying the same. But, the MBEANSERVEROBJECT i create, eventhough has NO NULL value, is not able to acces the mbean. Any method access through this object creates an EXCEPTION. Please help me too. I will try solving ur problem too.:-)
    Also, do i need to put my MBEAN CLASS in the weblogic server ? Should i create an APP SERVER in BEA ?
    I appreciate ur early response, dude..

  • JavaCode as String to RMI Task.

    I am creating a load balancing application that consists of many clients and one server. The client will read in a JOB file that consists of "java functions" I then want to remotely execute this function using RMI. The problem however is how do I take the function code and use it with RMI without a wrapper class and compiling (if possible)
    Weldon

    the suggestion is the standard client invokes methods to execute at the server.
    my understanding of your requirement is to load balance, with one server, where is the load balancing with this approach?
    you could export the clients and have the servers pass an instantiated interface with arguments, and have client call the method to execute it at the client side. the server must know how to dispense work.
    Hi.
    I think the simplest solution is :
    You have Remote interface of your server with amethod
    known to all client, for example "Object
    performJob(String jobName, Object[]jobParameteres)".
    Where jobName is name of java function, and
    jobParameteres is necessary data to pass in thisjava
    function.
    In implementation of performJob(..) method (onserver
    side) you may call right method using reflectionapi
    (you know method name and parameters)
    If it is acceptable for you, I may respond to your
    additional questions. :)Is there a way to take actual java code (not compiled)
    and then run it with RMI?

  • RequestTimeoutException error while invoking a BPEL process using RMI

    Hi,
    I am getting RequestTimeoutException error while invoking a BPEL process using this code:
    Locator locator = LocatorFactory.createLocator(jndiProps);
    String compositeDN = "default/"+processName+"!1.0";
    Composite composite = locator.lookupComposite(compositeDN);
    String serviceName = "client";
    Service deliveryService = composite.getService(serviceName);
    NormalizedMessage nm = new NormalizedMessageImpl();
    nm.getPayload().put("payload", requestXml);
    NormalizedMessage res = deliveryService.request("process", nm);
    responseMap = res.getPayload();
    The error stack trace is
    weblogic.rmi.extensions.RequestTimeoutException: RJVM response from 'weblogic.rjvm.RJVMImpl@604f2d14 - id: '-361032376059206
    2776S:10.67.232.164:[8001,-1,-1,-1,-1,-1,-1]:emaar_domain:soa_server1' connect time: 'Mon Jan 18 11:34:41 GST 2010'' for 'executeServiceMethod
    (Loracle.soa.management.CompositeDN;Ljava.lang.String;Ljava.lang.String;[Ljava.lang.Object;) 'timed out after: 60000ms.
    oracle.fabric.common.FabricInvocationException: weblogic.rmi.extensions.RequestTimeoutException: RJVM response from 'weblogic.rjvm.RJVMImpl@60
    4f2d14 - id: '-3610323760592062776S:10.67.232.164:[8001,-1,-1,-1,-1,-1,-1]:emaar_domain:soa_server1' connect time: 'Mon Jan 18 11:34:41 GST 20
    10'' for 'executeServiceMethod(Loracle.soa.management.CompositeDN;Ljava.lang.String;Ljava.lang.String;[Ljava.lang.Object;) 'timed out after: 6
    0000ms.
            at oracle.soa.management.internal.facade.ServiceImpl.request(ServiceImpl.java:135)
            at com.gss.common.bo.BpelUtil.invokeBPELProcess(BpelUtil.java:81)
    To add to it the BPEL process is executing successfuly and RMI call timeout is happening.
    Can I know how to increase the related timeout value?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Have got the same problem. Scenario at my end is little different though.
    I am trying to invoke a BPEL process from an ESB Service.
    I am trying to look into it..
    However, would be grateful, if someone can give some insight into this since many are running into this issue without being able to fix.
    Ashish.

  • Problems with string literals in ejb-ql's

    I have a couple EJB-QL's that look like:
    <![CDATA[SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r']]>
    which used to work in Orion without a problem but in OC4J I get the following errors:
    com/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r'
    EJB QL method : public abstract com.mongoosetech.reputation.ejb_entity.AssignedStatus com.mongoosetech.reputation.ejb_enti
    ty.AssignedStatusHome.findByRecipientIDAndStatusIDNotRevoked(java.lang.String,java.lang.String) throws javax.ejb.FinderExcept
    ion,java.rmi.RemoteException
    at com.sun.ejb.ejbql.parser.EjbQLParser.parse(EjbQLParser.java:226)
    at com.sun.ejb.ejbql.EjbQLDriver.parse(EjbQLDriver.java:86)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQLForEjbQLQueries(SQLGenerator.java:628)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:270)
    at com.evermind.server.ejb.deployment.EJBPackage.init(EJBPackage.java:1947)
    at com.evermind.server.ServerComponent.init(ServerComponent.java:199)
    at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDeployment.java:645)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:513)
    at com.evermind.server.Application.postInit(Application.java:429)
    at com.evermind.server.Application.setConfig(Application.java:136)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1479)
    at com.evermind.server.ApplicationServer.initializeApplications(ApplicationServer.java:1436)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1099)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:93)
    at java.lang.Thread.run(Thread.java:479)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:49)
    Error in application ACME Portal: Error loading package at file:/C:/dev/staging/portalstudio/ee/image/deploy/portal/portal-ej
    b.jar, Failure to initialize EJBQL descriptors: com/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r'
    EJB QL method : public abstract com.mongoosetech.reputation.ejb_entity.AssignedStatus com.mongoosetech.reputation.ejb_enti
    ty.AssignedStatusHome.findByRecipientIDAndStatusIDNotRevoked(java.lang.String,java.lang.String) throws javax.ejb.FinderExcept
    ion,java.rmi.RemoteException
    Am I doing something wrong here? These QL's work in several other App Servers so I am lost as to why this doesn't work.

    Kevin,
    We are aware of this bug in the developer's preview and will be fixed when next version of OC4J 9.0.3 will be released.
    regards
    Debu Panda
    Oracle

  • RMI : error on JRE 1.6 but not on JRE 1.5 ???

    Hello,
    I've got a problem with my application since i use JRE 1.6
    My application run perfectly with JRE 1.5 !!!
    My code is first :
    LocateRegistry.createRegistry(port);
    NamingManager.setInitialContextFactoryBuilder(new InitialServerContextFactory());
    NamingManager.getInitialContext(environment);(with environment is an hastable containing HOST et PORT)
    An next, i have a Java Class witch impl�ments Context :
    public class InitialServerContext implements Context
        public void bind(String name, Object obj) throws NamingException
              getRMIContext().bind("rmi://" + mServer + ':' + mPort + '/' + name, obj);
        static Context getRMIContext() throws NamingException
              return NamingManager.getURLContext("rmi", null);
    The error on JRE 1.6 is on the line :
    getRMIContext().bind("rmi://" + mServer + ':' + mPort + '/' + name, obj);
    _Exception is
    :_java.lang.NullPointerException
    at com.sun.jndi.rmi.registry.RegistryContext.<init>(Unknown Source)
    at com.sun.jndi.url.rmi.rmiURLContext.getRootURLContext(Unknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.bind(Unknown Source)
    at com.xxx.aes.naming.InitialServerContext.bind(InitialServerContext.java:231)
    at com.xxx.aes.naming.InitialServerContextFactory.getInitialContext(InitialServerContextFactory.java:104)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at com.xxx.aes.server.NamingServer.start(NamingServer.java:65)
    What is the difference between JRE 1.5 and 1.6 ?
    Why my application in 1.6 is not correct ?
    If necessary, i can give you my Java Class InitialServerContextFactory.java
    Thanks a lot for your responses.

    Hello,
    I tired this approach you mentioned, and interestingly if i just make ejb calls without any event handling, meaning if i call them separately they all just work fine and i see the results coming back from server. But when i relate them to any click events the whole IE freezes.
    One more thing i noted is that, seems like the way JRE 1.6 render my applet is somewhat different than JRE 1.5.* familiy,because initially when my aplet is loaded, i see everything which should be displayed from the first screen, but any further operations i cannot perform, even opening a file chooser from tool bar. I admit my applet is real heavy and it contains a lot of data in it on the first screen, may be its the heap size causing the problem in 1.6 but fine with jre 1.5.
    Day by day am coming to conlusion that jre 1.6 is my concern now ..:(
    Thanks,

  • Help me to run this simple RMI example

    When i m running this example in standalone pc it works but while running on to different pc it gives error though I m giving the IP address from client of server.. If anyone can help me out plz help.
    Code:
    ReceiveMessageInterface
    import java.rmi.*;
    public interface ReceiveMessageInterface extends Remote
    void receiveMessage(String x) throws RemoteException;
    Server code:
    import java.rmi.*;
    import java.rmi.registry.*;
    import java.rmi.server.*;
    import java.net.*;
    public class RmiServer extends java.rmi.server.UnicastRemoteObject
    implements ReceiveMessageInterface
    int thisPort;
    String thisAddress;
    Registry registry; // rmi registry for lookup the remote objects.
    // This method is called from the remote client by the RMI.
    // This is the implementation of the �ReceiveMessageInterface�.
    public void receiveMessage(String x) throws RemoteException
    System.out.println(x);
    public RmiServer() throws RemoteException
    try{
    // get the address of this host.
    thisAddress= (InetAddress.getLocalHost()).toString();
    catch(Exception e){
    throw new RemoteException("can't get inet address.");
    thisPort=3232; // this port(registry�s port)
    System.out.println("this address="+thisAddress+",port="+thisPort);
    try{
    // create the registry and bind the name and object.
    registry = LocateRegistry.createRegistry( thisPort );
    registry.rebind("rmiServer", this);
    catch(RemoteException e){
    throw e;
    static public void main(String args[])
    try{
    RmiServer s=new RmiServer();
    catch (Exception e) {
    e.printStackTrace();
    System.exit(1);
    Client code:
    import java.rmi.*;
    import java.rmi.registry.*;
    import java.net.*;
    public class RmiClient
    static public void main(String args[])
    ReceiveMessageInterface rmiServer;
    Registry registry;
    String serverAddress=args[0];
    String serverPort=args[1];
    String text=args[2];
    System.out.println("sending "+text+" to "+serverAddress+":"+serverPort);
    try{
    // get the �registry�
    registry=LocateRegistry.getRegistry(
    serverAddress,
    (new Integer(serverPort)).intValue()
    // look up the remote object
    rmiServer=
    (ReceiveMessageInterface)(registry.lookup("rmiServer"));
    // call the remote method
    rmiServer.receiveMessage(text);
    catch(RemoteException e){
    e.printStackTrace();
    catch(NotBoundException e){
    e.printStackTrace();
    }

    When we compile with rmic skeleton and stub get created then we hav to place stub at each client ???Your remote client applcation need only _Stub.class fiels.
    Is there way by which we can know how many clients are connected to the
    server and there IP address, can anyone give the code... I guess that you should use a RMI login/logout method to register/unregister your client connection information into a databse or a simple static Hashtable(Vector) object.

  • Conflict between socket and RMI

    Hi
    I wrote a program in client-server using socket and it was fine. I also wrote a client-server program using RMI. Fine as well. But after I connected the client-server using socket (open socket, send-receive messages, close socket), then use RMI. I got java.rmi.NotBoundException.
    Would anyone have a look and provide your feedback please? Thanks.
    big J
    *****************this is Server.java ***************************
    package single;
    import java.io.*;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.net.*;
    import java.rmi.*;
    public class Server
    extends Thread {
    public static final int SOCKETPORT = 5555;
    private String serverName;
    public Server() throws IOException {
    System.out.println("*** socket opened ***");
    serverName = new String("localhost");
    ServerSocket serverSocket = new ServerSocket(SOCKETPORT);
    Socket socket = serverSocket.accept();
    InputStream is = socket.getInputStream();
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
    System.out.println(bufferedReader.readLine());
    OutputStream os = socket.getOutputStream();
    PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(os), true);
    printWriter.println("from server");
    os.close();
    is.close();
    socket.close();
    System.out.println("*** socket closed ***");
    public void runServer() {
    System.out.println("*** start of run():RMI ***");
    System.setSecurityManager(new SecurityManager());
    try {
    RMIInterfaceImpl rMIInterfaceImpl = new RMIInterfaceImpl();
    Naming.bind("//" + serverName + ":9999/RMIInterface", rMIInterfaceImpl);
    catch (RemoteException ex) {
    catch (MalformedURLException ex) {
    catch (AlreadyBoundException ex) {
    System.out.println("*** end of run():RMI ***");
    public static void main(String args[]) throws Exception {
    Server server = new Server();
    server.runServer();
    ******************this is Client.java **************************
    package single;
    import java.io.*;
    import java.net.*;
    import java.rmi.Naming;
    public class Client {
    private String serverName;
    private final static int SOCKETPORT = 5555;
    public Client() throws IOException {
    serverName = new String("localhost");
    Socket socket = new Socket(serverName, SOCKETPORT);
    OutputStream os = socket.getOutputStream();
    PrintWriter printWriter=new PrintWriter(os, true);
    printWriter.println("from client");
    InputStream is = socket.getInputStream();
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
    System.out.println(bufferedReader.readLine());
    is.close();
    os.close();
    socket.close();
    public void runClient() throws Exception {
    System.out.println("*** start of runClient():RMI ***");
    System.setSecurityManager(new SecurityManager());
    RMIInterface rMIInterfaceImpl = (RMIInterface) Naming.lookup(
    "//" + serverName + ":9999/RMIInterface");
    String str = rMIInterfaceImpl.print();
    System.out.println(str);
    rMIInterfaceImpl.serverSide();
    System.out.println("*** end of runClient():RMI ***");
    public static void main(String args[]) throws Exception {
    Client client = new Client();
    client.runClient();
    ***************** this is RMIInterface.java ***********************
    package single;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    interface RMIInterface
    extends Remote {
    String print() throws RemoteException;
    void serverSide() throws RemoteException;
    ********************* this is RMIInterfaceImpl.java ***************
    package single;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class RMIInterfaceImpl
    extends UnicastRemoteObject
    implements RMIInterface {
    public RMIInterfaceImpl() throws RemoteException {}
    public String print() {
    return new String("hello world");
    public void serverSide(){
    System.out.println("this should appear in serverside");

    I think you have a timing problem between your client and server. As soon as your client and server programs have finished their socket communication, they will both do their "runServer"/"runClient" methods. If the client attempts to lookup the server before the server has registered itself via Naming.bind(), I would expect that's why you're getting a NotBoundException in the client.
    You probably wouldn't use the design of your test client/server for something significant, but a quick and dirty way to make this work might be to have the client call Thread.sleep() for a few seconds before trying to do the lookup.

  • Exception occured: java.rmi.NotBoundException: ebillRMIImplInstance

    Hi pls help me ...
    this is the exception i got while running my client jar file...
    i;m not able to correct it...i'm using netbeans 6..
    my client method is as given below...
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {      
    System.setSecurityManager(new RMISecurityManager());
    int itemid;
    String serverName ="";
    String itid="";
    serverName = "localhost";
                        ResultSet res=null;
    itid=jTextField1.getText();
    //itemid=Integer.parseInt(itid);
    System.out.println(itid);
    try
    //bind server object to object in client//rmi://host:<port>/correlator
    ebillRMIInterface ebillserver = (ebillRMIInterface) Naming.lookup("rmi://"+serverName+"/ebillRMIImplInstance");
    System.out.println("asd");
    //invoke method on server object
    /*Date d = myServerObject.getDate();
    System.out.println("Date on server is " + d);*/
                                  String str="select * from Stock where itemid='"+itid+"'";
                                  res=ebillserver.select(str);
    while(res.next())
    jTextField2.setText(res.getString(2));
    Float price=res.getFloat(4);
    String pr=String.valueOf(price);
    jTextField3.setText(pr);
    String str1="update Stock set itemname='Tea250' where itemid='1'";
                   ebillserver.insert(str1);System.out.println("updated ");
    catch(Exception e)
    System.out.println("Exception occured: " + e);
    //System.exit(0);
    System.out.println("RMI connection successful");
    }

    The remote object hasn't bound itself to that registry under that name.

  • Is there any problems in IE if using RMI.?

    Hello buddies,
    this is my 3rd attempt to get answer. before it i tried 2 times but didn't get answered.
    actually i m making a chat application. in that there is a canvas on which we can draw something and send it to all users. i make an applet and from within the applet i m calling a frame. all this awt components like canvas and buttons etc. displays in the frame. applet is just a platform do call the frame. i m using RMI to do the chat. i tried to run it first in appletviewer and it works fine. but when i tried to run in IE from <applet> tag no frame is displays. i am trying to solve it from last 20 days but still unsolved. here is the code if anybody wishes to try it.
    // clinet frame...
    import java.rmi.*;
    import java.rmi.server.*;
    import canvas.Drawer;
    import java.awt.*;
    import java.applet.*;
    import java.applet.Applet;
    import java.awt.event.*;
    import java.util.*;
    import ru.zhuk.graphics.*;
    /*<applet code="ChatClient" width=600 height=300>
    </applet>
    public class ChatClient extends Frame implements IChatClient,ActionListener,MouseListener,MouseMotionListener
         // GLOBAL VARIABLES USED IN THE PROGRAMME...
         boolean flag=false;
         int n;
         String str="";
         String Coord=null;
         IChatService service=null;
         FrameApplet fa=null;
         TextField servername,serverport,username;
         Button connect,disconnect;
         TextField message;
         Button send,sendText;
         TextArea fromserver;
         int i=0,j=0;
         int x[] = new int[1000];
         int y[] = new int[1000];
         Drawer canvas;
         boolean connected=false;
         String title,user="";
         // Class Members //
         public ChatClient()
         public ChatClient(String str)
              super(str);
              setBounds(50,20,600,450);
              setLayout(new FlowLayout(FlowLayout.CENTER,45,10));
              title=str;
              setStatus();
              // Create controls //
              add(new Label("Chat Server Name : "));
              servername=new TextField(20);
              add(servername);
              servername.setText("localhost");
              add(new Label("Chat Server Port : "));
              serverport=new TextField(20);
              add(serverport);
              serverport.setText("900");
              add(new Label("Your User Name : "));
              username=new TextField(20);
              add(username);
              username.setText("Umesh");
              connect=new Button("Connect");
              connect.addActionListener(this);
              add(connect);
              disconnect=new Button("Disconnect");
              disconnect.addActionListener(this);
              add(disconnect);
              message=new TextField(30);
              add(message);
              sendText=new Button("Send Text");
              sendText.addActionListener(this);
              add(sendText);
              fromserver=new TextArea(10,50);
              add(fromserver);
              fromserver.setEditable(false);
    canvas = new Drawer();
              canvas.setSize(250,250);
              canvas.setBackground(Color.cyan);
              add(canvas);
              canvas.addMouseListener(this);
              canvas.addMouseMotionListener(this);
              send=new Button("Send");
              send.addActionListener(this);
              add(send);
              try
                   UnicastRemoteObject.exportObject(this);
              catch(Exception e)
              setVisible(true);
              for(j=0;j<1000;j++)
                   x[j]=0;
                   y[j]=0;
              Coord = new String();
              Coord = "";
    //          fa=new FrameApplet();
         public void mousePressed(MouseEvent me){}
         public void mouseReleased(MouseEvent me)
              Coord = Coord + "r";
         public void mouseClicked(MouseEvent me){}
         public void mouseEntered(MouseEvent me){}
         public void mouseExited(MouseEvent me){}
         public void mouseDragged(MouseEvent me)
              if (Coord == "")
                   Coord = me.getX() + "," + me.getY();
              else
                   Coord = Coord + " " + me.getX() + "," + me.getY();
         public void mouseMoved(MouseEvent me){}
         // RMI connection //
         private void connect()
              try
                   service = (IChatService)Naming.lookup("rmi://pcname/ChatService");
                   service.addClient(this);
                   connected=true;
                   setStatus();
                   user=username.getText();
                   Coord = "";
              catch(Exception e)
                   fromserver.append("Error Connecting ...\n" + e);
                   System.out.println(e);
                   connected=false;
                   setStatus();
                   service=null;
         private void disconnect()
              try
                   if(service==null)
                        return;
                   service.removeClient(this);
                   service=null;
              catch(Exception e)
                   fromserver.append("Error Connecting ...\n");
              finally
                   connected=false;
                   setStatus();
         private void setStatus()
              if(connected)
                   setTitle(title+" : Connected");
              else
                   setTitle(title+" : Not Connected");
         // IChatClient methods //
         public String getName()
              return user;
         public void sendMessage(String msg)
              fromserver.append(msg+"\n");
         public void SendCanvasObject(String str)
              this.str = str;
              fromserver.append(str + "\n");
              Graphics g = canvas.getGraphics();
              paint(g);
         // Actionlistener //
         public void actionPerformed(ActionEvent e)
              if(e.getSource()==connect)
                   connect();
                   if(connected)
                        servername.setEnabled(false);
                        serverport.setEnabled(false);
                        username.setEnabled(false);
                        connect.setEnabled(false);
                        Coord = "";
              else
              if(e.getSource()==disconnect)
                   disconnect();
                   servername.setEnabled(true);
                   serverport.setEnabled(true);
                   username.setEnabled(true);
                   connect.setEnabled(true);
              else
              if(e.getSource()==send)
                   flag = true;
                   if(service==null)
                        return;
                   try
                        fromserver.append("Sending an image...\n");
                        service.SendCanvasObject(this,Coord);
                        i=0;
                        for(j=0;j<1000;j++)
                             x[j]=0;
                             y[j]=0;
                        Coord = "";
                        fromserver.append("\n" + "Image Sent...");
                   catch(RemoteException re)
                        fromserver.append("Error Sending Message ...\n" + re);
                   catch(Exception ee)
                        fromserver.append("Error Sending Message ...\n" + ee);
              else
              if(e.getSource()==sendText)
                   if(service==null)
                        return;
                   try
                        service.sendMessage(this,message.getText());
                        message.setText("");
                   catch(RemoteException exp)
                        fromserver.append("Remote Error Sending Message ...\n" + exp);
                   catch(Exception ee)
                        fromserver.append("Error Sending Message ...\n" + ee);
         public void paint(Graphics g)
              if(flag==true)
                   i=0;
                   StringTokenizer stoken = new StringTokenizer(str,"r");
                   String strin = "";
                   while(stoken.hasMoreTokens())
                        strin = stoken.nextToken();
                        fromserver.append("\n" + strin + "\n");
                        StringTokenizer stoken1 = new StringTokenizer(strin," ");
                        String strin1 = "";
                        j=0;
                        while(stoken1.hasMoreTokens())
                             strin1 = stoken1.nextToken();
                             fromserver.append("\n" + strin1 + "\n");
                             x[j]=Integer.parseInt(strin1.substring(0,strin1.indexOf(",")));
                             y[j]=Integer.parseInt(strin1.substring(strin1.indexOf(",")+1,strin1.length()));
                             j++;
                        for(int k=0;k<j-1;k++)
                             g.drawLine(x[k],y[k],x[k+1],y[k+1]);     
                   i++;
    import java.rmi.*;
    import java.rmi.server.*;
    import canvas.Drawer;
    import java.util.*;
    import ru.zhuk.graphics.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class FrameApplet extends Applet implements ActionListener
         ChatClient f;
         public void init()
              Button b = new Button("Start Chat");
              b.addActionListener(this);
              add(b);
         public void actionPerformed(ActionEvent ae)
              f=new ChatClient("Chat");
              f.show();
              f.setSize(400,400);
    here is html file which i calls from IE
    <html>
    <title>Micky Chat</title>
    <body>
    <br>
    <br>
    <center>
    <applet code="FrameApplet.class" width=200 height=200>
    </applet>
    </center>
    </body>
    </html>
    and at last a shocking thing is it is runs in Netscape displaying frames but not calling paint method.
    pls. help me
    thanks a lot
    umesh

    Hi Umesh!
    Sorry that I cannot be too concrete about that since it has to be centuries ago when I fell over this problem.
    As far as I can remember, the JDK provided by MS has no RMI built-in. These was probably one of the main reasons why Sun sued Microsoft concering its handling of Java.
    Afterwards MS released a path for its Java Runtime that included RMI support, but AFAIK they never included it in the standard package. So much luck when searching for the ZIP! (-;
    A little bit of googling might help, e.g.:
    http://groups.google.com/groups?hl=de&lr=&ie=UTF-8&oe=UTF-8&threadm=37f8ddf6.4532124%40news.online.no&rnum=17&prev=/groups%3Fq%3Dmicrosoft%2Bjvm%2Brmi%2Bsupport%26start%3D10%26hl%3Dde%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D37f8ddf6.4532124%2540news.online.no%26rnum%3D17
    cheers,
    kdi

  • How to start rmi on a computer with 2 network cards ?

    I would like to write a programm to get system informations from any linux computer connected to a network. A RMI server installed on each network computer measures the informations and send them to a RMI Client based on a central computer, where the information is stored on database.
    Each computer is identified by its IP address. This is why the IP adress is sent with the string of system informations. For instance, the information sent for a CPU measure is :
    <Computer>
    <AddIP>192.168.1.1</AddIP>
    <CPU><Frequency>500</Frequency><Brand>Intel</Brand></CPU>
    </Computer>
    In the case when a computer has two IP adresses : 192.168.1.1 and 192.168.2.64, if the computer is reached by 192.168.1.1 it should return the following string :
    <Computer>
    <AddIP>192.168.1.1</AddIP>
    <CPU><Frequency>500</Frequency><Brand>Intel</Brand></CPU>
    </Computer>
    and if reached by 192.168.2.64 :
    <Computer>
    <AddIP>192.168.2.64</AddIP>
    <CPU><Frequency>500</Frequency><Brand>Intel</Brand></CPU>
    </Computer>
    The string does not contains all IP adresses but these from which the computer was asked for a measurement. Here is the code for the RMI server :
    public class ServeurAgent {
    public ServeurAgent() {
    try {
    // we launched a RMI service for each IP address :
    LocateRegistry.createRegistry(portRMIAgent);
    // the 192.168.1.1 parameter for AgentImpl is only
         // used to generate the XML String
    Agent agent1 = new AgentImpl(192.168.1.1);
    Naming.rebind("rmi://192.168.1.1:1099/serviceRMI",agent);
    Agent agent2 = new AgentImpl(192.168.2.64);
    Naming.rebind("rmi://192.168.2.64:1099/serviceRMI",agent);
    catch (Exception e) {
    System.out.println("echec du lancement des Agents : "+e);
    public static void main(String args[]) {
    new ServeurAgent();
    We hoped that when the RMI client asked for a measurement on one IP address we could get in the XML String the same IP address, but the problem is that whatever the IP adress is asked, the XML String always contains the same IP address. For example if we ask for a measurement on the 192.168.2.64 adress we have got :
    <Computer>
    <AddIP>192.168.1.1</AddIP>
    <CPU><Frequency>500</Frequency><Brand>Intel</Brand></CPU>
    </Computer>
    instead of :
    <Computer>
    <AddIP>192.168.2.64</AddIP>
    <CPU><Frequency>500</Frequency><Brand>Intel</Brand></CPU>
    </Computer>
    Do you have any idea of what could be the problem ? Is the code correctly written ?
    Here is the code for the RMI client :
    public void mesurer(ipAdress) {
    try {
    valeur_mesures = "";
              Agent agent = (Agent) Naming.lookup("rmi://"+ ipAdress +":1099/serviceRMI");
              // valeur_mesures is the XML string
              valeur_mesures = agent.getCPUs();
    catch (MalformedURLException murle) {
    System.out.println();
    System.out.println("MalformedURLException");
    System.out.println(murle);
    catch (RemoteException re) {
    System.out.println();
    System.out.println("RemoteException");
    System.out.println(re);
    } catch (NotBoundException nbe) {
    System.out.println();
    System.out.println("NotBoundException");
    System.out.println(nbe);
    Thank you for your help.

    You may have solved it by now but your code is using the wrong variables when binding objects:
    Agent agent1 = new AgentImpl(192.168.1.1);
    Naming.rebind("rmi://192.168.1.1:1099/serviceRMI",agent);
    Agent agent2 = new AgentImpl(192.168.2.64);
    Naming.rebind("rmi://192.168.2.64:1099/serviceRMI",agent);
    Notice you are creating agents "agent1" and "agent2" but you are storing the stub of an instance called "agent".
    Otherwise, it should work so long as the names you are binding the variables to are unique and not rebound anywhere else.

  • Can anybody help me to understand this RMI registry service code?

    RMI is so difficult to me. please let me know following code what it means.
    If this class is instantiated with 50000 port number,
    Does RMI Registry Service get started with 50000 port number in place of rmiregistry commands?
    And I don't have to execute rmiregistry command?
    thanks in advance.
    import java.rmi.AccessException;
    import java.rmi.AlreadyBoundException;
    import java.rmi.NotBoundException;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.rmi.registry.Registry;
    import java.rmi.server.ObjID;
    import java.rmi.server.RemoteServer;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import sun.rmi.server.UnicastServerRef;
    import sun.rmi.transport.LiveRef;
    * Registry implementation.
    * @version 1.0
    public class RegistryImpl extends RemoteServer implements Registry {
         private static final long serialVersionUID = -7162736590129110751;
         private Hashtable bindings;
        private static ObjID id = new ObjID(0);
         * @param i port number
         * @throws RemoteException
        public RegistryImpl(int i) throws RemoteException {
            bindings = new Hashtable(101);
            LiveRef liveref = new LiveRef(id, i);
            setup(new UnicastServerRef(liveref));
        private void setup(UnicastServerRef unicastserverref) throws RemoteException {
            super.ref = unicastserverref;
            unicastserverref.exportObject(this, null, true);
         * Lookup a remote object.
         * @param name Name of the remote object.
         * @return Remote object of the specified name.
        public Remote lookup(String name) throws RemoteException, NotBoundException {
    //        Logger.debug("NamingService", "lookup: " + name);
            Remote obj;
            synchronized(bindings) {
                obj = (Remote)bindings.get(name);
                if(obj == null)
                    throw new NotBoundException(name);
            return obj;
         * Binds the specified name to a remote object.
         * @param name A URL-formatted name for the remote object.
         * @param obj A reference for the remote object (usually a stub).
        public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException {
    //        Logger.debug("NamingService", "bind: " + name);
            checkAccess("Registry.bind");
            synchronized(bindings) {
                if(bindings.containsKey(name))
                    throw new AlreadyBoundException(name);
                bindings.put(name, obj);
         * Destroys the binding for the specified name that is associated with a remote object.
         * @param name A URL-formatted name for the remote object.
        public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
    //        Logger.debug("NamingService", "unbind: " + name);
            checkAccess("Registry.unbind");
            synchronized(bindings) {
                if(!bindings.containsKey(name))
                    throw new NotBoundException(name);
                bindings.remove(name);
         * Rebinds the specified name to a new remote object. Any existing binding
         * for the name is replaced.
         * @param name A URL-formatted name for the remote object.
         * @param obj A reference for the remote object (usually a stub).
        public void rebind(String name, Remote obj) throws RemoteException, AccessException {
    //        Logger.debug("NamingService", "rebind: " + name);
            checkAccess("Registry.rebind");
            bindings.put(name, obj);
         * Returns an array of the names bound in the registry.
         * @return An array of the names bound in the registry.
        public String[] list() throws RemoteException {
            String[] names;
            synchronized(bindings) {
                int i = bindings.size();
                names = new String;
    Enumeration e = bindings.keys();
    while(--i >= 0)
    names[i] = (String)e.nextElement();
    return names;
    * TO-DO
    public static void checkAccess(String s) throws AccessException {
    // check if s is in the list of agents.
    if(true)
    else
    throw new AccessException("");
    public static ObjID getID() {
    return id;

    You don't have any need to understand this code. The complication is due to the registry needing a fixed objectID.
    You just need to know the methods of java.rmi.registry.LocateRegistry class. This allows you to start an RMI Registry inside your JVM and give it any TCP port number you like.

  • A rmi problem about exporting a remote object

    here is the code:
    public interface Hello extends Remote {
    String sayHello() throws RemoteException;
    public class HelloImpl extends UnicastRemoteObject
    implements Hello {
    public HelloImpl() throws RemoteException {
    super();
    public String sayHello() {
    return "Hello World!";
    public static void main(String args[]) {
    if (System.getSecurityManager() == null) {
         System.setSecurityManager(new RMISecurityManager());
    try{
         HelloImpl obj = new HelloImpl();
         Naming.rebind("//192.168.10.2:2001/HelloServer", obj);
         System.out.println("HelloServer bound in registry");
    }catch (Exception e) {
         System.out.println("HelloImpl err: " + e.getMessage());
    e.printStackTrace();
    public class HelloClient{
    public static void main(String[] args){
    Hello obj = null;
    String message="nobody say hello to me";
    if (System.getSecurityManager() == null) {
         System.setSecurityManager(new RMISecurityManager());
    try {
         obj = (Hello)Naming.lookup("//192.168.10.2:2001/HelloServer");
         message = obj.sayHello();
    }catch (Exception e) {
         System.out.println("exception: "+e.getMessage());
         e.printStackTrace();
    System.out.println(message);
    where 192.168.10.2 is the ip address of my computer.
    i'm using an mini-http server provided by sun,that is,ClassFileServer
    here is my command lines:
    java examples.classServer.ClassFileServer 2003 d:\java\rmi
    start rmiregistry 2001
    java -Djava.rmi.server.codebase=http://192.168.10.2:2001/
    -Djava.security.policy=server.policy HelloImpl
    then encountered the exception.
    can someone tell me how can i export the HelloImpl and
    make it can be invoked by client.
    thanks a lot!

    thank you for your reply,i tried it again like below:
    java examples.classServer.ClassFileServer 2001 d:\java\rmi
    start rmiregistry
    java -Djava.rmi.server.codebase=http://192.168.10.2:2001/
    -Djava.security.policy=server.policy HelloImpl
    java HelloClient
    but could not work,the exception raised at the client point is like that:
    java.rmi.Naming.lookup(unknown source)....
    i want to know how could the client know how to contact with
    rmiregistry,where the client trying to lookup(//192.168.10.2:2001/HelloServer)
    while rmiregistry running on the port 1099.
    thank you!

  • EJB 3.0 accessing legacy RMI object

    Hello All
    I need to access a legacy RMI object from a stateless session bean. This is not technically a problem as it can be done from the EJB's constructor like so
    public MyEJB ()
    throws NotBoundException, MalformedURLException, RemoteException
      this.rmiObject = (TheRMIInterface) Naming.lookup ("//host/ThatRMIObject");
    }The above solution doesn't feel right. Mainly, host changes depending on whether the EJB is deployed on our testing or production environment. At the least, I'd like to be able to query the container to get the relevant value of the string, but I've a feeling that perhaps the container should be injecting the RMI object into the EJB.
    If anyone can shed any light on either of the possible approaches suggested above (or any other approach), I'd be most grateful.
    Thanks in advance
    J

    Okay, the first approach goes like this
    @Stateless
    public class MyEJBean
    implements MyEJRemote
      @Resource (name = "my-rmi-object-url")
      private String rmiObjectURL;
      private RMIObject rmiObject;
      public MyEJBean ()
      throws NotBoundException, MalformedURLException, RemoteException
        this.rmiObject = (RMIInterface) Naming.lookup (this.rmiObjectURL);
    }and the accompanying deployment descriptor (ejb-jar.xml -- without the surrounding ejb-jar tags) is
      <enterprise-beans>
        <session>
          <ejb-name>MyEJBean</ejb-name>
          <env-entry>
            <env-entry-name>my-rmi-object-url</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>//host/RMIObject</env-entry-value>
          </env-entry>
        </session>
      </enterprise-beans>which'd still have to altered for the differing deployment environments, but feels slightly better. It'll do for now. Maybe I'll try injecting the object later.

  • Authorization Error  While  Invoking BPEL Process Via RMI

    Hi All,
    I have been trying to invoke BPEL Process via RMI client.
    I use the following piece of code for BPEL Process Invocation...
    public class RMIClient {
    public RMIClient() {
    public static void main(String[] args){
    Hashtable jndi = new Hashtable ();
    jndi.put (Context.PROVIDER_URL, "opmn:ormi://host:6010:oc4j_soa/orabpel");
    jndi.put (Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    jndi.put (Context.SECURITY_PRINCIPAL,"oc4jadmin"); // username of Bpel Manager
    jndi.put (Context.SECURITY_CREDENTIALS,"welcome1"); //password of BPEL Manager
    Locator locator=null;
    try {
    locator = new Locator("default",jndi);
    } catch (ServerException e) {
    e.printStackTrace();
    IDeliveryService deliveryService =
    (IDeliveryService)locator.lookupService
    (IDeliveryService.SERVICE_NAME );
    // construct the normalized message and send to oracle bpel process
    NormalizedMessage nm = new NormalizedMessage( );
    String xml = "<ns1:MyFirstBPELProjectProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/MyFirstBPELProject\">\n" +
    " <ns1:input></ns1:input>\n" +
    " </ns1:MyFirstBPELProjectProcessRequest>";
    nm.addPart("payload", xml );
    NormalizedMessage res=null;
    try {
    res = deliveryService.request("MyFirstBPELProject", "process", nm);
    } catch (ServerException e) {
    e.printStackTrace();
    } catch (RemoteException e) {
    e.printStackTrace();
    Map payload = res.getPayload();
    When I try to connect to my locally deployed BPEL process Manager and Invoke the same process (MyFirstBPELProjectProcess ) it works fine and creates an Instance on BPEL Process Manager Console.
    When I tried Invoking the same BPEL process (MyFirstBPELProjectProcess ) deployed on a Remote machine ,it doesnt create an Instance.
    I believe my connections settings are all correct ,since it doesnt give me an connection issue on my standalone client.
    I tried looking at the following file default_group~oc4j_soa~default_group~1.log available opmn folder under SOA Suite OAS and there
    are no errors.
    Could some body point the log files that I need to look at.
    I am sort of clueless...
    Regards
    Harish

    CAn you post the error. HAve you made sure that the remote machine has connection on the port 6010. You can test this with the folloing command from the remote machine
    telnet host 6010
    obviously replace host with the fully qualified host name of the SOA machine.
    cheers
    James

Maybe you are looking for

  • Down payment against Purchase order

    Hi SAP GURU i have one queries regarding down payment made against asset puchase order I created one asset code, create the PO with accoun assignment categories A, made a advance payment against reference to this PO no . when i enter the po number in

  • Jserv.properties crash APACHE

    Hi: After several tests i denoted that THIS SPECIFIC ENTRY IN jserv.properties crash the jserv : wrapper.classpath=D:\ORACLE\iSuites\panama\lib\panama.zip this entry it's in jserv.properties and crash the jserv and i get this error on apache error_lo

  • Upgrade from 4.7C to ECC 6.0

    Hi Gurus,               I am going to do a functional upgrade from 4.7C to ECC 6.0 (classic GL, not new GL). Can someone please list me the steps that I need to do to achieve the upgrade. I would be very grateful and would assign points as a gesture

  • Transaction Code FPOITR

    Hi All, After we run the transaction code FPY1 , we run the standard sap program : SAPFKPY3 to download the data into a flat file Like wise for tcode : FPOITR(Outbound Interface: BP Postings) Once i run this tcode i want to download the result in a f

  • 3 computers running fine on router, 1 not

    I have 3 brand new computers hooked up and working on a linksys router, and another one of the same type, hooked up to it, but unable to connect. Even when hooked directly into the wall, or if I take a cable out of one of the working machines, it sti