Reputation: 803
I'm trying to get a deeper understanding about JavaEE containers. I need to understands the architecture (that's ok) of a project and especially the repercussion on the Java EE containers. To make it simple, everything is running on the same full Java EE GlassFish server.
Some class definition I have : (sorry I can't post an UML diagram due to reputation)
@Entity public class MyEntity{...}
@Stateless public class MyEntityDAO{...}
@Stateless public class MyEntityFacade{...}
public class MyEntityTO{...} //Data Transfer Object, it's a POJO
@Named @ViewScoped public class MyEntityPageController{...}
And JSF page : myEntityPageJSF.xhtml
Now I want to categorize the different elements in the following containers like so :
EJB container :
Web container :
The only official answer I found is [1]:
Enterprise JavaBeans (EJB) container: Manages the execution of enterprise beans for Java EE applications. Enterprise beans and their container run on the Java EE server.
Web container: Manages the execution of web pages, servlets, and some EJB components for Java EE applications. Web components and their container run on the Java EE server.
The problem is the "and some EJB components" part... no idea what they're exactly talking about. So, can anyone categorize the following elements [2] in the correct container ?
Thanks in advance.
References :
Upvotes: 2
Views: 1837
Reputation: 6462
The Java EE application server contains only two container types (web and EJB container). Those containers have some components that uses some APIs, provided by the container itself.
Your application server can be interpreted as the application container. Just to cite a few: Tomcat, JBoss/Wildfly, Oracle Weblogic, Jetty or GlassFish are Java EE Application Container.
At this point, you can already notice that server is often a synonym of container. It resides in the fact that one has usually, for small application, one container per server. However, a server can consist of more that one container.
Strictly speaking, Java application servers are based on the Java Platform Enterprise Edition, which is a multi-tier distributed model. This model is composed by:
Multi-tier architecture means, in Java EE world, that some containers are on the client side, and some on the server side.
From the point of view of your server, the JCP (Java Community Process) defines in the JSR 342 only four types of Java EE containers:
Java EE containers are the interface between the component and the lower-level functionality provided by the Java EE platform to support that component.
Containers provide the runtime support for Java EE application components. Containers provide a federated view of the underlying Java EE APIs to the application components. Java EE application components never interact directly with other Java EE application components. [...] A typical Java EE product will provide a container for each application component type: application client container, applet container, web component container, and enterprise bean container.
The Web container as the EJB container(s), provide naming context and life management to their component(s). Note that, even if a Web container may work with an EJB container, they do not need to be deployed on the same machine.
A fully conformant JEE application server, such as Websphere, Glassfish or JBoss, has both containers.
JEE applications are made up of components. A component is a self-contained functional software unit that is assembled into a JEE application with its related classes and files and that communicates with other components.
Technically speaking, the containers provides the host execution environments for the components.
The specifications say that:
Example of communication between components from different containers:
The Web container includes JavaBeans components to manage the user input and send that input to enterprise beans running in the EJB container for processing.
Sun has defined a container as follow:
A container is a runtime environment that provides services such as security and transaction management to Java EE components.
I.e the containers are also responsible for providing the APIs, and the distributed communication protocols.
Container services:
Those container services or APIs can be logically divied into tiers: backend tier, middle tier and web tier:
Upvotes: 3
Reputation: 3176
Managed Bean is part of JSF, but JSF does not defina a separate container - it's backing beans are standard JavaEE beans (take a look at here). Please bear in mind, that nowdays it's recommended to use CDI managed beans instead of "JSF beans".
CDI bean is managed by CDI container (JSR 346).
WebService... It depends on how it's defined. When a service is annotated with both @WebService and @Stateless annotation then it's managed by EJB container. When it's annotated with CDI scope annotation then it's managed by CDI container. But it can also live outside any JavaEE container, because it's related with JavaSE spec.
Upvotes: 1