You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by dmsilva <da...@gmail.com> on 2011/11/02 20:07:46 UTC

Dynamic client- issue when trying to instantiate a list of objects

Hi,
In the client code, when I trying to instantiate a list of objects I get
this error: 
<code>Exception in thread "main" java.lang.InstantiationException:
[Lcom.demo.order.server.Order;</code>

this is my client code: 
<code> // Get the input class Order
		Class<?> orderClass = partInfo.getTypeClass();
		System.out.println(orderClass.getName());
		Object orderObject = orderClass.newInstance();
</code>

webservice: <code>
@WebService
public interface OrderProcess {
    String processOrder(ArrayList<Order> order);
</code>


some help?

thaks..

--
View this message in context: http://cxf.547215.n5.nabble.com/Dynamic-client-issue-when-trying-to-instantiate-a-list-of-objects-tp4959032p4959032.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Dynamic client- issue when trying to instantiate a list of objects

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday, November 02, 2011 12:07:46 PM dmsilva wrote:
> Hi,
> In the client code, when I trying to instantiate a list of objects I get
> this error:
> <code>Exception in thread "main" java.lang.InstantiationException:
> [Lcom.demo.order.server.Order;</code>
> 
> this is my client code:
> <code> // Get the input class Order
> 		Class<?> orderClass = partInfo.getTypeClass();
> 		System.out.println(orderClass.getName());
> 		Object orderObject = orderClass.newInstance();
> </code>
> 
> webservice: <code>
> @WebService
> public interface OrderProcess {
>     String processOrder(ArrayList<Order> order);
> </code>
> 
> some help?

Internally, we map the Lists to arrays.    That said, even if we didn't, it 
would just get mapped to a "List" which is an interface and thus also couldn't 
call orderClass.newInstance() on it.   

In anycase, you'll need to special case the arrays.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: Dynamic client- issue when trying to instantiate a list of objects

Posted by Olivier Costet <Ol...@zenprise.com>.
> [Lcom.demo.order.server.Order;

That's an array. You'll need special handling in case
orderClass.isArray() is true.

oc.


On Wed, 2011-11-02 at 12:07 -0700, dmsilva wrote:
> Hi,
> In the client code, when I trying to instantiate a list of objects I get
> this error: 
> <code>Exception in thread "main" java.lang.InstantiationException:
> [Lcom.demo.order.server.Order;</code>
> 
> this is my client code: 
> <code> // Get the input class Order
> 		Class<?> orderClass = partInfo.getTypeClass();
> 		System.out.println(orderClass.getName());
> 		Object orderObject = orderClass.newInstance();
> </code>
> 
> webservice: <code>
> @WebService
> public interface OrderProcess {
>     String processOrder(ArrayList<Order> order);
> </code>
> 
> 
> some help?
> 
> thaks..
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Dynamic-client-issue-when-trying-to-instantiate-a-list-of-objects-tp4959032p4959032.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Conscience is a mother-in-law whose visit never ends. -- H. L. Mencken