Value Objects and Collections


EJB programming & troubleshooting: Value Objects and Collections

  1. Value Objects and Collections (3 messages)

    I'm trying to return a Collection of ValueObjects and I keep getting a Corba Marshal exception.

    Take the following instance:

    public class ValObj {...}


    public class MyBean {
      public HashMap getValueObjects() {
        ValObj v = new ValObj();
        HashMap hMap = new HashMap();
        hMap.put("First", v);
        return hMap;


    I think this should work, but everytime I call
    getValueObjects, I get a Marshal exception. Is there any
    reason why this would not work? Or, is my EJB container
    just a piece of garbage?

  2. Is your value object Serializable? If it isn't, then the serialization of the HashMap will fail, and you will get a marshal exception.
    If it is Serializable, and you still get this error, the specific error message and stack trace may help figure out the problem.

  3. Certainly looks like a serialization problem. Make sure all the fields in your value object are serializable.
  4. Thanks for the suggestion, I'll try it out!