RMI Codebase Issue

Every thing works just fine as both the Client and server runs on the same system,, but as i run one of them on a remote m/c,well i am using vmware for that, Client is not able to locate server's stub and server is not able to locate clients classes for dynamic loading..
I am sure its an issue with the way i set the codebase url's but how should i change them.
presently, i set them as
file:/E:/surshikradmin/workspace/rmi-server/bin/ for server..
and kind of same way for client.. should i add the host name too,,but how??? Any help would be highly helpful since its been years i am dealing with issue and solving it will make ma project go rock..
Client side stack trace if it coul help!
Computeappengine exceptionerror unmarshalling return; nested exception is: java.lang.ClassNotFoundException: Engine.ComputeappEngine_Stub java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: Engine.ComputeappEngine_Stub at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at Client.computeappprog.main(computeappprog.java:23) Caused by: java.lang.ClassNotFoundException: Engine.ComputeappEngine_Stub at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:432) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:163) at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620) at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247) at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350) ... 2 more

Crossposted and answered here

Similar Messages

  • RMI codebase confusion

    You'll have to excuse me if I am asking stupid questions, but I can't find the information I want in the documentation. I am working on an RMI client-server project with 3 jars client.jar, common.jar, server.jar. The common jar contains a Remote interface which the client looks up, and the server implements. The stub class is contained in the server jar (obviously).
    Currently our method of distribution is to distribute all 3 jars to the client machines - I want to avoid this as it is unnecessary. I would therefore like to set java.rmi.codebase property in the server so that clients can download the stub classes at run-time. OK.
    Our RMI app is being distributed on an internal network - suppose on the server machine (call it "ourserver.london.uk.ourco.com", the relevant Jar file would be at /usr/bin/my_app/jars/server.jar (or wherever).
    The clients lookup rmi://ourserver.london.uk.ourco.com:1099/MY_EXPORTED_REMOTE. Questions:
    1. Is this RMI "system" dependent on the server having an Http server?
    2. If it isn't, how do I define the codebase other than "http://..."?
    3. If it is (and the machine certainly does have an http server on it), how do I specify the codebase URL for the clients, given that the server is not "under" the http server (IYSWIM)?
    I'd be glad of answers to these (reasonably simple) questions.
    Chris

    First of all, I would arrange things a bit differently. In both of the cases below, we assume a http server, it's location is unimportent, but it has to be reachable from the the client. It could be the same host as the server, or a third machine.
    Option #1:
    client.jar -- All client class files, including all class files of remote interfaces called by the client.
    server.jar -- All server class files, including all stubs, and remote interfaces implemented and their implementations.
    server_dl.jar -- Just the stubs.
    The client host would contain just client.jar in the classpath.
    The server host would contain server.jar and server_dl.jar in its classpath
    server_dl.jar would also be placed on the http server and it's url would be the server's codebase.
    Option #2:
    client.jar -- All client class files, but none of the remote interfaces.
    server.jar -- All server class files, but none of the stubs and no remote interfaces.
    interfaces.jar -- The remote interfaces shared by client and server.
    server_dl.jar -- just the stubs.
    The client host would need client.jar and interfaces.jar in its classpath.
    The server host would need server.jar, interfaces.jar and server_dl.jar in its classpath.
    server_dl.jar would also be placed on the http server and it's url would be the server's codebase.
    Now to answer your questions.
    1. Is this RMI "system" dependent on the server having an Http server?If you want to have the client download the server stubs, then they have to be on an http server (I think a ftp url for the codebase may also work, but I have not tried it).
    2. If it isn't, how do I define the codebase other than "http://..."?
    You may be able to use a ftp url in which case the url would be "ftp://....."
    3. If it is (and the machine certainly does have an http server on it), how do I > specify the codebase URL for the clients, given that the server is not "under"
    the http server (IYSWIM)?The downloaded class files do not have to be on a http server that is on the same host as the RMI server. The RMI server's codebase can be any valid url (reachable from the clients) The only requirement is that the class files be reachable via the codebase. You do have to configure the client's network security so that it has permission to open connections to the codebase server.

  • How to include spaces in rmi codebase value url?

    I am writing an RMI application to run on a LAN, and for my codebase value I am using an URL with the format file:///d:\dir1\dir2\.xx.jar, where the path points to a directory on the server's hard drive. I need to accommodate the situation where dir1 or dir2 contains a space. When I simply use the space (e.g. d:\program files\dir2\xx.jar), I get a java.net.MalformedURLException. When I substitute %20 where the space is, (e.g. d:\program%20files\dir2\xx.jar), the URL is accepted but I get a java.lang.ClassNotFoundException. I know the java.lang.ClassNotFoundException is not due to a path problem (I tested with an identical directory structure, except that I used a path whose directories contained no spaces -- and everything worked). So I infer that the reason for the java.lang.ClassNotFoundException is that no directory with the name "program%20files" exists on the hard drive.
    Any advice would be most appreciated.

    This is not a bug that Java have to solve, it is the
    way URL's should be formed.Actually this is a very bad bug in Java. URL's are just absolute URI's (according to the RFC's, but in Java, URL has little to do with URI), which donot_ allow spaces: spaces must be encoded. When the original URL class was written the RFC's were ignored, and spaces were allowed. Now there is a URI class that works properly (not allowing spaces) which is contradictory to URL.
    Worst of all, creating a URL is ambiguous. In the URL
    "file:/tmp/foo%20bar.txt"
    is this the encoded version of a file with a space, or is it the unencoded version of a file with '%' '2' '0' characters in it? There are regression bug reports for places where this has changed behavior in the Java library (something about RMI for those interested).
    SUN refuses to fix URL because of all the legacy code that relies upon this bug. There are many bug reports, (search the Bug Database for "URL space") often marked simply "will not fix".
    http://developer.java.sun.com/developer/bugParade/bugs/4273532.html
    This is a nasty little problem, and I don't think it can be solved without making a new URL class which behaves correctly, and deprecating the old class. Well, you could also just fix URL and break legacy code :)

  • Trouble with RMI codebase

    Hi, i've created a file transfer application via RMI, it work very well, i can transfer file longer than 1 GB without any problem.
    But when i copy my project with all classes to another directory, it doesn't work. I'm sure that the trouble is in the VM options :
    "-Djava.rmi.server.codebase=file:E:\RMIFileTransfer\classes\ -Djava.security.policy=file:E:\RMIFileTransfer\policy\RMI.policy ", that points to the old directory. I don't want to change "E:\RMIFileTransfer\" in the VM options each time i move my project!!!
    How can be java.rmi.server.codebase and java.security.policy properties setted by an user input, or in the main( String args[] ) method? (sorry for my bad english...)

    (a) use a JAR file, not a directory system
    (b) the codebase setting has to have the same meaning throughout the system, i.e. to the server, the registry, and the client. Obviously a file: URL is not likely to comply, because every host has its own file system. Have a look into providing the JAR file via an HTTP service and using an http: URL.

  • RMI "UnmarshalException" issue

    Hi,
    I am doing a sample RMI application in the following step by step process but in the *8th* step I am getting exception so please kindly resolve my issue.
    Step-1: creating “Service interface”
              AddServiceInterface.java
              ====================
    import java.rmi.*;
    public interface AddServiceInterface extends Remote
         public int add(int a, int b) throws RemoteException;
    Step-2: Compiling “Service interface”
    D:\BAJI\Programs\JAVA\rmi\rmi_server>javac AddServiceInterface.java
    D:\BAJI\Programs\JAVA\rmi\rmi_server>
    Step-3: creating the Service interface implementation class
                   AddService.java
                   ============
    import java.rmi.*;
    import java.rmi.server.*;
    public class AddService extends UnicastRemoteObject implements AddServiceInterface
         public AddService() throws Exception
         public int add(int a, int b) throws RemoteException
              return (a+b);
    Step-4: Compiling the “Service interface” implementation class
    D:\BAJI\Programs\JAVA\rmi\rmi_server>javac AddService.java
    D:\BAJI\Programs\JAVA\rmi\rmi_server>
    Step-5: Start the RMI service
    1)openned a new command prompt and typed the following command
    2)d:\> rmiregistry
    Step-6: Create stub and skeleton classes
    D:\BAJI\Programs\JAVA\rmi\rmi_server>rmic AddService
    D:\BAJI\Programs\JAVA\rmi\rmi_server>
    Step-7: Create RMI Server Application which export the Server object into Naming service
    RMIServerApp.java
    ===============
    import java.rmi.*;
    public class RMIServerApp
         public static void main(String[] args) throws Exception
              AddServiceInterface asi = new AddService();
              Naming.bind("rmi://localhost/as",asi);
              System.out.println("\n\n***************** Registored into Naming Service ****************\n\n");
    Step-8: Compiling & execute
    D:\BAJI\Programs\JAVA\rmi\rmi_server>javac RMIServerApp.java
    D:\BAJI\Programs\JAVA\rmi\rmi_server>java RMIServerApp
    Exception in thread "main" java.rmi.ServerException: RemoteException occurred in
    server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: AddServiceInterface
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun.rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
    66)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:707)
    at java.lang.Thread.run(Thread.java:595)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
    RemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
    223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:111)
    at RMIServerApp.main(RMIServerApp.java:8)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
    ception is:
    java.lang.ClassNotFoundException: AddServiceInterface
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun.rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
    66)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:707)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassNotFoundException: AddServiceInterface
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:7
    07)
    at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651)
    at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:6
    28)
    at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStrea
    m.java:238)
    at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1500)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1463)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
    699)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    ... 9 more
    Step-9: Create the “client object” file
                   RMIClient.java
                   ===========
    import java.rmi.*;
    public class RMIClient
         public static void main(String[] args) throws Exception
              AddServiceInterface asi = (AddServiceInterface)Naming.lookup("rmi://localhost/as");
              System.out.println(asi.add(10,20));
    Thanks & Regards,
    BSK

    The registry cannot find the class named in the exception.

  • Jar file as RMI codebase

    Please tell me I'm missing something:
    I have an RMI server that works fine. All I want to do now is package it in a jar file...Sounded easy enough when I got started.
    According to the RMI tutorial, the value of the codebase property can refer to
    1. The URL of a directory in which the classes are organized in package-named sub-directories.
    OR
    2. The URL of a JAR file in which the classes are organized in package-named directories.
    OR
    3. A space-delimited string containing multiple instances of JAR files and/or directories that meet the criteria above.
    Setting the codebase property on the commend line like this:
    -Djava.rmi.server.codebase=file:/my_dir/my_jar_file.jar
    gives an UnmarshalException with a nested ClassNotFoundException indicating that my Stub file is missing.
    However, if I unpack the jar to the directory my_dir/classes and use
    -Djava.rmi.server.codebase=file:/my_dir/classes/
    then everything works fine... so I know there are no files missing from the jar file
    Any ideas?
    Thanks in advance,
    Matt.

    jquattro, thanks for the reply. Only problem is that I'm adding to a pre-existing jar file rather than creating a new one, so I don't want to change it other than adding the extra classes.
    I found that it worked fine on a Windows box, so I tried a different jdk on unix, and found that it works fine if I use the jdk1.3 RMI registry - so it appears it might have been a bug in jdk1.2 on Unix.

  • RMI firewall issue - opening port 1099 is not enough

    Hello,
    We have a distributed java desktop app that uses RMI with callbacks to communicate amongst the clients. It all works really well at our dev site and at 2 trial sites.
    We are about to deploy out to more customer sites - so I have been doing more testing with firewalls etc and discovered some issues. Our customers are small businesses and typically have between 1 and 10 desktop clients that connect to the server via RMI. These customers are "very NOT technical", so we need to give them set-and-forget firewalls etc.
    This is all on a LAN, with RMI using port 1099. On the firewalls (of the various PCs) we open ports 1099 (RMI) and 5432 (for the Postgres DB).
    Also, I was using "CurrPorts" and "SmartSniff" to monitor the traffic at each PC - so I had a reasonable view of proceedings.
    Basically, opening port 1099 on the server is necessary, but it is NOT ENOUGH. The RMI moves off to ports other than 1099, and the server firewall does not allow the connection.
    Procedure ...
    (1) start the "server" app - which starts the RMI registry - the "localhost" desktop app also starts and it works well to both the database and the RMI.
    (2) start another client - it connects to the DB Server, but NOT the RMI server.
    (3) open the server firewall to all traffic for a few seconds - then the client connects successfully.
    From CurrPort logging I could watch the RMI comms progress over those first few minutes ...
    Initially the comms do include port 1099 on the initial call to the server, but there after there are always 2 or 3 "channels" open, but not to 1099.
    I notice that the Postgres DB keeps using port 5432 for all of its active channels - so it does not have the same firewall issue.
    After we have opened the firewall for a few seconds - to enable the link - then we can turn the client on and off and the client re-connects without issue - so it would seem to be only an issue with the initial connection.
    I am sure that this is all completely standard and correct RMI behavior.
    QUESTIONS:
    1. Can RMI be "forced" to always use port 1099 for connections, and not move to other ports? (like the database uses 5432)
    2. Are there any suggestions for getting around this seemingly standard RMI behaviour?
    Other comments ...
    The firewall lets me open individual ports (say 1099) - BUT I can not justify opening ALL ports.
    The firewall lets me open all ports to an application, say "C:\Program Files\Java\jre6\bin\java.exe", but that app will occasionally change at a customer's site as they will update their java version and suddenly our app will stop working.
    Any guidance is appreciated.
    Many Thanks,
    -Damian

    1. Can RMI be "forced" to always use port 1099 for connectionsYes. Export all your servers on the same port. See UnicastRemoteObject constructor that takes an int, or UnicastRemoteObject.exportObject(int). If the RMI Registry is a separate process you can't re-use 1099 for this purpose, but see below.
    2. Are there any suggestions for getting around this seemingly standard RMI behaviour?Yes. Start the RMI Registry in the same JVM as the code, then you only need to use 1099 for everything.
    If you are using server socket factories, make sure they have an equals() method, or use the same instance for all remote objects.

  • Problems with RMI Codebase

    Hello,
    i have installed Tomcat in a path with whitespaces. Our Application use RMI (as server componend) to communicate with other Applications.
    when I start Tomcat i get an Exception like this:
    (by the way: no protocol: Audit -> Audit is a part of the path with whitespaces and it is nessessary that the tool runs with whitespaces in the path e.g. Program Files)
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.net.MalformedURLException: no protocol: Audit
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:352
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
    at sun.rmi.transport.Transport$1.run(Transport.java:148)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
    i have write a system parameter with -djava lfor rmi.server.codebase ike this and qoute the whitespaces with %20 but it doesn' t work.
    file://d:/test/Tool%20Audit/
    Please help me, its urgent.
    Best regards
    Chris

    Hi Chris,
    the Exception java.net.MalformedURLException: no protocol: Audit means that your path is incorrect, try
    <protocol>://<path>/
    for Example
    http://.../Audit
    ftp:/.../Audit
    file://../Audit

  • RMI | Firewall  issue revisited

    Hi all,
    I have searched through these forums for a suitable answer to my problem, but have not gotten any.
    My RMI client-server app was working perfectly well on a Windows 2000 Advanced Server (with its firewall restrictions), until my company decided to buy another firewall appliance. My RMI server used to run on the Advanced server machine with a static IP and I ran my server with the following command :
    java -Djava.security.policy=server.polocy -Djava.rmi.server.hostname=209.XXX.XXX.XXX Server
    (209.XXX.XXX.XXX being the static IP used by the advanced server)
    Now, with the addition of the firewall appliance and after having opened up 2 ports for RMI communication and forwarding them to the Host machine, my application had stopped functioning across the internet.
    The host machine has an internal IP address of say 129.128.***.***
    When an external client tries to establish contact with the my RMI server using 209.XXX.XXX.XXX (the external IP), I get a
    "Connection refused: Unable to connect with 129.128.***.***"
    This makes me believe that even though the client is able to initially establish connection with the RMI server, the RMI server sends back a reply to the client, asking it to find the server at the INTERNAL ip address.
    Is there a way to avoid this ? Where am I going wrong ? How can I resolve this issue ?

    The error is happening because the client is finding and connecting to the RMI registry OK, it is getting the Remote reference OK but when it tries to send a message to the Remote reference it is sending to your internal IP address and hence getting the unable to connect error.
    The IP address in the Remote reference returned by the RMI registry is the one that the server object is bound to. No amount of port forwarding will change that.
    You have two options in my experience:
    1. You can try to force your server to believe it is 209.x.x.x when you bind the Remote instance. You can do this on Linux, but I have no idea how to do it on W2K.
    2. The server.rmi.hostname works for fully qualified domain names, not IP addresses. If you only have one RMI server running, or if you use different ports for different RMI servers, you should be fine by setting the hostname value to your fully qualified domain name and then use NAT to forward to the Internal IP address. If you have more than one server running on the same port number, you'll need to register different FQDN's for each. Then all you need to do is update your internal DNS to point to the internal IP address and the external clients will use their existing DNS in the normal manner.

  • RMI security issue

    Hi, there!
    This is cross-post from "NetWeaver AS, Java" forum.
    I have a security issue when I try to run RMI client code in the web application on the Web AS 2004s. There is
    lookup statement in JSP or servlet code:
    Naming.lookup("//server/RemoteClass")
    which throws
    java.io.AccessControlException: access denied (java.io.FilePermission
    D:\usr\sap\AS1\JC00\j2ee\cluster\server0\apps\sap.com\MyEntApp\servlet_jsp\MyWebApp\work\com\mycompany\packagename\RemoteClassImpl_Stub.class read)
    I have investigated where "java.security.policy" parameter is setup, there has value "./java.policy". This file is
    regenerated each time when web AS is started, thus I created another policy file, granted file permission for
    above path and set it as -Djava.security.policy in server start parameter. It doesn't resolve problem, I have
    investigated this parameter doesn't correlate with real application run-time permissions. Has anybody ideas?
    Thanks
    P.S. This code works fine as a standalone application.

    File Name : policy.txt
    grant     {
         permission java.security.AllPermission;
    };Run ur program as follows:
    java -Djava.security.policy=policy.txt <Java Client >

  • Rmid activation fails if rmi codebase host down.

    Dear activation/rmid gurus.
    I have trouble with rmid activation when the host storing the codebase is down. I understand that it can't activate as long as the codebase host is down but should'nt rmid keep trying in regular intervals in case the codebase host appears.
    Imagine a restart of a rmid host machine have the codebase on a local webserver (on the same host). If the rmid service is started before the webserver is up and running the activation system will not start correctly. In this case its pretty easy to fix the codebase host dependency by making sure the webserver is started before the rmi service.
    Its more troublesome when the codebase is located on another host on the network. If the machines goes down, e.g. due to a powerfailure, and the rmid host machine restarts faster than the codebase host the activatable object will be out of business.
    Is there some way to ensure that the rmid deamon keep trying activation its activatable objects?
    \Magnus

    After some tests I finally got it working...
    It appears as as the java.rmi.server.hostname property needs to be set on the java interpreter running rmid. This is achieved by passing
    -J-Djava.rmi.server.hostname=yoda as argument to rmid.
    \Magnus

  • Rmi +codebase

    I�ve a problem connecting my webstart rmi-client to a rmi-server.
    The webstart rmi client downloads the stubs from the server codebase. So far this is the right behaviour.
    After that the client tries to download the remote interface from the server codebase although the remote interface classes are in the client jar (!?).
    It seems to be that this is a codebase related problem in webstart because
    when I start the client without webstart, everything works fine (i.e. the client only downloads the stubs).
    thanks
    p.s.
    The codebase is set on the server (Djava...) and as mentioned above the remote interfaces are in the client jar and the stubs are
    not.

    Hi,
    I'm not sure I completely understand. JWS will download the jars specified in the JNLP file unless they are marked as lazy, in which case it'll donwload them when it thinks it needs them.
    What I did in my app (which also uses RMI) was to package all stubs in their own JAR. This can then be used by server and client. The server implementation is not available to the client (not specified in the JNLP file). Common interfaces are in a common JAR, client code in a client JAR and server code in a server JAR.
    The client, then, downloads the client JAR, the common JAR and the stubs JAR. No classes/interfaces are in more than one JAR, since this can be confusing.
    I don't know how JWS decides to download lazy JARs, but it maybe that you've managed to confuse it. You may be able to unfonfuse it by ensuring a clean separation between client, server and common items in your application, and not duplicating resources in different JARs.
    Rhys

  • Several RMI (easy) issues

    Hi,
    Developping a small RMI application, I face the following issues:
    I can run several RMI servers on a machine (launched with 1 or more userId (root, guest, foo)) but how can RMI clients be notified of how many RMI servers have been launched (and their port number). How to specify the server we want to log in ? Is it possible to have from a client the list of all RMI servers running on a machine ?
    I would like that clients use login/passwd to connect the RMI server. In fact, If the client authentifies itself with root/passroot it automatically runs on the root RMI server launched. How can I do that ?
    Thanks.
    If it is not clear enought I will explain my problems differently.

    Here are my replies:
    1) the issue is that the server can execute system commands (kill ,renice, performance command...). So, I don't want, if a server has been started as root, that every body accessing this server can run a kill on a process. So every user would have to launch its own server and then only access to services it can perform normally when logging on this machine. Moreover the RMI server has to retrieve a lot of infomation in less than 1sec (do some sys calls and internally retrive the state of all processes running on the server machine) so I think is better do launch several servers.
    Note: the client MUST have a direct access to the server machine. It is a pre-requiered.
    2) Thanks.
    3) So the client can send the login/passwd info tho the server, which look in the unix account on the system, register the client with the good server and that accept the connection.
    A lot of messages talking aboiut RMI security gives some idea on how implmenting a secured connection between client/server but I cannot find any pseudo-code or code sample.
    Do you have sme pointers ?
    Thanks

  • RMI-Codebase Stuff... (woreks only on Windows machine)

    Hi,
    habe mein Programm auf meiner Windowskiste laufen und was soll ich sagen :) es l�uft.
    Ich kann Objekte f�r den Remotezugriff zur Verf�gung stellen, kann vom Client darauf zugreifen und wunderbar. Die Stubs habe ich dazu auf meinen Webserver gelegt und die codebase wie folgt als zus�tzliches Argument f�r den JVM angegeben:
    -Djava.rmi.server.codebase=http://meinserver.de/classes/
    Lange Rede kurzer Sinn: Es l�uft einwandfrei.
    Nun zum Problem:
    Habe das gleiche nun auf einer LinuxKiste vesucht und dort geht es nicht.
    Programm kompiliert einwandfrei, nur das "�ffentlich machen" der Objekte klappt nicht. Ich bekomme so eine seltsame UnmarshalException mit einer genesteten ClassNotFoundException. Das Ganze deutet laut stundenlangem Googeln auf eine nicht korrekte Codebase hin. Sie ist aber korrekt, benutze den gleichen String an der gleichen STelle wie auf dem Windowsrechner. Mein Webserver loggt auch keinerlei aktivit�t mit. Der Linuxrechner versucht also gar nicht an die stubs auf dem Server zu kommen.
    Woran kanns liegen? Muss man bei Linux mehr beachten als bei Windows?
    mfg
    Hi there,
    i wrote a litle program. It works fine on my windows machine (XP, sun-jdk-1.5.0, Netbeans 4.0) I can create objects, and bind them to rmi-registry. (I am using the embedded rmiregistry from OpenJMS.) A client can lookup them using the naming.lookup(�blabla�) method. Therefor I put the stub-files on my webserver. The codebase is placed on this server.
    -Djava.rmi.server.codebase=http://myserver.de/classes/
    Everything works fine!
    THE PROBLEM:
    When I start the same program on my linux machine (Gentoo, sun-jdk-1.5.0, netbeans 3.6) I get an UnmarshalEception with a nested ClassNotFoundException. I am using the same codebase as on the windows machine. I recognized, that there is no access to the stub-files on my web server when I start it. (The logs do not change) I do also use the same version of embedded rmi-registry (in OpenJMS). Everything is the same, but the operating system.
    What can cause this problem? I imagine that java is not allowed to contact the webserver, but there is no firewall, nothing that could forbid it, but java itselfs.
    I tried to use a policyfile. So I created a file called: rmi.policy with this content:
    grant
    permission java.security.AllPermission;
    I addet this policy to the vm as argument with thi command:
    -Djava.security.policy=http://myserver.de/rmi.policy
    when I now start the program I can see in the web server logs, that there is access to the rmi.policy file. That means, the VM is fetching it an (maybe) read it! But there is still the UnmarshalException an no access to the stub-files on the webserver.
    It would be very helpful if somebody could help me.

    I have a problem similar to yours with corba protocol.

  • RMI codebase syntax

    Greetings,
    Can anyone inform me of the proper syntax for a relative classpath when setting the codebase property for RMI directory binding? I have all my classes in a subdirectory .\classes relative to my current directory. If I specify the file location explicitly, as in the following command:
    java -cp .\classes -Djava.rmi.server.codebase=file:/c:\currentdir\classes/ RMIServer
    the server works fine. But when I try the following:
    java -cp .\classes -Djava.rmi.server.codebase=file:/.\classes/ RMIServer
    the registry cannot find the RMIServer_stub file in the \classes directory. I've tried numerous permutations to no avail, and I can't find any documentation on the syntax. I need to set a relative path so this server can be loaded onto any machine in any directory.
    Any help would be appreciated.

    Well, I didn't get any reply when I submitted this question on graveyard shift, perhaps the daytime forum folks can help (or I should delineate: North and South American daytime folks; and, perhaps Asian, African, Australian or European evening folks may still be online. Let's not leave out Antarctica...it's possible).
    Does anyone know the answer to the above post or where I can find the documentation for the syntax?
    Thanks in advance.

Maybe you are looking for