• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin


Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to call a server method from the client, and pass it a client object. The problem is that, when sending the object, it has to be an interface. So rather than sending type "Client" i would send type "ClientInterface". Now, on the server side, I try to cast the type ClientInterface back to Client and it doesnt work.

If i dont try casting it back, i get the following exception:

java.lang.IllegalArgumentException: argument type mismatch

Whats the problem?
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Dawud K." -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name.

You can change your user name here.

There should be no need to cast your "ClientInterface" object to a "Client" if the interface/implementation is designed correctly.

Getting an IllegalArgumentException is certainly a strange error to be getting for this, too... is it possible to post the code around where this error is being thrown?

Thanks! and welcome to the JavaRanch!
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic