Search

Complete reference to EJB - Enterprise Java Beans interview questions basic to advanced level : SE to Team Lead level Part - 4

49). Can a Session Bean be defined without ejbCreate() method?
The ejbCreate() methods is part of the bean's lifecycle, so, the compiler will not return an error because there is no ejbCreate() method.

However, the J2EE spec is explicit:

the home interface of a Stateless Session Bean must have a single create() method with no arguments,
while the session bean class must contain exactly one ejbCreate() method, also without arguments.
 Stateful Session Beans can have arguments (more than one create method)
50). What are the optional clauses in EJB QL?
WHERE and ORDERBY clauses are optional in EJB QL where as SELECT and FROM are required clauses.
51). Can I use session beans and hibernate (instead of entity beans) for persitance?
Yes, we can. It's same as BMP.
52). If session has thrown ApplicaitonException would you use EJBContext. setRollBackOnly method?
According to the EJB specification, when the ApplicationException is thrown, the EJBContext.setRollBackOnly method is not called.

Typically, an enterprise bean marks a transaction for rollback to protect data integrity before throwing an application exception, because application exceptions do not automatically cause the Container to rollback thetransaction.

For example, an AccountTransfer bean which debits one account and credits another account could mark a transaction for rollback if it successfully performs the debit operation, but encounters a failure during the credit operation.
53). What is the difference between activation and passivation?
This would be the difference between Activation and Passivation:

While the bean is in the ready stage, the 
EJB container may decide to deactivate, or passivate, the bean by moving it from memory to secondary storage. (Typically, the EJB container uses a least-recently-used algorithm to select a bean for passivation.) The EJB container invokes the bean's ejbPassivate method immediately before passivating it. If a client invokes a business method on the bean while it is in the passive stage, the EJB container activates the bean, moving it back to the ready stage, and then calls the bean's ejbActivate method.
54). How do you check whether the session is active in Stateful session bean ?
In Stateful session bean session is not itself a separate entity. it is contained in the bean it self. So in order to check tht we need the check whether the Stateful session bean is present or not which is done by just invoking the home interface with the jndi
55). What is the difference between find and select methods in EJB?
# A select method can return a persistent field (or a collection thereof) of a related entity bean. A finder method can return only a local or remote interface (or a collection of interfaces).

# Because it is not exposed in any of the local or remote interfaces, a select method cannot be invoked by a client. It can be invoked only by the methods implemented within the entity bean class. A select method is usually invoked by either a business or a home method.

# A select method is defined in the entity bean class. For bean-managed persistence, a finder method is defined in the entity bean class, but for container-managed persistence it is not.
56). What is the difference between local interface and remote interface?
We can describe the following common rules for choosing whether to use remote client view or local client view:

When you will potentially use a distributed environment (if your enterprise bean should be independent of its deployment place), you should obviously choose remote client view.

Use remote client view when you need to be sure that parameters passed between your EJB and the client (and/or other enterprise beans) should be passed "by value" instead of "by reference." With pass-by-value, the bean will have its own copy of the data, completely separated from the copy of the data at the client. With local client view, you can do pass-by-reference, which means your bean, as well as the client, will work directly with one copy of the data. Any changes made by the bean will be seen by the client and vice versa. Pass-by-reference eliminates time/system expenses for copying data variables, which provides a performance advantage.

If you create an entity bean, you need to remember that it is usually used with a local client view. If your entity bean needs to provide access to a client outside of the existing JVM (i.e., a remote client), you typically use a session bean with a remote client view. This is the so-called Session Facade pattern, the goal of which is that the session bean provides the remote client access to the entity bean.

If you want to use container-managed relationship (CMR) in your enterprise bean, you must expose local interfaces, and thus use local client view. This is mentioned in the EJB specification.

Enterprise beans that are tightly coupled logically are good candidates for using local client view. In other words, if one enterprise bean is always associated with another, it is perfectly appropriate to co-locate them (i.e., deploy them both in one JVM) and organize them through a local interface.
57). Why CMP beans are abstract classes? 
We have to provide abstract data to object mapping that maps the fields in our bean to a batabase, and abstract methods methods that corelate these fields.
58). What is the difference between normal Java object and EJB?
Java Object: is a reusable component.
EJB : is a distributed component used to develop business applications. 
Container provides runtime environment for EJBs.
59). What is abstract schema?
Abstract schema is part of an entity bean's deployment descriptor which defines the bean's persistent fields and their relationship. Abstract schema is specifed for entity beans with container managed persistence. We specify the name of the Abstract schema name in the deployment descriptor. The queries written in EJB QL for the finder methods references this name. The information provided in this Abstract Schema is used by the container for persistence management and relationship management.
60). What is clustering. What are the different algorithms used for clustering?
Clustering is the use of multiple computers and storage devices to create what seems to be a single system. Clustering is often used to increase a system's availability and for load balancing on highly-trafficked Web sites.

Clustering algorithms find groups of items that are similar. For example, clustering could be used by an insurance company to group customers according to income, age, types of policies purchased and prior claims experience. It divides a data set so that records with similar content are in the same group, and groups are as different as possible from each other. Since the categories are unspecified, this is sometimes referred to as unsupervised learning.

Main strategies of clustering:
1. Hierarchical clustering
2. K-clustering (partitioning)
3. Self Organizing Maps (SOM)
4. Hybrids (incremental)
61). Why did I get a LockTimedOutException?
A.    When you get a LockTimedOutException while invoking a stateful session EJB, one of two things has occurred:

* You have <allow-concurrent-calls> set to true in your weblogic-ejb-jar.
xml descriptor and your call timed out while waiting to be processed. The timeout used in this case is the value <trans-timeout-seconds> element of the weblogic-ejb-jar.xml descriptor or its default value of 30 seconds.
* You do not have <allow-concurrent-calls> set to true and you attempt to invoke a stateful session bean that is already busy processing another request. In this case, the second method call will not block and a LockTimedOutException will be thrown immediately.
62). What is the life cycle of MDB?
The lifetime of an MDB instance is controlled by the container. Only two states exist: Does not exist and Ready , as illustrated in the following figure:
The life of an MDB instance starts when the container invokes newInstance() on the MDB class to create a new instance. Next, the container calls setMessageDrivenContext() followed by ejbCreate() on the instance. The bean then enters the Ready state and is ready to consume messages.
When a message arrives for the bean, the container invokes the onMessage() method of one of the available instances, passing a Message object in argument. Message s can be consumed and processed concurrently by using multiple instances of the same type.
The container invokes ejbRemove() on the bean instance when it no longer needs the instance. The bean instance can perform clean up operations here.
63). Can an entity bean be a listener for JMS messages?
No. Message driven beans should be used to consume JMS messages.
64). What is Entity Bean. What are the various types of Entity Bean?
Entity bean represents the real data which is stored in the persistent storage like Database or file system. For example, There is a table in Database called Credit_card. This table contains credit_card_no,first_name, last_name, ssn as colums and there are 100 rows in the table. Here each row is represented by one instance of the entity bean and it is found by an unique key (primary key) credit_card_no.

There are two types of entity beans.
1) Container Managed Persistence(CMP)
2) Bean Managed Presistence(BMP)
65). What is IIOP ?
It is Internet Inter Object Resource Broker Protocl
66). Why don't stateful session beans have a pool?
Stateful session beans get instantiated once for each seperate client request and it stores the client information in it, there is no threading concept in EJB hence if there will be an instance pool will exist then there is a possiblity of information leak between different session objects.

therefore there is no concept of instance pooling in stateful session bean.
67). Without using entity beans can we do database transactions?
Without using entity beans we can do database transactions through Springs .Spring can be used to configure declarative transaction management, remote access to your logic using RMI or web services, mailing facilities and various options in persisting your data to a database
68). What is the use of using session facade design pattern in EJB'S?
There are many uses, important one is to reduce network traffic I you are calling many EJB from your Servlet then this is not advised, because it has to make many network trips, so what you do you call a Stateless session bean and this in turn calls other EJB, since they are in same container there is less network calls other thing you can do now is you can convert them to LOCAL EJB which has not network calls. This increases your server bandwidthJ. Problem solver this is good for a highly available system.
69). What is the difference between session and entity beans? When should I use one or the other?
An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)
70). Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB? –
 You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.
71).What is EJB role in J2EE?
EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.

72).what are Container-Managed Transactional attributes ?

Not Supported 

The bean is not involved in a transaction. If the bean invoker calls the bean while involved in a transaction, the invoker's transaction is suspended, the bean executes, and when the bean returns, the invoker's transaction is resumed. 

Required 

The bean must be involved in a transaction. If the invoker is involved in a transaction, the bean uses the invoker's transaction. If the invoker is not involved in a transaction, the container starts a new transaction for the bean.
Supports 

Whatever transactional state that the invoker is involved in is used for the bean. If the invoker has begun a transaction, the invoker's transaction context is used by the bean. If the invoker is not involved in a transaction, neither is the bean. 
RequiresNew 

Whether or not the invoker is involved in a transaction, this bean starts a new transaction that exists only for itself. If the invoker calls while involved in a transaction, the invoker's transaction is suspended until the bean completes. 

Mandatory 

The invoker must be involved in a transaction before invoking this bean. The bean uses the invoker's transaction context. 

Never 

The bean is not involved in a transaction. Furthermore, the invoker cannot be involved in a transaction when calling the bean. If the invoker is involved in a transaction, a RemoteException is thrown
73).How is persistence implemented in enterprise beans?
Persistence in EJB is taken care of in two ways, depending on how you implement your beans: container managed persistence (CMP) or bean managed persistence (BMP) For CMP, the EJB container which your beans run under takes care of the persistence of the fields you have declared to be persisted with the database - this declaration is in the deployment descriptor. So, anytime you modify a field in a CMP bean, as soon as the method you have executed is finished, the new data is persisted to the database by the container. For BMP, the EJB bean developer is responsible for defining the persistence routines in the proper places in the bean, for instance, the ejbCreate(), ejbStore(), ejbRemove() methods would be developed by the bean developer to make calls to the database. The container is responsible, in BMP, to call the appropriate method on the bean. So, if the bean is being looked up, when the create() method is called on the Home interface, then the container is responsible for calling the ejbCreate() method in the bean, which should have functionality inside for going to the database and looking up the data.
74). Are we allowed to change the transaction isolation property in middle of a transaction?
No. You cannot change the transaction isolation level in the middle of transaction.
75). For Entity Beans, What happens to an instance field not mapped to any persistent storage, when the bean is passivated?
The specification infers that the container never serializes an instance of an Entity bean (unlike stateful session beans). Thus passivation simply involves moving the bean from the ready to the pooled bin. So what happens to the contents of an instance variable is controlled by the programmer. Remember that when an entity bean is passivated the instance gets logically disassociated from it’s remote object. Be careful here, as the functionality of passivation/activation for Stateless Session, Stateful Session and Entity beans is completely different. For entity beans the ejbPassivate method notifies the entity bean that it is being disassociated with a particular entity prior to reuse or for dereference.
76). What is a Message Driven Bean, what functions does a message driven bean have and how do they work in collaboration with JMS?
Message driven beans are the latest addition to the family of component bean types defined by the EJB specification. The original bean types include session beans, which contain business logic and maintain a state associated with client sessions, and entity beans, which map objects to persistent data. Message driven beans will provide asynchrony to EJB based applications by acting as JMS message consumers. A message bean is associated with a JMS topic or queue and receives JMS messages sent by EJB clients or other beans. Unlike entity beans and session beans, message beans do not have home or remote interfaces. Instead, message driven beans are instantiated by the container as required. Like stateless session beans, message beans maintain no client-specific state, allowing the container to optimally manage a pool of message-bean instances. Clients send JMS messages to message beans in exactly the same manner as they would send messages to any other JMS destination. This similarity is a fundamental design goal of the JMS capabilities of the new specification. To receive JMS messages, message driven beans implement the javax.jms.MessageListener interface, which defines a single onMessage() method. When a message arrives, the container ensures that a message bean corresponding to the message topic/queue exists (instantiating it if necessary), and calls its onMessage method passing the client’s message as the single argument. The message bean’s implementation of this method contains the business logic required to process the message. Note that session beans and entity beans are not allowed to function as message beans.
77).What is the advantage of putting an Entity Bean instance from the Ready State to Pooled state?
The idea of the Pooled State is to allow a container to maintain a pool of entity beans that has been created, but has not been yet synchronized or assigned to an EJBObject. This mean that the instances do represent entity beans, but they can be used only for serving Home methods (create or findBy), since those methods do not relay on the specific values of the bean. All these instances are, in fact, exactly the same, so, they do not have meaningful state. Jon Thorarinsson has also added: It can be looked at it this way: If no client is using an entity bean of a particular type there is no need for cachig it (the data is persisted in the database). Therefore, in such cases, the container will, after some time, move the entity bean from the Ready State to the Pooled state to save memory. Then, to save additional memory, the container may begin moving entity beans from the Pooled State to the Does Not Exist State, because even though the bean’s cache has been cleared, the bean still takes up some memory just being in the Pooled State.

78). What is Session Bean?

The entity bean is used to represent data in the database. It provides an object-oriented interface to data that would normally be accessed by the JDBC or some other back-end API. More than that, entity beans provide a component model that allows bean developers to focus their attention on the business logic of the bean, while the container takes care of managing persistence,transactions, and access control. 

There are two basic kinds of entity beans: container-managed persistence (CMP) and bean-managed persistence (BMP). 

Container-managed persistence beans are the simplest for the bean developer to create and the most difficult for the EJB server to support. This is because all the logic for synchronizing the bean's state with the database is handled automatically by the container. This means that the bean developer doesn't need to write any data access logic, while the EJB server is 
supposed to take care of all the persistence needs automatically. With CMP, the container manages the persistence of the entity bean. Vendor tools are used to map the entity fields to the database and absolutely no database access code is written in the bean class. 

The bean-managed persistence (BMP) enterprise bean manages synchronizing its state with the database as directed by the container. The bean uses a database API to read and write its fields to the database, but the container tells it when to do each synchronization operation and manages the transactions for the bean automatically. Bean-managed persistence gives the bean developer the flexibility to perform persistence operations that are too complicated for the container or to use a data source that is not supported by the container.
79).If my session bean with single method insert record into 2 entity beans, how can I know that the process is done in same transaction (the attributes for these beans are Required)
It depends on the transaction attribute of the session bean also. You have to set the transaction attribute of the session bean either to Required or RequiresNew.
80).Can i map more than one table in a CMP?
No, you cannot map more than one table to a single CMP Entity Bean. CMP has been, in fact, designed to map a single table.

81). Difference between SessionBean remove() and EntityBean remove() method?

SessionBean remove() : inform the container of your loss of interest in this bean. Container will remove the instance. 

EntityBean remove() : delete an entity bean without first instantiating it. Delete the row of the table using mentioned primary key.
82). Does each stateless session bean have its own EJBObject?
This is container specific as it is responsible for hadling the beans. There may be a 1:N or M:N relationship between EJBObject and the session Bean


EJB Interview Questions

1) Explain about the concept of EJB?
EJB is a complex subject and it requires patience to master it. This is used for Enterprise construction of applications. It is a server side component and architecture. The main role which EJB functions is, it hides the business logic of an application.

2) Name some common roles which EJB performs?
Enterprise Java Beans is used chiefly for encapsulating the business logic of an application. It handles problems such as security, persistence and transactional integrity of applications. It solves these major three problems of developers thus allowing them to freely concentrate on the problem at hand.

3) Explain about POJOs which form a part of EJB?
Plain old java objects are nothing but java objects. EJB3 has implemented POJOs. It gives a feel to the developers about the old objects and names used in programming. This makes a developer comfortable rather than to use fancy names for the same old application or function.

4) Explain in detail about stateless session bean?
Concurrent access to a bean can be possible by using stateless session bean because they don’t have a state associated with them. This bean is less resource intensive due to lack of overhead which negates its functionality in calling a conversation with the program.

5) Explain about stateful session Beans?
Stateful session beans have a state and they are distributed objects, because of them having a state they keep a track record of the calling program. This session should be carefully programmed because it may tell you about the status and presence of the customer during checkout.

6) Explain the difference between Container managed persistence and Bean managed persistence?
If the persistent state was managed by a container present in a bean then it is called as Container managed persistence. If the own state was managed by a bean then it is called as Bean managed persistence. The chief difference lies between the management of the state by the bean or by the container.

7) Explain about Entity bean and its features?
Entity Bean is a sever side component belonging to J2EE. Persistence can be managed either by Container or a Bean; these functions are present in Entity bean. Mostly it can be identified or sorted by a primary key. Remote references can survive a crash and can be trusted as a second source for storing data.

8) Explain about message driven beans?
Message driven beans are primarily used to handle asynchronous JMS messages which require integration of EJB and Java messaging services. These beans behave asynchronously. Handling of an operation which does not require instant reply or response is made easy by message driven beans.

9) Explain about the process of execution of EJBs?
EJB or Enterprise Java beans are always present in EJB container which is in turn present in an application server. Interaction of the EJB with the container and client code with container or EJB depends upon the specification. They are always included in applications in the form of javax.ejb.

10) Explain about instance methods?
Instance methods are placed in component interface and they are attached to specific instance. There nature of being Java instances makes EJB to generate classes for these instances which act as a proxy. Code from the client end is required to invoke the method present on the generated proxies which places method arguments onto a message and this message is sent to the EJB server.

11) Explain about class methods?
Home interface declares class methods. They are not used to find an existing entity and neither are they tied to a specific instance. These are not used for creating an EJB instance.

12) Explain about factory method?
It is an OOD pattern and deals with designing of the objects without specifying the class of the object which would be the final end product. A separate method is defined which will be used for creating an object and this can be easily overwritten by sub classes. This method is useful in getting the desired end product.

13) Explain about the transactions feature present in EJB?
ACID transactions and bean managed transactions should be supported by EJB container. Transactions which are container managed require declarative syntax which will be used in the deployment descriptor.

14) Explain about deployment descriptor?
As the name indicated deployment descriptor refers to a configuration file which is deployed to a container. It is primarily used for deploying a module or application. Configuration requirements are also stated in a deployment descriptor and these should be followed by a developer while deploying an application.

15) Explain about the naming and directory services present in EJB?
Home interface implementation object can be found using JNDI and this feature is available for clients using EJB. The same Home interface can be found by using CORBA name service. Creation and deletion of EJBs can be done from home interface and client code can find entity beans.

16) Explain about J2EE application and its components?
Two components are present in a J2EE application they are web and enterprise Java bean. Enterprise Java bean consists of all the logic which is very much required for a web service to run. These can be stored as .jar file and can be deployed on an application server.

17) Explain about the method ready pool?
In this stage of operation bean contains an instance in its memory. This instance of memory is present in EJB container. These instances are created at the start up and a session context is set up and ultimately this data or instance is transferred to Method ready pool stage. If it doesn’t like it transfers it to remove stage.


J2EE Application Components
- Applet component: These are client-side GUI components that are hosted by an applet container, which is typically a web browser. They have the ability to provide a feature-rich user interface to an enterprise application.
- Application client component: These are Java-based programs that can execute within a supported JVM. They offer a user interface similar to what exists on the native client while accessing J2EE Business Tier facilities.
- Web component: These are components that have the ability to respond to HTTP requests. They comprise servlets, JSP pages, filters, and web event listeners:
- Servlets: These extend aweb server’s functionality to support the dynamic processing of application logic. Servlets can be used in any request/response programming models but are most often used with HTTP. In this method, they utilize data embedded within HTTP requests for input and provide resulting output using the HTTP response, making the processing facilities of the J2EE Platform available to the information input on the source web page.
- JavaServer Pages: Similar to servlets, JSP pages provide dynamic web application capability to the J2EE Platform. JSP pages achieve this goal through the introduction of templating functionality. A JSP page begins with HTML elements that remain static throughout the lifetime of the page; this forms the base template. Dynamic elements are then added through the embedding of Java code and/or special tags within the page. It should be noted that JSP pages are indeed converted to servlets before execution, but the intricacies of this process are managed by the web container.
- Filters: These components provide the ability to intercept requests by clients for resources on a server and also responses provided to these requests by the web container with the goal of transforming the content of either the request or response communication. Filters provide a reusable mechanism to handle recurring tasks such as authentication, logging, etc., that are applicable to items within the web container.
- Web event listeners: These are components that are created to perform a particular function when a specific event occurs within the web container. These components provide developers with the flexibility to respond in a certain way when different types of web application–related events such as the creation or invalidation of a session occurs.
Enterprise JavaBeans components: These are server-side components that singularly or collectively encapsulate the application logic of an enterprise application.
EJB technology enables rapid and simplified development of distributed, transactional, secure, and portable applications based on Java technology. There are three types of EJBs defined by the specification:

Session beans: A session bean is a server-side extension of a client that exists to service requests made by the client. As the name implies, it simulates an interactive session between a client and the server-based component. Session beans exist in two forms. There are stateful session beans, which are said to maintain a “conversational state” with a client by virtue of retaining instance variable data on multiple method invocations. Because of this, they are wedded to a unique client throughout the instance existence. Stateless session beans, on the other hand, exist to service requests from multiple clients. They perform transient services for their clients, fulfilling whatever request is made of them and returning to their original initialized states.
Entity beans: Entity beans are an encapsulated representation of business objects made available with a persistence mechanism. They represent an object to relational mapping of the data stored within these persistence layers, thereby facilitating the modification of the underlying business objects while preserving referential and data integrity constraints demanded by the specific business process.
Message-driven beans: These are stateless, server-side components invoked by the EJB container on the receipt of a message in an associated JMS Queue or Topic. This component allows the EJB container to provide support for asynchronous message processing.
J2EE components are JAR-style archives with a strict internal structure. All compiled Java classes of a J2EE application is packaged in J2EE components, which execute within containers inside a J2EE application server. In general, J2EE components consist of sets of compiled Java classes, any required resources (images, libraries etc.), and required XML configuration documents (known as deployment descriptors). As JAR-style archives contain a mandatory top-level directory (META-INF) holding a manifest file (MANIFEST.MF), J2EE components use that directory structure to contain the deployment descriptors. For web applications, the configuration directory is called WEB-INF instead of META-INF.
There are four types of J2EE component:
  1. Enterprise Applications. These components provide a top-level structure which contains any number of other J2EE components (except other J2EE Enterprise Applications). The JAR file holding an enterprise application has the suffix .ear, so Enterprise Applications are frequently referred to as EARs.
  2. Web Applications. These J2EE components may contain Servlets, Java ServerPages, Tag Library Definitions and plain Java classes or resources as required for proper operation. The documents and Java classes of Web Applications frequently create markup language (HTML, WML, XML, etc.) responses to requests from web browsers or business applications. The JAR file holding a Web application has the suffix .war, so WebApps are frequently referred to as WARs.
  3. Enterprise JavaBean Applications. These components hold server-side business logic packaged within Enterprise JavaBeans.
  4. Resource Applications. These J2EE components hold Java classes that act as drivers or communication gateways to Enterprise Information Systems (EISs). It is highly likely that the manufacturer of an EIS packages its driver into a J2EE resource archive (RAR).


J2EE interview questions and answers

By admin |
Thanks to Sachin Rastogi for contributing these.
  1. What makes J2EE suitable for distributed multitiered Applications?
    - The J2EE platform uses a multitiered distributed application model. Application logic is divided into components according to function, and the various application components that make up a J2EE application are installed on different machines depending on the tier in the multitiered J2EE environment to which the application component belongs. The J2EE application parts are:
    • Client-tier components run on the client machine.
    • Web-tier components run on the J2EE server.
    • Business-tier components run on the J2EE server.
    • Enterprise information system (EIS)-tier software runs on the EIS server.
  2. What is J2EE? - J2EE is an environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, web-based applications.
  3. What are the components of J2EE application?
    - A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:
1.      Application clients and applets are client components.
2.      Java Servlet and JavaServer Pages technology components are web components.
3.      Enterprise JavaBeans components (enterprise beans) are business components.
4.      Resource adapter components provided by EIS and tool vendors.
                        What do Enterprise JavaBeans components contain? - Enterprise JavaBeans components contains Business code, which is logic
that solves or meets the needs of a particular business domain such as banking, retail, or finance, is handled by enterprise beans running in the business tier. All the business code is contained inside an Enterprise Bean which receives data from client programs, processes it (if necessary), and sends it to the enterprise information system tier for storage. An enterprise bean also retrieves data from storage, processes it (if necessary), and sends it back to the client program.
                        Is J2EE application only a web-based? - No, It depends on type of application that client wants. A J2EE application can be web-based or non-web-based. if an application client executes on the client machine, it is a non-web-based J2EE application. The J2EE application can provide a way for users to handle tasks such as J2EE system or application administration. It typically has a graphical user interface created from Swing or AWT APIs, or a command-line interface. When user request, it can open an HTTP connection to establish communication with a servlet running in the web tier.
                        Are JavaBeans J2EE components? - No. JavaBeans components are not considered J2EE components by the J2EE specification. They are written to manage the data flow between an application client or applet and components running on the J2EE server or between server components and a database. JavaBeans components written for the J2EE platform have instance variables and get and set methods for accessing the data in the instance variables. JavaBeans components used in this way are typically simple in design and implementation, but should conform to the naming and design conventions outlined in the JavaBeans component architecture.
                        Is HTML page a web component? - No. Static HTML pages and applets are bundled with web components during application assembly, but are not considered web components by the J2EE specification. Even the server-side utility classes are not considered web components, either.
What can be considered as a web component? - J2EE Web components can be either servlets or JSP pages. Servlets are Java programming language classes that dynamically process requests and construct 

No comments:

Post a Comment