Java Beans are reusable components. Generally, Because Java Beans are created by containers (such as Tomcat), Java Beans should have a no-argument constructor, generally, Java Bean must implement the serializable interface to realize bean persistence.
Enterprise Java Bean distributed component. It is based on Java remote method call (RMI) technology, so EJB can be remotely accessed (cross-process, cross-computer ). However, EJB must be deployed in containers such as webspere and weblogic. The EJB client never directly accesses the real EJB component but accesses it through its container. The EJB container is the proxy of the EJB component. The EJB component is created and managed by the container. The customer accesses the real EJB component through the container.
EJB is developed using the javax. EJB package and is an inter-process component. EJB has good stability when distributed processing is required;
Javabean is developed using Java. Beans packages. Javabean is an in-process component. Although remote method calls can be implemented through RMI, the stability is not as good as that of EJB. Therefore, EJB is selected when distributed processing is required.