1
votes

I've created new class library, which contains class:

class myData {
  private int id
  private Date date;
  private String text

  //...
  //Getters and setters
  //...
}

Then I've created EJB module and SessionBean with remote interface.

@Stateless
public class myBean implements myBeanRemote {
  @Override
  public myData getData() {
    myData md = new myData();

    //...
    //set md data;
    //...

    return md;
  }

  @Override
  public String getMessage() {
    return "Hello";
  }
}

Then I use this bean in my application.

public class myApp {
  @EJB
  private static myBeanRemore mbr;

  public static void main(String[] args) {
    System.out.println( mbr.getMessage() );
    System.out.println( mbr.getData() );
  }
}

EJB runs on GlassFish 4. Bean method getMessage() is working good, problem is with getData(). I get error: java.lang.reflect.InvocationTargetException.

Where is the point with my custom class myData? Library with myData is included everywhere, in Glassfish libraries too. I tried to change bean creation with InitialContext, but it gives the same results.

1
Please post more of the stacktrace - i'd bet there is more information containedGyro Gearless

1 Answers

3
votes

Your myData class should implement the java.io.Serializable interface.