You are constructing the Order object during the initialization of the
object of type
 Order. This amounts to recursive calling of the constructor. Your
function call stack
 is bound to overflow.

First analyze if you need to have a reference to an object of the type
Order in the 
Order class itself. If that is the need,  try to refactor the code to
compose the 
object.

-Anuroop


-----Original Message-----
From: Carolina Costa [mailto:[EMAIL PROTECTED]
Sent: Monday, September 01, 2003 11:51 PM
To: Axis
Subject: java.lang.StackOverflowError??????


Hi,
       I'm writing a service that serialize/deserialize a JavaBean
(basically an extension of an axis' example:
samples/userguide/example5/BeanService.java ). I deployed the service
and
everything was ok.

I modified the Order.java so that it contains a reference to itself:

public class Order{
    private String strType;
    private HashMap map = new HashMap();
    private Order order2 = new Order();
.....
}

when I run the client class, I get the following error:

java.lang.StackOverflowError
Exception in thread "main"

Any clues?!
Thanks
Carolina Costa



Reply via email to