• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

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


0
gonx
Asked:
gonx
1 Solution
 
objectsCommented:
You need to define that those methods throw java.rmi.Exception as stated in error message.
0
 
gonxAuthor Commented:
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.
0
 
objectsCommented:
I don't think it really makes sense to declare throwing a subclass of RemoteException, as the throwing of the RemoteException is not done from your code and is intended for problems with RMI comms.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
gonxAuthor Commented:
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;}




0
 
objectsCommented:
I believe so.
0
 
gonxAuthor Commented:
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.
0
 
CleanupPingCommented:
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.
0
 
girionisCommented:
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
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now