Link to home
Start Free TrialLog in
Avatar of gonx
gonx

asked on

A Jini and RMI problem: Class is not a valid remote interface

i've been trying to compile stubs for a Jini example i have to run but can't

rmic -d D:\JUSTIN~1\sampledir\EXPERI~1\ch9 -classpath D:\JUSTIN~1\sampledir    EXPERIMENTS.ch9.JINIConnectorImpl

it gives me errors:

EXPERIMENTS.ch9.JINIConnecterImpl is not a valid remote interface: method java.lang.Integer getMBeanCount() must throw java.rmi.Exception

EXPERIMENTS.ch9.JINIConnecterImpl is not a valid remote interface: method javax.management.ObjectInstance createMBean() must throw java.rmi.Exception


Avatar of Mick Barry
Mick Barry
Flag of Australia image

You need to define that those methods throw java.rmi.Exception as stated in error message.
Avatar of gonx
gonx

ASKER

I have a class JINIConnectorException..

package EXPERIMENTS.ch9;

import java.rmi.*;

public class JINIConnectorException extends RemoteException
{
    public Exception exception = null;
    public JINIConnectorException( String message, Exception ex )
    {
        super( message, ex );
        this.exception = ex;
    }
   
    public Exception getWrappedException()
    {
        return exception;
    }
}

it is inherited by this class ..
---------------------------------
package EXPERIMENTS.ch9;
import java.rmi.*;
import javax.management.*;
import EXPERIMENTS.ch9.JINIConnectorException;
public interface JINIConnector extends Remote
{
   
    public Integer getMBeanCount() throws JINIConnectorException;
    public ObjectInstance createMBean(String className,
                                        ObjectName name) throws JINIConnectorException;}
---------------------------------

so in effect my understanding is that the methods still retain their java.rmi.Exception types (sorry im a newbie)
so i don't get why the rmic compiler is giving me the errors.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gonx

ASKER

So i should do away with the subclass JINIConnectorException and just declare

public Integer getMBeanCount() throws RemoteException
public ObjectInstance createMBean(String className,
                                       ObjectName name throws RemoteException;}




I believe so.
Avatar of gonx

ASKER

i got to revise the code but it still gave me errors.. anyway i went back to the site where i got the example. Luckily it had the revised code so its compiling now but with more errors. The rmic has been giving me a javax.management.<class> not found.
gonx:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to objects

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer