Faced the problem of interaction between modules on the application server. In stock:

  • Servlet (appA)
  • EJB module (appB).

From the servlet, I am accessing the EJB via the remote business interface. I can get a simple type as a response ( String for example), but I can't get a class object ( class Employee ). EJB uses JPA . Employee is an entity.
The fact is that all this works if you access the EJB from a simple console client, but it does not work from the servlet.

What could it be? I use GlassFish 4.1

Workaround found:
persistence.xml
property name = "eclipselink.weaving.fetchgroups" value = "false"

  • what can you not get? what mistake? - Mikhail Vaysman
  • No errors! Calling an EJB method as if returns an object (Employee @ 7cae4a3). But when accessing the method of the received object (getId () for example) returns null. Does this mean that the deserialization failed (Employee implements Serializable)? - Andrei
  • Isn't lazy loading turned on accidentally? - Mikhail Vaysman
  • Here, loading the rows directly from the table. @Basic (optional =) do not use. And then everything works when contacting an external client. - Andrei
  • and what for the external client? Does it work in the same container as the EJB? - Mikhail Vaysman

0