Rmic problem!!!

Hi i'm new to rmi. i have a simple rmi program, HelloInterface.java & Hello.java as follows:
HelloInterface.java
import java.rmi.*;
* Remote Interface for the "Hello, world!" example.
public interface HelloInterface extends Remote {
* Remotely invocable method.
* @return the message of the remote object, such as "Hello, world!".
* @exception RemoteException if the remote invocation fails.
public String say() throws RemoteException;
Hello.java
import java.rmi.*;
import java.rmi.server.*;
* Remote Class for the "Hello, world!" example.
public class Hello extends UnicastRemoteObject implements HelloInterface {
private String message;
* Construct a remote object
* @param msg the message of the remote object, such as "Hello, world!".
* @exception RemoteException if the object handle cannot be constructed.
public Hello (String msg) throws RemoteException {
message = msg;
* Implementation of the remotely invocable method.
* @return the message of the remote object, such as "Hello, world!".
* @exception RemoteException if the remote invocation fails.
public String say() throws RemoteException {
return message;
i compiled the HellInterface.java & Hello.java using javac & got the class files. Now when i try running rmic for those, it gives me a set of following errors:
1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11
1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:290)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
any idea or suggestion why i'm getting this error??
i wud appreciate if anyone cud help me on this.
thanx a lot
joe

My files(the java files for remote interface, remote class - HelloInterface.java & Hello.java) are in a directory c:\rmi.
i have a client program & a server too in the same directory(HelloClient.java, HelloServer.java)
I hava compiled the files using the javac and the class files are ready in the same directory(c:\rmi)
Now i try to give the following command to create the stub for the Hello class
C:\rmi>rmic Hello
i get the error.
joe

Similar Messages

  • Rmi Rmic problem

    Hello,
    I've tested out programs on the following links.
    http://www.execpc.com/~gopalan/java/rmiserver.html
    I've haven't got the chance to test out the client side code as I have problem on generating the stub file.
    When I compile the programs just like the author did, I've got an error message. The steps that I used to compile and rmic the programs are as follows:-
    C:\jdk1.4\newTest\StockRMI\SimpleStocks>javac *.java
    C:\jdk1.4\newTest\StockRMI\SimpleStocks>cd..
    C:\jdk1.4\newTest\StockRMI\SimpleStocks>rmic SimpleStocks.StockMarketImpl
    error: Class SimpleStocks.StockMarketImpl not found.
    Do anyone of you know what is worng?
    What did I miss out?
    Thanks in advance.

    Hi,
    Thank you very much for your response.
    I am able to generate the .stub file already.
    But now, I am having other errors.
    The following was what i did when I try out your solution and some errors appear.
    C:\jdk1.4\newTest\StockRMI\SimpleStocks>javac *.java
    C:\jdk1.4\newTest\StockRMI\SimpleStocks>cd..
    C:\jdk1.4\newTest\StockRMI>rmic -classpath ./ SimpleStocks.StockMarketImpl
    C:\jdk1.4\newTest\StockRMI>javac *.java
    StockMarketClient.java:6: package SimpleStocks does not exist
    import SimpleStocks.*;
    ^
    StockMarketServer.java:12: package SimpleStocks does not exist
    import SimpleStocks.*;
    ^
    StockMarketClient.java:15: cannot access StockMarket
    bad class file: c:\jdk1.4\newTest\StockRMI\SimpleStocks\StockMarket.class
    class file contains wrong class: SimpleStocks.StockMarket
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    StockMarket market = (StockMarket)Naming.lookup("rmi://localhost/NASDAQ");
    ^
    3 errors
    C:\jdk1.4\newTest\StockRMI>
    What is wrong this time?
    Can someone please to help me?
    Thank you very much.
    Your help will be apppreciated.

  • RMIC compiling the server to get the stub and skelton problem

    i have this problem
    i'm new to RMI
    and i tried to simulate the same interfaces and class in the RMI java tutorial and when i tried to use rmic to create the stub and skeleton i didnt get any thing
    my RMI server application is called
    c:\samplestep\ServerAPP\ServerEngine.java
    and i complied this java file with
    c:\samplestep\ServerAPP>javac ServerEngine.java and it works well
    i have d:\jdk1.3
    and i have D:\ORANT\jdev(which is Oracle JDeveloper IDE)
    my classpath system variable (windows 2000 professional)
    Looks like this
    D:\jdk1.3\bin;D:\jdk1.3\jre\lib\rt.jar; some other paths;
    c:\samplestep\ServerAPP;
    D:\ORANT\jdk\bin;D:\ORANT\jdk\jre\lib\rt.jar
    and at the command line prompt i wrote
    c:\samplestep\ServerAPP>rmic -d c:\samplestep\ServerAPP -classpath c:\samplestep\ServerAPP\ServerEngine
    and the result was the help associated to the rmic command
    and no stub or skelton class are generated
    could any one help me please(required urgently)
    my email is [email protected]

    Hi Batal,
    Did you follow all the steps required to create a RMIServer and RMI Client.
    Step1: Define an interface(IRMIInterface) that extends Remote
    Step2 : Define a class(RMIServer) that implements extends UnicastRemovetObject and extends IRMIInterface
    Step3 : Compile the IRMIInterface.
    Step4: Compile the RMIServer.
    Step5: Try RMI compile.
    If you have tried all these, just verify whether the class files are there, before you do rmi compile.
    You could have got some errors while compiling, why cant you post them
    LathaDhamo

  • WSAD Generate RMIC ResourceBundle Problem

    Hello Everyone,
    If anyone could answer this, I'd be grateful. This has even IBM people stumped.
    I created a Resource Bundle in the src directory a WSAD project. It's named Messages_en_US.properties. I've tested getting strings from this resource bundle, in an ejb, on Websphere, at runtime and it works fine.
    The problem comes when I want to create a static enum class which references this resource bundle. When I do that and run Generate RMIC, I get the following error in a window:
    com.ibm.etools.rmic.RMICException: RMIC Command returns RC = 1. The problems which stopped RMIC are displayed, and have also been recorded in the log file.
    Then in the log file, I get this exception:
    !MESSAGE java.lang.ExceptionInInitializerError: java.util.MissingResourceException: Can't find bundle for base name com.retek.mdm.app.attribute.service.impl.Messages, locale en_US
         at java.lang.Throwable.<init>(Throwable.java)
         at java.lang.Throwable.<init>(Throwable.java)
         at java.util.MissingResourceException.<init>(MissingResourceException.java:39)
         at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:724)
         at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java)
         at java.util.ResourceBundle.getBundle(ResourceBundle.java:558)
         at com.retek.mdm.domain.attribute.AttributeFormatType.<clinit>(AttributeFormatType.java:33)
         at java.lang.Class.initializeImpl(Native Method)
         at java.lang.Class.initialize(Class.java)
         at java.lang.ClassLoader.resolveClassImpl(Native Method)
         at java.lang.ClassLoader.resolveClass(ClassLoader.java:617)
         at com.ibm.tools.rmic.iiop.DirectoryLoader.loadClass(DirectoryLoader.java:102)
         at com.ibm.tools.rmic.iiop.CompoundType.loadClass(CompoundType.java:348)
         at com.ibm.tools.rmic.iiop.Type.initClass(Type.java:994)
         at com.ibm.tools.rmic.iiop.Type.setRepositoryID(Type.java:1011)
         at com.ibm.tools.rmic.iiop.CompoundType.initialize(CompoundType.java:756)
         at com.ibm.tools.rmic.iiop.ValueType.initialize(ValueType.java:251)
         at com.ibm.tools.rmic.iiop.ValueType.forValue(ValueType.java:111)
         at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1302)
         at com.ibm.tools.rmic.iiop.ValueType.initialize(ValueType.java:240)
         at com.ibm.tools.rmic.iiop.ValueType.forValue(ValueType.java:111)
         at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1302)
         at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:217)
         at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:166)
         at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:85)
         at com.ibm.tools.rmic.iiop.CompoundType.addRemoteInterfaces(CompoundType.java:1434)
         at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:161)
         at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:87)
         at com.ibm.tools.rmic.iiop.StubGenerator.getTopType(StubGenerator.java:143)
         at com.ibm.tools.rmic.iiop.Generator.generate(Generator.java:279)
         at sun.rmi.rmic.Main.doCompile(Main.java:547)
         at sun.rmi.rmic.Main.compile(Main.java:142)
         at java.lang.reflect.AccessibleObject.invokeI(AccessibleObject.java:215)
         at java.lang.reflect.Method.invoke(Method.java:255)
         at com.ibm.etools.rmic.RMICClassLoader.runCompile(RMICClassLoader.java)
         at com.ibm.etools.rmic.RMICOperation.invokeRMICInJVM(RMICOperation.java:466)
         at com.ibm.etools.rmic.RMICOperation.rmic(RMICOperation.java:561)
         at com.ibm.etools.rmic.RMICOperation.generateStubs(RMICOperation.java:206)
         at com.ibm.etools.ejbdeploy.ui.plugin.rmic.UIRMICBeansOperation.generateStubs(UIRMICBeansOperation.java:132)
         at com.ibm.etools.rmic.RMICOperation.run(RMICOperation.java:642)
         at com.ibm.etools.ejbdeploy.ui.plugin.DeployRMICBeansOperation.generateRMICCode(DeployRMICBeansOperation.java:319)
         at com.ibm.etools.ejbdeploy.ui.plugin.DeployRMICBeansOperation.run(DeployRMICBeansOperation.java)
         at org.eclipse.core.internal.resources.Workspace.run(Workspace.java)
         at com.ibm.etools.ejbdeploy.ui.plugin.DeployRunnableWithProgress.run(DeployRunnableWithProgress.java:92)
         at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)
    Apparently, because I created a static variable, RMIC tries to instantiate it, and then it can find it. Any ideas?
    Thanks,
    Tim

    Not sure if this is the answer but...
    Websphere starts it's Web container after it's EJB container. If the class that tries to call that is in the ejb level it might not have read the property file yet because that is in the web level.
    We had this problem and it was traced back to the threading of the start up.

  • Problem about rmic and rmiregistry

    I am new to java!
    My OS is Win2000 and the java compiler I installed is Sun One Studio 4 CE. The teaching book I used is teh JAVA2 unleash.
    I try to copy some example in the book and run it! The problem I have the book didn't quite tell me how to compile it!
    The chapter is about the RMI and the step describe in the book are followed:
    1) Move to the directory containing all your classes and compile them. (Which I did)
    2) Move to the root directory
    c:\>rmic unleashed.ch2.GreeterImpl (problem)
    3) Open one command window and type
    c:\> rmiregistry (problem)
    4) Open another command window and type
    c:\> java unleashed.ch2.GreeterServer
    5) open the thrid window and type
    c:\> java unleashed.ch2.GreetingClient
    Problem part:
    I try to follow the step and open a DOS Prompt and type step two and three!! It seems that the window don't understand the command rmic and rmiregistry! What should I do??
    Thank you very much for helping! Thanks!!
    Ferdinand

    you need to add the java bin directory to your 'path' system environment variable

  • Rmic skeletoton stub creation problem with packages

    Hi,
    I was able run a RMI app without the package but when I try to introduce packaging(mindful of Classpath issues) it gives me the an error. My server directory is called server1 which is located under my home directory.All my server files i.e MHTaskManager.java, MHServices.java and MHServer.java are in the server1 directory. It compiles very well but when I run the following command.
    rmic server1/MHTaskManager from the home directory it comes up with the following errors
    /home/mathu_a/courses/cs775/rmiarc/server1/MHTaskManager_Stub.java:4: '{' expect
    ed.
    public final class server1/MHTaskManager_Stub
    ^
    /home/mathu_a/courses/cs775/rmiarc/server1/MHTaskManager_Skel.java:4: Class serv
    er1 already defined in /home/mathu_a/courses/cs775/rmiarc/server1/MHTaskManager_
    Stub.java.
    public final class server1/MHTaskManager_Skel
    ^
    /home/mathu_a/courses/cs775/rmiarc/server1/MHTaskManager_Skel.java:4: '{' expect
    ed.
    public final class server1/MHTaskManager_Skel
    ^
    /home/mathu_a/courses/cs775/rmiarc/server1/MHTaskManager_Stub.java:4: Public cla
    ss server1 must be defined in a file called "server1.java".
    public final class server1/MHTaskManager_Stub
    ^
    Is there something I am missing as $HOME is already defined.
    -Mathur

    Resolved it myself.
    my mistake, Command had to be
    rmic server1.MHTaskManager instead of rmic server1/MHTaskManager

  • Problems with rmic v1.1

    Hi,
    I have to use the JDK1.1.8, if I compiled the interface and the implementation of the interface everything was fine.
    But when I try to create my stub and skeleton with rmic, I get this message:
    rmic prog
    error: File ./prog.class does not contain type prog as expected, but type my.test.prog.prog. Please remove the
    file, or make sure it appears in the correct subdirectory of the class path.
    error: Class prog not found.
    java.lang.IllegalArgumentException: Argument # > Arg length
    at java.text.MessageFormat.format(Compiled Code)
    at java.text.MessageFormat.format(MessageFormat.java)
    at java.text.MessageFormat.format(MessageFormat.java)
    at sun.rmi.rmic.Main.getText(Main.java:489)
    at sun.rmi.rmic.Main.getText(Main.java:464)
    at sun.rmi.rmic.Main.doCompile(Compiled Code)
    at sun.rmi.rmic.Main.compile(Main.java:107)
    at sun.rmi.rmic.Main.main(Main.java:422)
    ----

    By convention, most java tools expect to find a "packaged" class in a directory hierarchy that relects the packaging. In other words, a class defined like
    com.myco.myapp.ImportantApplication.class
    will be placed under a base directory, in a subordinate directory thus:
    /basedir/com/myco/myapp
    In turn, java tools will find this class if you suppli classpaths such as
    java -classpath basedir/
    Note the trailng slash. This tells java that this is a directory name.
    rmic works the same way.

  • Problem while deploying a stateless Session bean

    hi,
    I am a beginner in J2EE. Please help..
    I have encountered an error while i am deploying a session bean in IBM Webspere App Servere
    the eroor is
    D:\Program Files\WebSphere\AppServer\deploytool\itp>ejbdeploy.bat c:\account\dep
    loy\account.jar c:\account\deploy c:\account\deploy\account-ejb.jar
    Starting workbench.
    Creating the project.
    Validating
    Generating deployment code
    Refreshing: /account.jar/ejbModule.
    Building: /account.jar.
    Invoking RMIC.
    error: Invalid class file format in C:\account\deploy\account.jar(com/fl/ac/Acco
    unt.class). The major.minor version '49.0' is too recent for this tool to under
    stand.
    error: Class com.fl.ac.Account not found in class com.fl.ac.EJSRemoteStatelessAc
    countEJB_ca490e54.
    error: Invalid class file format in C:\account\deploy\account.jar(com/fl/ac/Acco
    untHome.class). The major.minor version '49.0' is too recent for this tool to u
    nderstand.
    error: Class com.fl.ac.AccountHome not found in class com.fl.ac.EJSRemoteStatele
    ssAccountEJBHome_ca490e54.
    4 errors
    [*Error] An unexpected exception was thrown. Halting execution.
    Shutting down workbench.
    Error generating RMI code: RMIC Command returns RC = 1. The problems which stopp
    ed RMIC are displayed, and have also been recorded in the .log file in c:\accoun
    t\deploy\account-ejb._\.metadata.
    RMIC command was:
    -extdirs D:\Program Files\WebSphere\AppServer\java\jre\lib\core.jar;D:\Program F
    iles\WebSphere\AppServer\java\jre\lib\graphics.jar;D:\Program Files\WebSphere\Ap
    pServer\java\jre\lib\security.jar;D:\Program Files\WebSphere\AppServer\java\jre\
    lib\server.jar;D:\Program Files\WebSphere\AppServer\java\jre\lib\xml.jar;D:\Prog
    ram Files\WebSphere\AppServer\java\jre\lib\charsets.jar;D:\Program Files\WebSphe
    re\AppServer\java\jre\lib\ext;D:\Program Files\WebSphere\AppServer\java\lib;D:\P
    rogram Files\WebSphere\AppServer\classes;D:\Program Files\WebSphere\AppServer\li
    b;D:\Program Files\WebSphere\AppServer\lib\ext;D:\Program Files\WebSphere\AppSer
    ver\web\help;D:\Program Files\WebSphere\AppServer\deploytool\itp\plugins\com.ibm
    .etools.ejbdeploy\runtime;D:\Program Files\ibm\WebSphere MQ\Java\lib; -classpath
    c:\account\deploy\account-ejb._\account.jar\ejbModule;C:\account\deploy\account
    .jar -iiop -always -keep -d c:\account\deploy\account-ejb._\account.jar\ejbModul
    e -sourcepath c:\account\deploy\account-ejb._\account.jar\ejbModule com.fl.ac.EJ
    SRemoteStatelessAccountEJBHome_ca490e54 com.fl.ac.EJSRemoteStatelessAccountEJB_c
    a490e54
    BEAN SOURCE CODE IS
    ------------------Remote Interface -------------------------------
    package com.fl.ac;
    import java.rmi.*;
    import javax.ejb.*;
    public interface Account extends EJBObject     {
         public double withdraw(double balance,double amount) throws RemoteException;
         public double deposite(double balance,double amount) throws RemoteException;
    ------------------------ Home Interface -----------------------------------
    package com.fl.ac;
    import java.rmi.*;
    import javax.ejb.*;
    public interface AccountHome extends EJBHome     {
         public Account create() throws CreateException,RemoteException;
    ------------------------- Bean Class -----------------------------------------------
    package com.fl.ac;
    import java.rmi.*;
    import javax.ejb.*;
    public class AccountEJB implements SessionBean     {
         public void setSessionContext(SessionContext ctx)     {     }
         public void unsetSessionContext()     {     }
         public void ejbCreate()     {     }
         public void ejbActivate()     {     }
         public void ejbPassivate()     {     }
         public void ejbRemove()     {     }
         public double withdraw(double balance,double amount){
              return (balance - amount);
         public double deposite(double balance,double amount){
              return (balance+amount);
    ------------------------------ ejb-jar.xml --------------------------------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar id="ejb-jar_ID">
    <display-name>Account EJB</display-name>
    <enterprise-beans>
    <session>
    <ejb-name>AccountEJB</ejb-name>
    <home>com.fl.ac.AccountHome</home>
    <remote>com.fl.ac.Account</remote>
    <ejb-class>com.fl.ac.AccountEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    PLZ HELP ME......
    francis

    Hi Gauarv,
    Did you not see my reply in the following post?
    Re: 502 service temporarily unavailable
    If I'm not mistaken, this is exactly the same question as you asked
    there.
    By the way, is there some reason you are still using OC4J version
    1.0.2.2? Is there something stopping you from upgrading to the later
    versions (9.0.2 and 9.0.3)?
    Good Luck,
    Avi.

  • Please help with an RMI problem

    Hi,
    This is probably a really simple problem which i can't spot, but i have the folloing 'HelloWorld' RMI program:
    The Client Program:
    import java.rmi.*;
    public class HelloClient {
         public static void main(String args[]) {
              if(System.getSecurityManager() == null) {
                   System.setSecurityManager(new RMISecurityManager());
              try {
                   HelloInterface obj = (HelloInterface)Naming.lookup("/HelloServer");
                   String message = obj.sayHello();
                   System.out.println(message);
                   Thread.sleep(10000);
              } catch (Exception e) {
                   System.out.println("HelloClient exception: " + e);
    }The Remote Interface:
    public interface HelloInterface extends java.rmi.Remote {
         public String sayHello() throws java.rmi.RemoteException;
    }The Server Program:
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.util.Date;
    public class HelloServer extends UnicastRemoteObject implements HelloInterface {
         public HelloServer() throws RemoteException {
              super();
         public String sayHello() throws RemoteException {
              return "Hello World, the current system time is " + new Date();
    }And finally the class which binds the object to the registery:
    import java.rmi.*;
    public class RegisterIt {
         public static void main(String args[]) {
              try {
                   HelloServer obj = new HelloServer();
                   System.out.println("Object instantiated: " + obj);
                   Naming.rebind("/HelloServer", obj);
                   System.out.println("HelloServer bound to registery");
              } catch (Exception e) {
                   System.out.println(e);
    }Now, this program works fine on my computer at home(XP!!!!!) but when i try to run it on the computers in college which run NT, it comes up with the following exceptions when i try to run RegisterIt:
    Java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    Java.lang.ClassNotFoundException: HelloServer_StubThis is saying that it cannot find the stub which is generated, but i use the folloing .bat file to load up the program:
    echo Creating remote object skelton classes....
    rmic -d . HelloServer
    start rmiregistry -J-Djava.security.policy=test.policy
    start java RegisterIt
    start java -Djava.security.policy=test.policy HelloClientThe stub is definitely created(it worked at home and i have checked in the directory and there are clearly the files HelloServer_Stub.class and HelloServer_Skel.class). The PATH is set correctly otherwise the registery would not be able to run correctly etc and therefore i am completely stuck as to why it doesn't work.
    Please help as it is very important for me.
    Many Thanks
    Cath

    I did not have any problem with Windows 2000 at all but only with Windows XP (and to think XP is a 2000 hybrid!).
    I have the same error: a ClassNotFoundException on the stub file.
    Any help will be appreciated. Thanks.

  • Why cann't rmic find the class?

    I have write some RMI Code,and I could compile them correctly,but when I wanted to generate Stub and Skel by rmic ,it showed me that:
    E:\JavaPro\CH21-05>rmic RmiTestServer
    error: Class RmiTestServer not found.
    1 error
    I don't know why?
    Here the source which helps to understand the problem:
    //Code in RmiTest.java
    import java.rmi.*;
    public interface RmiTest extends java.rmi.Remote
         //Definate an interface from java.rmi.Remote
         public float getRmiTest(int r) throws RemoteException;
    //Code in RmiTestServer.java
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    import java.lang.Math;
    public class RmiTestServer extends UnicastRemoteObject implements RmiTest
         //load the constructor of UnicastRemoteObject
         RmiTestServer()throws RemoteException
              super();
         //The client will send the parameters to here,and calculate,and get the results back
         public float getRmiTest(int r)throws RemoteException
              float circlerate=(float)(2*Math.PI*r);
              return circlerate;
         public static void main(String args[])
              try
                   Naming.rebind("//127.0.0.1:1099/RmiTestObj",new RmiTestServer());
                   System.out.println("RMI Connecting...");
              catch(Exception e)
                   System.out.println("RMI can't connect... :"+e);
                   System.exit(-1);
    //Code in RmiTestClient.java
    import java.awt.*;
    import java.rmi.*;
    public class RmiTestClient
         public static void main(String args[])
              float circlerate=(float)0.0;
              try
                   //Set security manager according to security mechanism
                   System.setSecurityManager(new RMISecurityManager());
                   //Query remote object,and it's host address is 127.0.0.1 ,and it's port is 1099
                   //RmiTestObj is a byname of RMI logging on
                   RmiTest obj=(RmiTest)Naming.lookup("//127.0.0.1:1099/RmiTestObj");
                   //method to load remote object
                   circlerate=obj.getRmiTest(5);
                   //print the result
                   System.out.println("Total circlerate is : "+circlerate);
              catch(Exception e)
                   System.out.println(e.getMessage());
    How can I solve this problem?

    I made it by runing the following command line:
    rmic -classpath E:\JavaPro\CH21-05 RmiTestServer
    and it created two files: RmiTestServer_Skel.class and RmiTestServer_Stub.class
    Thank you very much!
    --Steven                                                                                                                                                                                                                                                                                                                                                                                                                               

  • RMI Problem with rebind()

    created files as below. All compiled successfully.
    ran <rmic -v1.1 -d %cp% -classpath %cp% server.TempServerImpl> from command window.
    this generated a stub file called TempServerImpl_Stub.class
    I launched the rmiRegistry
    To make the remote object available to recieve mathod calls from clients I run TempServerImpl.class
    But ..... when I run TempServerImpl I get the exception "java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: "
    AND..... my stub class is deleted without any warning!!!
    if I comment out the line "Naming.rebind( serverObjectName, tempServer );" after I generate the stub class then TempServerImpl runs without throwing any exception but this must be included to bind my remote server object to the RMI registry.
    Any ideas what Im missing?
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.net.URL;
    import java.rmi.Remote;
    import java.rmi.Naming;
    public class TempServerImpl extends UnicastRemoteObject implements TempServer{
       public TempServerImpl() throws RemoteException {
          super();
       public Info getInfo() throws RemoteException{
          return new Info("some temperature data returned");
       public static void main( String args [] ) throws Exception{
          TempServerImpl tempServer = new TempServerImpl();
          String serverObjectName = "//localhost/TempServer";
          Naming.rebind( serverObjectName, tempServer );
    //************ Remote Interface
    import java.rmi.*;
    import java.rmi.RemoteException;
    public interface TempServer extends Remote {
      public Info getInfo() throws RemoteException;
    import java.io.Serializable;
    public class Info implements Serializable{
       private String data;
       public Info(String data){
          this.data = data;
       public String toString(){
          return this.data;
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Are you sure that the stub is being deleted, or is it just that the exception message says it can't be found. If it's the latter it might be that the stub is not in the class path of either the commandline running the rmi registry or the commandline running the TempServerImpl. However as you are running this i assume it ok.
    The code looks fine, The problem is something to do with classpaths ect.

  • Service Pack 3 Problem (maybe host2ior)

    Hello,
    I use RMI over IIOP from C++, the client(Client.exe), and It is accessing to
    RMI object.
    When Servcie Pack 3 was applied, Client.exe stopped in
    'NamingContext::resolve()'. And couldn't get RMI Object.
    Length was wrong when it was compared with IOR of Service Pack 2.
    Get IOR under JDK1.3 and Service Pack 3 and run WebLogic Server with Service
    Pack 3 failed.
    Get IOR unser JDK1.3 and Service Pack 2 and run WebLogic Server with Service
    Pack 3 failed. Though it was natural because the format of IOR was wrong.
    Get IOR under JDK1.3 and Service Pack 3 and run WebLogic Server with Service
    Pack 2 failed.
    Get IOR under JDK1.3 and Service Pack 2 and run WebLogic Server with Service
    Pack 2 only successed.
    Is this the problem of ServicePack?
    When new ServicePack release if this is a bug?
    Thanks.

    And.....
    7.utils.host2ior
    8.run *.exe
    "watuki" <[email protected]> wrote in message
    news:8hr4sa$8hp$[email protected]..
    Yes. I did all process under Service Pack 3 from beginning.
    1.Create Server Srouce(RMI)
    2.javac
    3.weblogic.rmic
    4.idl2cpp
    5.Create Client Source(C++)
    6.cl
    "Eduardo Ceballos" <[email protected]> wrote in message
    news:[email protected]..
    Under service pack 3, you need to regenerate the string representation
    of
    the ior for the naming service. Did you do that?
    watuki wrote:
    Hello,
    I use RMI over IIOP from C++, the client(Client.exe), and It is
    accessing to
    RMI object.
    When Servcie Pack 3 was applied, Client.exe stopped in
    'NamingContext::resolve()'. And couldn't get RMI Object.
    Length was wrong when it was compared with IOR of Service Pack 2.
    Get IOR under JDK1.3 and Service Pack 3 and run WebLogic Server withService
    Pack 3 failed.
    Get IOR unser JDK1.3 and Service Pack 2 and run WebLogic Server withService
    Pack 3 failed. Though it was natural because the format of IOR waswrong.
    Get IOR under JDK1.3 and Service Pack 3 and run WebLogic Server withService
    Pack 2 failed.
    Get IOR under JDK1.3 and Service Pack 2 and run WebLogic Server withService
    Pack 2 only successed.
    Is this the problem of ServicePack?
    When new ServicePack release if this is a bug?
    Thanks.

  • Problem using CORBA clients with RMI/EJB servers..!!!???

    Hi,
    I have a question on using EJB / or RMI servers with CORBA clients using
    RMI-IIOP transport, which in theory should work, but in practice has few
    glitches.
    Basically, I have implemented a very simple server, StockTreader, which
    looks up for a symbol and returns a 'Stock' object. In the first example, I
    simplified the 'Stock' object to be a mere java.lang.String, so that lookup
    would simply return the 'synbol'.
    Then I have implemented the above, as an RMI-IIOP server (case 1) and a
    CORBA server (case 2) with respective clients, and the pair of
    client-servers work fine as long as they are CORBA-to-CORBA and RMI-to-RMI.
    But the problem arises when I tried using the RMI server (via IIOP) with the
    CORBA client, when the client tries to narrow the object ref obtained from
    the naming service into the CORBA idl defined type (StockTrader) it ends up
    with a class cast exception.
    This is what I did to achieve the above results:
    [1] Define an RMI interface StockTrader.java (extending java.rmi.Remote)
    with the method,
    public String lookup( String symbol) throws RMIException;
    [2] Implement the StorckTrader interface (on a PortableRemoteObject derived
    class, to make it IIOP compliant), and then the server to register the stock
    trader with COS Naming service as follows:
    String homeName =....
    StockTraderImpl trader =new StockTraderImpl();
    System.out.println("binding obj <" homeName ">...");
    java.util.Hashtable ht =new java.util.Hashtable();
    ht.put("java.naming.factory.initial", args[2]);
    ht.put("java.naming.provider.url", args[3]);
    Context ctx =new InitialContext(ht);
    ctx.rebind(homeName, trader);
    [3] Generate the RMI-IIOP skeletons for the Implementation class,
    rmic -iiop stock.StockTraderImpl
    [4] generate the IDL for the RMI interface,
    rmic -idl stock.StockTraderImpl
    [5] Generate IDL stubs for the CORBA client,
    idlj -v -fclient -emitAll StockTraderImpl.idl
    [6] Write the client to use the IDL-defined stock trader,
    String serverName =args[0];
    String symList =args[1];
    StockClient client =new StockClient();
    System.out.println("init orb...");
    ORB orb =ORB.init(args, null);
    System.out.println("resolve init name service...");
    org.omg.CORBA.Object objRef
    =orb.resolve_initial_references("NameService");
    NamingContext naming =NamingContextHelper.narrow(objRef);
    ... define a naming component etc...
    org.omg.CORBA.Object obj =naming.resolve(...);
    System.out.println("narrow objRef: " obj.getClass() ": " +obj);
    StockTrader trader =StockTraderHelper.narrow(obj);
    [7] Compile all the classes using Java 1.2.2
    [8] start tnameserv (naming service), then the server to register the RMI
    server obj
    [9] Run the CORBA client, passing it the COSNaming service ref name (with
    which the server obj is registered)
    The CORBA client successfully finds the server obj ref in the naming
    service, the operation StockTraderHelper.narrow() fails in the segment
    below, with a class cast exception:
    org.omg.CORBA.Object obj =naming.resolve(...);
    StockTrader trader =StockTraderHelper.narrow(obj);
    The <obj> returned by naming service turns out to be of the type;
    class com.sun.rmi.iiop.CDRInputStream$1
    This is of the same type when stock trader object is registered in a CORBA
    server (as opposed to an RMI server), but works correctly with no casting
    excpetions..
    Any ideas / hints very welcome.
    thanks in advance,
    -hari

    On the contrary... all that is being said is that we needed to provide clearer examples/documentation in the 5.1.0 release. There will be no difference between the product as found in the service pack and the product found in the 5.1.1. That is, the only substantive will be that 5.1.1 will also
    include the examples.
    "<=one way=>" wrote:
    With reference to your and other messages, it appears that one should not
    expect that WLS RMI-IIOP will work in a complex real-life system, at least
    not now. In other words, support for real-life CORBA clients is not an
    option in the current release of WLS.
    TIA
    "Eduardo Ceballos" <[email protected]> wrote in message
    news:[email protected]...
    We currently publish an IDL example, even though the IDL programmingmodel in Java is completely non-functional, in anticipation of the support
    needs for uses who need to use IDL to talk to the Weblogic server,
    generically. This example illustrates the simplest connectivity; it does not
    address how
    to integrate CORBA and EJB, a broad topic, fraught with peril, imo. I'llnote in passing that, to my knowledge, none of the other vendors attempt
    this topic either, a point which is telling if all the less happy to hear.
    For the record then, what is missing from our distribution wrt RMI-IIOPare a RMI-IIOP example, an EJB-IIOP example, an EJB-C++. In this you are
    correct; better examples are forth coming.
    Still, I would not call our RMI-IIOP implementation fragile. I would saythat customers have an understandably hard time accepting that the IDL
    programming model is busted; busted in the sense that there are no C++
    libraries to support the EJB model, and busted in the sense that there is
    simply no
    support in Java for an IDL interface to an EJB. Weblogic has nothing to doit being busted, although we are trying to help our customers deal with it
    in productive ways.
    For the moment, what there is is a RMI (over IIOP) programming model, aninherently Java to Java programming model, and true to that, we accept and
    dispatch IIOP request into RMI server objects. The way I look at it is this:
    it's just a protocol, like HTTP, or JRMP; it's not IDL and it has
    practically nothing to do with CORBA.
    ST wrote:
    Eduardo,
    Can you give us more details about the comment below:
    I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult ot
    use an idl client in java to work.It seems to me that Weblogic's RMI-IIOP is a very fragile
    implementation. We
    don't need a "HelloWorld" example, we need a concrete serious example(fully
    tested and seriously documented) that works so that we can get a betteridea
    on how to integrate CORBA and EJB.
    Thanks,
    Said
    "Eduardo Ceballos" <[email protected]> wrote in message
    news:[email protected]...
    Please post request to the news group...
    As I said, you must separate the idl related classes (class files and
    java
    files) from the rmi classes... in the rmic step, you must set a newtarget
    (as you did), emit the java files into that directory (it's not clearyou
    did this), then remove all the rmi class files from the class path... ifyou
    need to compile more classes at that point, copy the java files to theidl
    directly is you must, but you can not share the types in any way.
    I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult otuse
    an idl client in java to work.
    Harindra Rajapakshe wrote:
    Hi Eduardo,
    Thanks for the help. That is the way I compiled my CORBA client, by
    separating the IDL-generated stubs from the RMI ones, but still I
    get a
    CORBA.BAD_PARAM upon narrowing the client proxy to the interfacetype.
    Here's what I did;
    + Define the RMI interfaces, in this case a StockTrader interface.
    + Implement RMI interface by extendingjavax.rmi.PortableRemoteObject
    making
    it IIOP compliant
    + Implemnnt an RMI server, and compile using JDK1.2.2
    + use the RMI implementation to generate CORBA idl, using RMI-IIOPplugin
    utility rmic;
    rmic -idl -noValueMethods -always -d idl stock.StockTraderImpl
    + generate Java mappings to the IDL generated above, using RMI-IIOPplugin
    util,
    idlj -v -fclient -emitAll -tf src stocks\StockTrader.idl
    This creates source for the package stock and also
    org.omg.CORBA.*
    package, presumably IIOP type marshalling
    + compile all classes generated above using JDK1.2.2
    + Implement client (CORBA) using the classes generated above, NOTthe
    RMI
    proxies.
    + start RMI server, with stockTrader server obj
    + start tnameserv
    + start CORBA client
    Then the client errors when trying to narrow the obj ref from the
    naming
    service, into the CORBA IDL defined interface using,
    org.omg.CORBA.Object obj =naming.resolve(nn);
    StockTrader trader =StockTraderHelper.narrow(obj); // THIS
    ERRORS..!!!
    throwing a CORBA.BAD_PARAM exception.
    any ideas..?
    Thanks in advance,
    -hari
    ----- Original Message -----
    From: Eduardo Ceballos <[email protected]>
    Newsgroups: weblogic.developer.interest.rmi-iiop
    To: Hari Rajapakshe <[email protected]>
    Sent: Wednesday, July 26, 2000 4:38 AM
    Subject: Re: problem using CORBA clients with RMI/EJBservers..!!!???
    Please see the post on june 26, re Errors compiling... somewherein
    there,
    I suspect, you are referring to the rmi class file when you are
    obliged
    to
    completely segregate these from the idl class files.
    Hari Rajapakshe wrote:
    Hi,
    I have a question on using EJB / or RMI servers with CORBA
    clients
    using
    RMI-IIOP transport, which in theory should work, but in practice
    has
    few
    glitches.
    Basically, I have implemented a very simple server,
    StockTreader,
    which
    looks up for a symbol and returns a 'Stock' object. In the firstexample, I
    simplified the 'Stock' object to be a mere java.lang.String, so
    that
    lookup
    would simply return the 'synbol'.
    Then I have implemented the above, as an RMI-IIOP server (case
    1)
    and a
    CORBA server (case 2) with respective clients, and the pair of
    client-servers work fine as long as they are CORBA-to-CORBA andRMI-to-RMI.
    But the problem arises when I tried using the RMI server (via
    IIOP)
    with
    the
    CORBA client, when the client tries to narrow the object ref
    obtained
    from
    the naming service into the CORBA idl defined type (StockTrader)
    it
    ends
    up
    with a class cast exception.
    This is what I did to achieve the above results:
    [1] Define an RMI interface StockTrader.java (extending
    java.rmi.Remote)
    with the method,
    public String lookup( String symbol) throws RMIException;
    [2] Implement the StorckTrader interface (on a
    PortableRemoteObject
    derived
    class, to make it IIOP compliant), and then the server to
    register
    the
    stock
    trader with COS Naming service as follows:
    String homeName =....
    StockTraderImpl trader =new StockTraderImpl();
    System.out.println("binding obj <" homeName ">...");
    java.util.Hashtable ht =new java.util.Hashtable();
    ht.put("java.naming.factory.initial", args[2]);
    ht.put("java.naming.provider.url", args[3]);
    Context ctx =new InitialContext(ht);
    ctx.rebind(homeName, trader);
    [3] Generate the RMI-IIOP skeletons for the Implementation
    class,
    rmic -iiop stock.StockTraderImpl
    [4] generate the IDL for the RMI interface,
    rmic -idl stock.StockTraderImpl
    [5] Generate IDL stubs for the CORBA client,
    idlj -v -fclient -emitAll StockTraderImpl.idl
    [6] Write the client to use the IDL-defined stock trader,
    String serverName =args[0];
    String symList =args[1];
    StockClient client =new StockClient();
    System.out.println("init orb...");
    ORB orb =ORB.init(args, null);
    System.out.println("resolve init name service...");
    org.omg.CORBA.Object objRef
    =orb.resolve_initial_references("NameService");
    NamingContext naming=NamingContextHelper.narrow(objRef);
    ... define a naming component etc...
    org.omg.CORBA.Object obj =naming.resolve(...);
    System.out.println("narrow objRef: " obj.getClass() ":"
    +obj);
    StockTrader trader =StockTraderHelper.narrow(obj);
    [7] Compile all the classes using Java 1.2.2
    [8] start tnameserv (naming service), then the server to
    register
    the
    RMI
    server obj
    [9] Run the CORBA client, passing it the COSNaming service ref
    name
    (with
    which the server obj is registered)
    The CORBA client successfully finds the server obj ref in the
    naming
    service, the operation StockTraderHelper.narrow() fails in thesegment
    below, with a class cast exception:
    org.omg.CORBA.Object obj =naming.resolve(...);
    StockTrader trader =StockTraderHelper.narrow(obj);
    The <obj> returned by naming service turns out to be of the
    type;
    class com.sun.rmi.iiop.CDRInputStream$1
    This is of the same type when stock trader object is registeredin a
    CORBA
    server (as opposed to an RMI server), but works correctly with
    no
    casting
    excpetions..
    Any ideas / hints very welcome.
    thanks in advance,
    -hari

  • Rmic error on appserver 9.0

    hi,
    i just tried to generate an idl for my EJB 2.1 using rmic utility but gives me an error using the sdk bundled with the appserver 9.0;
    Class javax.ejb.EJBObject not found in interface ...
    Class javax.ejb.EJBObject not found
    Class javax.ejb.EJBHome not found in interface  ...
    Class javax.ejb.EJBHomei was able to deploy my ejb successfully but gives me an rmic error. please help. i tried the rmic from sdk with appserver 8.2 and it works fine. thanks.
    regards,
    andrew

    Hi
    We are having the same problem.
    The workaround is to increase your permgen from the default to a higher value. We use 256MB, which gives us about 9 deploy cycles before needing a domain restart.
    <jvm-options>-XX:MaxPermSize=256m</jvm-options>

  • A classpath problem?

    Hi
    I've been following two different tutorials on RMI, but seem to get stuck at the same point with both. When I'm trying to do rmic on the implementation-classes it complains that the java.rmi.server.UnicastRemoteObject class can't be found... I've tried setting the classpath to both c:\myjavahome\lib, c:\myjavahome\jre\lib and lots of other paths without any success. (I'm running Windows XP by the way).
    If anyone have a clue to what's causing my problem, please tell me...
    Is there any spesific *.jar file I have to include in the classpath? The java.rmi package should be part of the j2sdk core, right? Or is there some additional extensions I need to acquire?
    Regards tores

    You do need the <java home> in the -classpath, see below
    http://forum.java.sun.com/thread.jsp?forum=58&thread=555245&tstart=0&trange=15

Maybe you are looking for

  • Thickbox image gallery not working.

    HI guys, Im creating an image gallery using the 'thickbox' widget. When I preview my page on a browser, and click the thumbnail image, nothing happens. It just loads the thickbox preloader bar, nothing else! I've followed online tutorials by the book

  • TS2771 How do I get rid of a movie that I dont have?

    iTunes keeps trying to download a movie but it has alreaady expired and now its not visible on my device but it is still taking up 3gigs of space!!!

  • SSD suddenly stopped working

    Hello everybody. I do have a very strange problem with my SSD (Samsung 840 EVO 250GB). A longe time ago, almost a year I replaced my SuperDrive with an OpticalBay. Bought a new SSD. I put the SSD in the original drive place and placed the HDD drive i

  • Problems Trying to Save as a Word Document.

    The primary reason I purchased Pages was for it's proclaimed ability to open Word documents, edit them, and resave them as Word documents.  I've managed to open my Word document and edit it, but the only option I have is "Save Version" when trying to

  • New event appears on launch

    Every time I launch iCal, an empty event appears on my calendar with a start time that is the same as the time that I launched iCal. There's no info in the information pane other than the start and end times (which are the same as each as and the sam