Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6592849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:36:29+00:00 2026-05-25T17:36:29+00:00

I obtain a remote reference from an RMI registry; lets call it s .

  • 0

I obtain a remote reference from an RMI registry; lets call it s. Now, s is of (interface) type S which offers a method m(A, B, int).

On the client, I have implementations of A and B which both extend UnicastRemoteObject (and are therefore automatically exported). Consider instances a and b, respectively.

Now I call m(a, b, 0). It compiles, but fails at runtime with the very non-informative

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.m(Unknown Source)
[... application specific sites]

Sadly, NativeMethodAccessorImpl.invoke0 is natively implemented and can not be inspected. So, I am at a total loss. Obviously, types match, otherwise the original code should not compile, right?

What can be reasons for this?

Edit: We use Java 6. The error can be reproduced on Ubuntu 11.04 32bit, Ubuntu 10.10 64bit and Windows 7 32bit.

Edit 2: I implemented some dummy methods on S to test individual parameters. Turns out, s.n(), s.t0(b) and s.t1(0) work as expected; only s.t2(a) fails. This implies that something is wrong with how I implemented A, doesn’t it?

The only striking difference between A and B (aside from actual content, of course) is that A is a class extending UnicastRemoteObject and follows the convention of a remote interface but does not implement a distinguished remote interface. B is a remote interface an implementation of which I pass.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:36:30+00:00Added an answer on May 25, 2026 at 5:36 pm

    Turns out the information provided in my second edit is crucial.

    You can only export/use as remote objects instances of classes that explicitly implement an interface which extends Remote. It is, in particular, not sufficient to have a class extending UnicastRemoteObject—even though that one implements Remote! In that case, everything compiles and exports just fine, but actually passing the object remotely causes the above exception.

    I suppose that creating skeletons/stubs for a remote type for which no remote interface exists somehow fails. There should be a better treatment for that, but well.

    Edit: To clarify: UnicastRemoteObject implements Remote. Now, having something like

    class A extends UnicastRemoteObject { void m() throws RemoteException {} }
    

    is not sufficient, even though A implements Remote indirectly. You will be able to instantiate (i.e. export), but not pass it remotely as an A.

    You need to do

    interface B extends Remote { void n() throws RemoteException; }
    class BImpl extends UnicastRemoteObject implements B { void n() throws RemoteException { ... } }
    

    Instances of BImpl can be passed remotely as B as you would expect. So it appears that you need to implement a distinguished remote interface aside from Remote if you want to have proper remote objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I obtain an array of byte (byte[]) from db and render into a Image
How obtain the running process with absolute path name from ps command 13598 ?
How can you obtain the Type (the name as a string is sufficient) of
currently i obtain the below result from the following C# line of code when
I'm using RMI to allow access to my Java application via MATLAB, which runs
How do you obtain graphic primitives and directives from a Graphics object? Leonid Shifrin
My app allows user to obtain picture/image from camera/photo gallery and then the app
I wrote a very small application, which access the Remote Power Shell of Exchanger
I need to read from NetworkStream which would send data randomly and the size
In a remote site, there is a HTML file (say http://www.example.com/abc.html ), which reads:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.