I. What is the difference between EJB and J2EE?
A: Both J2EE and EJB are server specifications. However, EJB is actually a subset of J2EE. In other words, the J2EE server must contain an EJB container. Each J2EE server must contain an EJB container. In addition, a Web container that can run Servlet and JSP is required. In an image, EJB is for J2EE, for Mickey Mouse to Disney.
2. Can I use EJB components from an application server compatible with EJB?
A: No. EJB components cannot "survive" outside the EJB container ". There is no primary method for the EJB component. Even if you intentionally add such a primary method to your bean class, this bean is of little use in itself, most methods in enterprise beans are called by the container itself. If they are out of the server, these methods have no meaning. Remember, the most important thing about an EJB server is that it can provide you with all the important services (transactions, security, etc.). Without a server, you will have nothing except your basic logic. Moreover, if your business logic depends on containers, even if it is only your business logic, it will also fail if there is no server.
3. What is the difference between the conventional JavaBean and Enterprise JavaBean?
A: The word "JavaBean" indicates reusable components. Conventional non-Enterprise JavaBean is a reusable component that follows a naming convention. These general JavaBean can be used by development tools. Enterprise JavaBean is a reusable component, but its similarities with conventional JavaBean are limited to this. The "Bean" in the conventional JavaBean mainly refers to reusable during development, which simplifies or speeds up the association between the event of creating a bean and the method of another bean, or you can set the property value more conveniently. The conventional JavaBean runs in JVM, just like all normal Java classes. In contrast, "Bean" in enterprise beans means that it can be reused at runtime, and enterprise beans must run under the control of EJB containers.