File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes long[] class cast exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "long[] class cast exception" Watch "long[] class cast exception" New topic

long[] class cast exception

Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 116

I have a webservice deployed on JBoss EAP 6.1

this produces the following wsdl:

For a client I have generated classes with wsimport
Among which is:

First of all I am a bit surprised that
public List<Long> getAllIds();
has been generated instead of returning long[]

Then when I run

I get on the client side

on the server side

Any ideas how to solve this would be greatly appreciated
E Armitage

Joined: Mar 17, 2012
Posts: 989
It looks like this line is the problem

The call is returning an Object[] and you are trying to cast that into a long[] which is not allowed by Java rules

To make the values get copied to a Long[] you can use
and they would need to all be longs. Note also that you get a Long[] from that not a long[].
Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 116
Grate, Yes this was the problem.

Many Thanks
I agree. Here's the link:
subject: long[] class cast exception
jQuery in Action, 3rd edition