Codebase run RMI server .NoClassDefFoundError:

If I run the folllowing from the solaris command line
java -cp /junk/jdev+/jdev/src -Djava.rmi.server.logCalls=true -Djava.rmi.server.codebase=file:////junk/jdev+/jdev/src/ -Djava.security.policy=/junk/jdev+/jdev/src/jdev/server/policy jdev.server.RMIServerDBAdapter
my RMIServerDBAdapter binds regardless of my current working directory. In other words the RMI server
runs and binds as expected.
If I remove the classpath clause of the java command (-cp /junk/jdev+/jdev/src) then the RMI server
will only run and bind if my current working directory is the "root" of the package.
In this case if my current working directory is /junk/jdev+/jdev/src the RMI server will run and bind as
it should. If my current working directory is at the root of the solaris file system ( / ) I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: jdev/server/RMIServerDBAdapter
My question is why doesn't the code base clause of the java command point to the root
directory of the package /junk/jdev+/jdev/src. It seems to me that the codebase clause
would point to the root directory of the package allowing the RMI server to run and bind as expected
regardless of the current working directory.
I cannot get this to work. I have tried 0-4 slashes (file:/, - file:////) that did not seem to help.
The package statement in the java source files is
package jdev.server
Thank you in advance for your help.
Michael
[email protected]

Hi Ciaccio,
Your question is doesn't clear enogh to me to answer it straight... But I'll try... :)
First you must not mix the reason and usage of the codebase and classpath. Classpath is locally parsed and used, codebase is remotely parsed and used (at the registry and at the client side).
Your server program cannot start if you don't tell to the system where to find the needed classes. That's why you have to specify the root path of the jdev.server.RMIServerDBAdapter in the CLASSPATH (from that point will search the java system the jdev dir, the server dir and the RMIServerDBAdapter object) .
If the Java system is unable to locate any of a needed class it throws a nice exception during the startup of the server program.
The codebase property is used by the client and the registry to locate the stub objects (and return types and parameter types) if those cannot be found on their local classpath. This path (or it would be more accurate to call what it is: URL) must be an absolute address (path, URI, etc), because the clients and the registry can be started anywhere. This way you also have to set RMISecurityManager and polici files also to your client because of dynamic class downloading...
Last thing:
Note the line above: ...if those cannot be found on their local classpath... If the stubs and the param/return types are present in the registry's and the clients local classpath then you don't have to specify codebase property at the server side because it is not parsed at all.
I hope I could help,
Sanyi

Similar Messages

  • How to run RMI in Internet

    Hi ,
    iam running RMI server in vsnl public ipaddress like :121.*.*.*;
    when i run the client in vsnl network it is working fine.iam trying to run this in another network like airtel network it is not connecting.
    is there any solution?
    bez i need to run my application anywhere from the world in any network.

    Basically you need to download the RMI plugin from:
    http://www.genady.net/rmi/v16/main.html
    You can either get a license from them, or it only works for 14 days from the date you download the software (so if you changed your computer date....)
    You download the zip file, and put it in your eclipse directory (just follow the steps). It generates all the rmi classes for you automatically.
    I don't think it's required for working with RMI--you could probably get rmic and generate the class files yourself, the plugin just makes the process simpler, and I believe you can also monitor the registry, which is a nice feature.

  • RMI server causes the system to slow down and crash with socketException

    Hi,
    My RMI server application is a simple rmi server which invokes a JNI method once when I invoke through my client application. Server is left as it is after invoking the JNI method. After around 12 hours, server stops running with the following exception
    ZoneInfo: C:\Program Files\Java\jre1.6.0\lib\zi\ZoneInfoMappi
    ngs (Insufficient system resources exist to complete the requested service)
    ZoneInfo: C:\Program Files\Java\jre1.6.0\lib\zi\ZoneInfoMappings (Insufficient s
    ystem resources exist to complete the requested service)
    Dec 29, 2008 10:09:34 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:10:35 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:12:36 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:15:37 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:20:40 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (4D555445583F57494E13120E4350500075), pid=1352, tid=1828
    # Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
    # Can not save log file, dump to screen..
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (4D555445583F57494E13120E4350500075), pid=1352, tid=1828
    # Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    Does anyone has any idea?
    Regards
    Nidhin

    Your RMI server invokes a JNI method as you mentioned. It seems your system resource is become very low as from the exception from "ZoneInfoMappi"
    (Insufficient system resources exist to complete the requested service...I would suggest the following
    1- remove the JNI method invocation and replace by a simple method which does nothing special ( counting etc..)
    2- Run the RMI sever and stress test it again
    If you see the RMI server is working well after 12 hours, then your native method is leaking i.e consuming the system resources ( RAM etc..)
    You should profile the running RMI server using jconsole
    Regards,
    Alan Mehio

  • RMI Server Class path issue

    hi ,
    i am facing classpath issue when try to run rmi server. i have a jar file
    (RmiServer.jar) for rmi server , which contain some other jar file .
    when i run this jar file it throws ClassNotFoundException
    the java classloader are not able to load class from jar(RmiServer.jar)
    file. pls. tell me what i did wrong .
    Regards
    Brajesh K

    Actully you dont understand my problem.
    i have 2 jar file RmiClient.jar and RmiServer.jar
    when i run RMIserver.jar it throws following exception.
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: RmiServer_Stub
    the RmiServer.jar contain all the class file (stub/skelton,remote,etc) whichever needed.
    even i set class path to that folder where RMIserver.jar is placed
    inspite of that it throws ClassNotFoundException : RmiServer_Stub
    i dont undersatand why classloder , not able to load class file from Rmiserver.jar.
    any idea.
    thanks in advance
    Regards
    Brajesh K

  • Stopping an RMI server

    hi all,
    i was curious about one hting: how can i stop a running RMI server via command line?
    will stop rmiregistry works??
    thanx and regards
    marco

    Hi,
    I have solved this problem by combining two techniques.
    First I save a copy of the current thread (Thread.currentThread() returns it) in a member variable of the class that implements the remote interface. This is done in the main() method that creates the instance of the object and registers it with the RMI service.
    Then I put the thread executing the main() method to sleep by calling Thread.currentThread().join(). It will sleep indefenately until interrupted.
    The other trick is to add a method to the remote interface called stopServer() and to implement it in the class that implements the remote interface.
    The stopServer() method simply calls the interrupt() method on the saved reference to the sleeping thread that executed the main() method until it was put to sleep.
    The result is that the sleeping call to join() in the main() method wakes up by throwing an InterruptedException, which you catch.
    Then you can have the remaining code body of the main() method proceed to unbind the remote object from the running RMI service, shut it down properly, and delete it (setting it equal to null).
    Finally, you must terminate the main() method by a call to System.exit( 0 ). Simply returning is not enough, since the RMI API does not offer any methods() for stopping it. But the exit() will kill the entire VM.
    Therefore it is propably important to really shotdown everything nicely and perhaps even call the garbage collecter to have it clean up explicitly, before killing the VM by the exit() call.
    Note that I also always start the RMI service in the beginning of my main() methods. I think this makes the RMI server application more complete.
    I have done this a lot of times and can e-mail a copy of a package that I always use as a template when beginning new RMI client/server projects. Just mail me at
    [email protected]
    and I'll send it to you. Good luck!
    Sincerely yours...

  • Java.rmi.server.codebase=file:(?????); at client side: classnotfounexceptio

    I'm trying to run an RMI application (under Windows XP, one machine for client and server) like this:
    at server side:
    java -Djava.rmi.server.codebase=file://\..\..\..\j\ -Djava.security.policy=file:.\polityka.txt sss
    - and it works fine, but at client side:
    java -Djava.security.policy=file:.\polityka.txt -Djava.rmi.server.codebase=file://\..\..\..\j\ kkk
    results in:
    Exception in thread "main" java.lang.NoClassDefFoundError: PrzykladowaKlasa
    at kkk.main(kkk.java:31)
    when I'm listing directory (at client side) got with System.getProperty("java.rmi.server.codebase") i get this
    file://\..\..\..\j\
    OdleglaKlasa_Stub.class
    PrzykladowaKlasa.class
    Folder Structure is:
    |------j\
    | |------(*_Stub.class, and ClassNeededByClient.class)
    |------2\
    | |------Server\
    | | |------(serwer files)
    | |------Klient\
    | | |------(klient files)
    I'm fresh in RMI and Codebase poperty, but with some exp with Java...
    (policy files are allright - grant {permission java.security.AllPermission;};)
    Any help will be appreciated.

    I've come back to this issue again (since I am moving code around to different systems again). Using linux I can use -Djava.rmi.server.codebase=file://$PWD/build/
    Presumably there is a similar command in WIndows.

  • RMI Server Codebase Permission Denied

    I'm having a problem trying to get my application running in a test environment. I currently have this same application up and running in an almost identical location without any issues, and I'm at a loss to understand what the problem is.
    My application is an RMI server-client setup. At the moment, I'm having trouble with solely the server portion, as I'm unable to get it to access the codebase. I start the application with the following runServer.sh file (located in /usr/local/app/app, so the $ROOT_DIR=pwd is correct):
    Line: -----
    #!/bin/bash
    ROOT_DIR=`pwd`
    JAVA_HOME=/usr/java/latest
    CLASSPATH=''
    #:: Please edit the environmental variables below so that it refers
    #:: to the location where you have distribution URL.
    DISTRIBUTION_URL=file://$ROOT_DIR
    find /usr/local/app/app/server -name '*.jar' -type f -print | while read FILE
    do
    if [ $CLASSPATH ]
    then
         CLASSPATH=$CLASSPATH:$FILE
    else
         CLASSPATH=$FILE
    fi
    echo $CLASSPATH > classpath.env
    done
    read CLASSPATH < classpath.env
    find /usr/local/app/app/import -name '*.jar' -type f -print | while read FILE
    do
    if [ $CLASSPATH ]
    then
         CLASSPATH=$CLASSPATH:$FILE
    else
         CLASSPATH=$FILE
    fi
    echo $CLASSPATH > classpath.env
    done
    read CLASSPATH < classpath.env
    find /usr/local/app/app/common -name '*.jar' -type f -print | while read FILE
    do
    if [ $CLASSPATH ]
    then
         CLASSPATH=$CLASSPATH:$FILE
    else
         CLASSPATH=$FILE
    fi
    echo $CLASSPATH > classpath.env
    done
    read CLASSPATH < classpath.env
    echo ${CLASSPATH}
    cd server
    # start /min "RMI Registry"
    $JAVA_HOME/bin/rmiregistry &
    JAVA_SECURITY="-Djava.security.policy==config/admin.policy -Djava.security.auth.login.config==config/app_jaas.config"
    IMPORT_PROPERTIES="-Dapp.import.properties=file://$ROOT_DIR/import/config/import.properties -Dapp.import.logging.properties=file://$ROOT_DIR/import/config/importlog.properties -Dapp.client.properties=file://$ROOT_DIR/client/config/client.properties"
    app_PROPERTIES="-Dapp.root=$ROOT_DIR -Dconnection.pool.properties=file://$ROOT_DIR/server/config/database.properties -Dapp.common.properties=$DISTRIBUTION_URL/common/config/common.properties -Dapp.server.properties=file://$ROOT_DIR/server/config/server.properties -Dapp.server.logging.properties=file://$ROOT_DIR/server/config/log.properties"
    echo
    echo "-------------- app Server -------------------"
    echo
    $JAVA_HOME/bin/java -ms96m -mx256m -classpath $CLASSPATH -Djava.rmi.server.codebase=file:///usr/local/app/app/common/lib/common.jar $IMPORT_PROPERTIES $JAVA_SECURITY $app_PROPERTIES -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n app.serverimpl.ServerStarter
    cd $ROOT_DIR
    Line: -----
    After running this, it fails at that last line, $JAVA_HOME/bin/java etc. Near as I can see from the error is that it cannot access the -Djava.rmi.server.codebase.
    Line: -----
    app.serverimpl.service.ServiceException:java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: access to class loader denied
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:419)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
    at sun.rmi.transport.Transport$1.run(Transport.java:177)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:636)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at app.serverimpl.service.LoginManagerServiceImpl.start(LoginManagerServiceImpl.java:52)
    at app.serverimpl.service.ServiceAdapter.start(ServiceAdapter.java:96)
    at app.serverimpl.service.ServiceManager.startup(ServiceManager.java:78)
    at app.serverimpl.ServerStarter.main(ServerStarter.java:62)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: access to class loader denied
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
    at sun.rmi.transport.Transport$1.run(Transport.java:177)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:636)
    Caused by: java.lang.ClassNotFoundException: access to class loader denied
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:445)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:182)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:214)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
    ... 12 more
    Caused by: java.security.AccessControlException: access denied (java.io.FilePermission /usr/local/app/app/common/lib/- read)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
    at java.security.AccessController.checkPermission(AccessController.java:553)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at sun.rmi.server.LoaderHandler$Loader.checkPermissions(LoaderHandler.java:1173)
    at sun.rmi.server.LoaderHandler$Loader.access$000(LoaderHandler.java:1127)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:409)
    ... 21 more
    Line: -----
    Out of growing desperation (and since it's a test VM in virtual box so I'm not really protecting anything) I've already granted full permissions to everyone for these these files in the filesystem itself - chmod -R 775 - and I've made sure that common.jar is accessible. I also double-checked the Security Policy, Djava.security.policy, and that's just a straight all permission to everything (again, I'm not protecting anything on this test).
    Line: -----
    grant {
    permission java.security.AllPermission;
    Line: -----
    What's really driving me nuts is that this exact same code is already running and working on another machine. There are no environment variables that I'm missing, and I don't see how those would relate to this problem even if I did. The directories are identical, and I've verified the location that's listed as the cause (/usr/local/app/app/common/lib/) exists and is accessible. I keep coming back to the file permissions and the security policy and I'm sure I could be missing something obvious, but I am not seeing it at all. Can anyone give me some advice on this?
    I'm running a VM in VirtualBox 4.1.4, running CentOS 5.7 32-bit. Java is JDK 1.6.0, just the basic yum install package.

    This is a .policy file problem, not a filesystem permissions problem. Run it with -Djava.security.debug=access,failure to see exactly what is going on. Basically your .policy file either doesn't grant the required FilePermission or isn't being loaded.
    NB a codebase of a local JAR file isn't going to work unless all the clients are in the same host.

  • Java.rmi.server.codebase in JSP

    Hi,
    i have a system made from an RMI client and an RMI server. The users access the system through a JSP page, which creates an instance of the RMI client. In order for the system to work, i need to specify the java.rmi.server.codebase property.
    For testing purposes the client has a main(..) method. If i run just the client the server and specify java.rmi.server.codebase, everything works.
    If i don't specify it i get a java.rmi.UnmarshalException, with the nested exception of ClassNotFound. The same exception i get trying to access the jsp page. So, i guess, it's due to the lack of the property.
    I tried setting the property in the jsp page, but it doesn't work.
    Thank you.
    P.S. : maybe this is relevant: my jsp server is tomcat 6.0.

    it refers to where are your stubs and skeletons
    you can set it to point to the jar files or to the directory that contains them
    hope htis helps
    regards
    marco

  • -Djava.rmi.server.codebase Question.

    When I study the meaning of codebase in
    http://java.sun.com/j2se/1.3/docs/guide/rmi/codebase.html
    , I am still confuse what is different between codebase
    settings in Remote Object side and RMI Client side.
    The command options -Djava.rmi.server.codebase=
    http://myHost/myDir and -Djava.rmi.server.codebase=
    http://wwwserver/mydirectory ( in Figure3 and Figure4 of
    http://java.sun.com/j2se/1.3/docs/guide/rmi/codebase.html
    ) are set in which side ??
    The option in Remote Object side seems no any work.
    Who can explain its meaning ??
    Thank you in advance... Alan.

    Hi,
    For the dynamic class loading to work, you should give
    -Djava.rmi.server.codebase=http://some-server/
    you can see that it supports http protocol.. So there should be one web server running on the server side so that client can call it by name or by IP address.. Then try running the program again. now it will work..
    actually you should give this option on client side as it is the client who needs this property.. so in order to download classes the server machine should be addresable to the client in any method. if it is a LAN, try giving '\\computer-name' in the value of the property.. I haven't tried this, but I think you dont need a http server this time.. I am not sure abt this,,. check it out..
    - Bibin.

  • Not able to run a simple RMI server

    I am running an RMI program like follwing
    import java.rmi.* ;
    import java.rmi.registry.* ;
    import java.rmi.server.* ;
    public class CallBeanServer extends UnicastRemoteObject implements ICallBeanServer
         //main
         public static void main(String args[]) throws Exception
              int port = 1000 ;
              Registry reg = null ;
              if( args[0].equals("true"))
                   reg = LocateRegistry.createRegistry(port) ;
                   System.out.println("Successfully created registry") ;
              else
                   reg = LocateRegistry.getRegistry(port) ;
                   System.out.println("Connected to existing registry") ;
              CallBeanServer callBeanServer = new CallBeanServer(reg) ;
         }//main
         //constructor
         public CallBeanServer(Registry reg) throws Exception, RemoteException
              super() ;
              reg.rebind("CallBeanServer",this) ;
              System.out.println("CallBeanServer Object bound") ;
         //my public method
         public String callBeanServer() throws RemoteException
         {          return "Success" ;
    I have run the rmiregistry at port no 1000 like
    rmiregistry 1000
    I have compiled ICallBeanServer also and run rmic also over CallBeanServer like
    rmic CallBeanServer
    when I run this program using
    java CallBeanServer false
    it gives the follwoing errors
    Connected to existing registry
    Exception in thread "main" java.rmi.ServerException: Server RemoteException; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at CallBeanServer.<init>(CallBeanServer.java:38)
    at CallBeanServer.main(CallBeanServer.java:30)
    Can you please tell me what is the error?
    Thanks
    Prashant Gupta

    Add the classes (the stubs included) to the classpath when you start the registry.

  • How do I make a RMI client running in Bea find a remote, non Bea, RMI server?

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

  • Rmiregistry �J-Djava.rmi.server.codebase=URL

    Hi all,
    When starting the rmiregistry, I do the following:
    rmiregistry �J-Djava.rmi.server.codebase=URL
    Eager to understand what is going on, I read that this means the following:
    RMIClassLoader:
    For stubs and skeletons of remote objects created in the local virtual machine, the URL specified by the local java.rmi.server.codebase property is used.
    I thought "hey why not do the same for the server" and tried:
    java -Djava.rmi.server.codebase=URL Server
    getting me a StubNotFoundException. Can anybody tell me what I am doing wrong? The Server works when the Stub is in the local classpath but refuses to load it via the http Server. Am I at least theoretically right or is there a fundamental misconception in what I am trying?
    Thanks,
    Ralf

    RMI uses annotations to record codebase information. In addition to recording the class despriptions also records info about the location from which it loaded the classes bytecode. If you are trying to specify the codebase on the server and removing the stubs from the servers classpath the bytecode will never actually get loaded.

  • Java -Djava.rmi.server.codebase=file:///.....

    Cross posted in the hope that someone using it knows how....
    I am using the following command:
    java -Djava.rmi.server.codebase=file:///home/ben/fyp/build/ -Djava.security.policy=security.policy -cp ./lib/bcprov-jdk15-130.jar:./props:./build com.bensmyth.fyp.example.IssuerServer
    Can I specify -Djava.rmi.server.codebase=file:///home/ben/fyp/build/ without giving the whole path? Can I say ./build?

    I've come back to this issue again (since I am moving code around to different systems again). Using linux I can use -Djava.rmi.server.codebase=file://$PWD/build/
    Presumably there is a similar command in WIndows.

  • Spaces in -Djava.rmi.server.codebase path

    hello,
    how must i format the string containing the codebase for a rmi server if the path to the codebase contains spaces?
    -Djava.rmi.server.codebase=file:c:/path/ and -Djava.rmi.server.codebase=file:/path/ works, but
    -Djava.rmi.server.codebase=file:c:/path with spaces/ doesnt work
    i have tried to put the string in quotes and to replace the spaces with %20 (url encoded)
    but nothing does work.
    how must i format the string?
    cu,
    elmar

    I guess you are using a batch file to start your RMI application.
    Spaces in URLs must be encoded with %20, that is correct.
    The problem is: the command line interpreter on Windows interprets % as a special character and will replace it.
    What worked for me (Windows Vista):
    java -Djava.rmi.server.codebase="file:/C:/Users/FirstName%%20LastName/RMI/" App
    So encode each white space with %%20.
    You can very easily check by inserting the following code at the start of your RMI application. These lets you see how the codebase is set.
    System.out.println(" Codebase: " + System.getProperty("java.rmi.server.codebase"));

  • RMI Server

    Alright guys I am trying to get a Simple RMI example running. I can run the registtry from the command prompt but cannot get the server started.
    My command to run the server and the error are as follows
    C:\Documents and Settings\John\jbproject\simple-rmi\classes>java -Djava.rmi.server.codebase=file:c:\Documents and Settings\John\jbproject\simple-rmi\classes\ -D
    java.security.policy=file:c:\Documents and Settings\John\jbproject\simple-rmi\Si
    mpleRMI.policy simple-rmi.SimpleRMIServer
    Exception in thread "main" java.lang.NoClassDefFoundError
    Any ideas, I am going crazy I have cjecked the paths individually using another command prompt and it is fine. Advice???

    Please check that your program can find all necessary classes. It looks like your application is missing some classes. Check the "visibility" of your classes, their names etc. (public MyClass ..)
    As the error says no class found... if you are using "package"-keyword please check that you are importing right classes from packages.(import packagename.YourClass...)

Maybe you are looking for

  • Why Apple ship macbook with dead pixel??

    I have bought a macbook about two weeks ago... but i notice that one pixel was dead... I phoned to apple costumer care and they sent to me a new macbook, but also this one have a dead pixel!! Angry, i phoned again to the apple costumer care but this

  • Need to compare if a date belongs to a specific Format ...Any pointers ????

    Hi , I have used the parse () method mentioned below , however it does not throw an exception or error when i enter date in an incorrect format (or format not mentioned in simpleDateFormat instance )and accepts any date format . For example , I expec

  • Lost disk space after each reinstall.

    I've had to reinstall leopard on my macbook three times in the last week for different reasons. After each reinstall(erase and install) it appeared that I lost a little more GB to the HDD. I have a 250GB HDD, and I know it actualls reads as 232.87, b

  • I am not able to wi-fi network, i am using router Siemens - Gigaset SE568, can anyone help me!

    I am not able to to connect to wi-fi network, even though I am using the same wi-fi to connect my laptop.  I get the message "unable to connect to network", appreciate your help,

  • Commitment not debited from WBS Element

    Hi NitinP I have done as suggested by you (CJEN & RKANBU01) & gone through other links also. My OKKP settings are CommitMgt Active for project and Comp active) I am creating a PR (ME51N) with Acc.***.'Q'. My WBS status is REL BUDG AUC AVAC. My PR is