RMI Error Under Eclipse, Not Command Line

Discussion in 'Java' started by Dale, Jul 7, 2004.

  1. Dale

    Dale Guest

    I should probably think more about this before posting, but I need to
    leave this task now.... maybe someone has hit this one before and
    can assist?

    I've got an RMI client class that works perfectly well from the
    command line:

    cd workspace\rmiproj
    set classpath=.
    java rmiproggy.java

    (at this point the application comes up, and calls another machine
    using that SQLOrdersImpl_Stub object).

    But when I run this same thing from within Eclipse, I get this:

    java.rmi.UnmarshalException: error unmarshalling return; nested
    exception is:
    java.lang.ClassNotFoundException: SQLOrdersImpl_Stub (no security
    manager: RMI class loader disabled)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Unknown Source)
    at OrderThread.run(OrderThread.java:32)
    Caused by: java.lang.ClassNotFoundException: SQLOrdersImpl_Stub (no
    security manager: RMI class loader disabled)
    at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
    at java.io_ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io_ObjectInputStream.readClassDesc(Unknown Source)
    at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io_ObjectInputStream.readObject0(Unknown Source)
    at java.io_ObjectInputStream.readObject(Unknown Source)
    ... 3 more

    It's failing on the following line:
    orders = (SQLOrders) Naming.lookup(serviceName);

    Again, same exact code running from the command line works perfectly.
    WTH??

    --Dale--
    Dale, Jul 7, 2004
    #1
    1. Advertising

  2. Dale

    iksrazal Guest

    (Dale) wrote in message news:<>...
    > I should probably think more about this before posting, but I need to
    > leave this task now.... maybe someone has hit this one before and
    > can assist?
    >
    > I've got an RMI client class that works perfectly well from the
    > command line:
    >
    > cd workspace\rmiproj
    > set classpath=.
    > java rmiproggy.java
    >
    > (at this point the application comes up, and calls another machine
    > using that SQLOrdersImpl_Stub object).
    >
    > But when I run this same thing from within Eclipse, I get this:
    >
    > java.rmi.UnmarshalException: error unmarshalling return; nested
    > exception is:


    A fail-proof solution that will work everywhere - command line, linux,
    ms and the gui's like eclipse - is to use ant:

    To build:

    <target name="rmi_compile" depends="prepare-src">
    <echo message="Compiling dhl"/>

    <javac
    srcdir="${build.src.java}"
    destdir="${build.dest.classes}"
    deprecation="true"
    failonerror="true" debug="true"
    >


    <include name="dhl/**/*.java"/>
    <classpath refid="build.classpath" />
    </javac>

    <rmic classname="com.pegasus.user.AccessControlServer"
    base="${build.dest.classes}"/>

    </target>

    to run:

    <target name="run_rmi"
    description="Launch the Login Client">
    <java classname="com.pegasus.user.ui.LoginFrame" fork="yes" >
    <classpath refid="run.classpath" />
    <sysproperty key="pegasus.configdir"
    value="${pegasus.dir}" />
    <sysproperty key="java.rmi.server.hostname"
    value="10.10.10.10:1099" />
    <sysproperty key="java.security.policy"
    value="policy.txt" />
    </java>
    </target>

    HTH

    Outsource to an American programmer living in brazil!
    http://www.braziloutsource.com/
    iksrazal
    iksrazal, Jul 8, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jayshao
    Replies:
    1
    Views:
    3,234
  2. Buu Nguyen

    RMI, JINI or RMI/IIOP

    Buu Nguyen, Aug 25, 2004, in forum: Java
    Replies:
    1
    Views:
    553
    Sudsy
    Aug 25, 2004
  3. JScoobyCed

    RMI Vs RMI over IIOP

    JScoobyCed, Jan 28, 2005, in forum: Java
    Replies:
    1
    Views:
    725
    Dag Sunde
    Jan 28, 2005
  4. Jan Schulze
    Replies:
    1
    Views:
    562
    Esmond Pitt
    Mar 26, 2005
  5. Edward V. Berard
    Replies:
    4
    Views:
    898
    John B. Matthews
    Apr 4, 2006
Loading...

Share This Page