20 J2EE Interview Questions and Answers - Freshers, Experienced

Dear Readers, Welcome to J2EE Interview questions with answers and explanation. These 20 solved J2EE questions will help you prepare for technical interviews and online selection tests conducted during campus placement for freshers and job interviews for professionals.

After reading these tricky J2EE questions, you can easily attempt the objective type and multiple choice type questions on J2EE.

What are the J2EE components used while creating an application?

- The J2EE components consist of the functional unit that is used in the application and all the classes of it are also will get used to communicate with various components.
- The J2EE is having several components like :

1. Application clients and applets : These components run on the client side to provide the user interface and easy access to applications.
2. Java Servlet and JavaServer Pages technology : These are used on the server side to deal with the web related technology. They provide the web related functionalities and user interfaces so that the client can interact with them.
3. Enterprise JavaBeans : These are the components that are used for businesses and they are also implemented and run on the server. These are very useful in providing the core and advanced functionality to the user.

What is the purpose of web client in J2EE?

The web client is very important part and it has other two parts that defines the way it functions :

- Dynamic part : That gives the dynamic web pages using various markup languages like XML, HTML, etc. This is the part that is generated by using the web components that run in the web tier. The web browser is required to render the pages.
- Static part : That provides static pages from the server to the client that doesn’t change according to the demands. It remains static all the time and provide the information that is like support information or about us.
- The web client is known as thin client that is a very simple web based client doesn’t do any query, execution of business rules and connecting applications. It provides lightweight operations and provides the security, speed and different services to run the applications on the server.

How is applet different from other technologies used in J2EE?

Applets are client application that is small in size and it is included in the web tier. It provides the tools to communicate with the users and allow the drawings to be made by using the graphical interface. The applets are written in Java language. This gets executed on the virtual machine used by the Java and installed on the web browser. The plug in required by the client system for the use of security policy that executes the application in the web browser successfully. The components use API keys for creating the web client programs and run the application on the client side. As, no security is allowed the files are not required on the client system. It presents more modular approach to design the application using applets.

What is the purpose of the Application Clients in J2EE?

Application client runs on the client side and provide a way to the user to handle the task that is allowing the user to use the interface. The interface that is provided is graphical and tools are given for the help. The graphical user interface is created using swing and advanced window toolkit from the command line interface. These clients can use the applications directly due to the applications being handled at the business tier. The application client communicates throughout the HTTP connection using the servlet and the Java beans component architecture. The application client also includes various components to manage the overall data flow for the communication purpose between the server and the client.

What is the communication process of the application using the Java Beans?

JavaBeans components allow an object to be used to use the instance variables. The instance variables consist of get and set methods that are used on the server side to get the data information from the user and set it in the server. It provides lot of variations and elements can be used for the client tier. The client communicates through the business logic that is being provided by the server to run the applications. The web browser is used to communicate through the server by going through the pages that is being made and the transfer happens from the web tier. The J2EE application uses thin client or thick client that provides the lightweight and heavyweight functionality to the client and keep the load also to minimal on the server as well.

Explain the use of containers in J2EE.

Containers acts as an interface between a platform and a component that is at the low level and it provides the functionality that is supported by the component. Application clients get executed first and then the beans. It keeps the beans assembled at one place so that it can be used and deployed using the containers. The application consists of the components that are platform specific so the containers allow them to be bundled at one place and then used in the application just by giving the name and the path. The assembling of the beans requires the configuration settings to be seen for each component that is used inside the J2EE application or just by J2EE.

What are the Container settings that are being provided by the J2EE server?

- J2EE server supports the customization of the server by providing the services like security, transaction management, Java naming directory and other services that can be used to provide the component based architecture.
- There are different types of containers that exist :

1. Enterprise JavaBeans (EJB) container :
This is the container that manages the execution of the beans used for J2EE applications.

2. Web container :
This manages the page execution and other components used by the applications.

3. Application client container :
This controls and manages the application level components. These are used by the client and they run on the client side.

4. Applet container :
It is used to manage the applets that are executed by the web browser and uses Java plug-in.

What are the models provided by the J2EE?

The Interface that is used to provide remote connectivity to the database and the J2EE provides:
- Security model to allow the user to configure the web component to use the resource that can be accessed by the users that are permitted to use it.
- Transaction model allow the user to show the relationship between the methods to allow easy transaction that is treated as the single transaction.
- Lookup services, which allow easy identification of the interfaces to provide multiple naming and the directory services to the application that uses the components and access it.
- Remote connectivity model allow the user to manage the communications that are made at the low level between the clients and the beans. The bean gets created by the client that produces a method for executing an application.

What are the tools contained in J2EE to help develop an application?

- J2EE application creation requires some modules and tools that are created to deliver the archive file.
- The archive file is used with any archive manager but it is termed as the standard java archive file (JAR) that consists of the interfaces and components together in one.
- It consists of the application and deployment tools to create the EAR file and adding them in the JAR file. The tools that are used:

1. Deployment descriptors are used to contain the beans and the files that are related to each using the JAR archive container.
2. JAR file using the application client consists of the descriptors, class files and the application related data to be used to create an application.
3. WAR file is used to collect all the data at one place and populate it accordingly.

What are the tasks performed by J2EE enterprise Bean developer?

Enterprise Bean Developer platform uses many services for different components and it is always required that the task has to be mentioned such as:
- JAR file is an important file that consists of all the archived files and is used by the Java itself. It is used to perform the following tasks:
1. The source code has to be written and compiled properly.
2. The deployment descriptor is used to specify the application that need to run.
3. The class files that are of the extension .class file create a bundle and it is being bundled to be used as a single file. It requires the descriptor to be there in the JAR file.

What are the tasks performed by J2EE web component developer?

- Web Component Developer is related to the web services provided to the client for their use and functionality. The WAR file consists of the web component and performs various tasks on them.
- The tasks that are performed as follows:
1. Writing and compiling the servlet code that allow the errors and warnings to be removed so that the application can run properly everywhere else.
2. HTML and JSP files are written using the servlets as well to allow the application to have the proper functionality that is being required by the client.
3. Deployment descriptor specifications are given for the web development environment. It includes the bundled files for the deployment descriptor such as the WAR files and allow the application to run after taking the data from the server and given to the client.

What is the procedure for the application assembler used in J2EE?

- Application assembler is used to receive the application component from the client in a JAR file and then assembling of the file take place using the J2EE component facilities. Various functionalities are used to assemble the application components.
- Assembler is also known as the deployed that is allowed to modify the deployment descriptor. The modification can be performed directly or by using the tool correctly that allow the XML tags to be modified using the graphical user interfaces.
- The assembler works as:
1. Assembles the JAR and WAR files that is being created already before coming in this phase and turned into the EAR file.
2. Deployment descriptor specification is provided by using the J2EE application component.
3. Verification of the content is being done by the use of EAR file and using the specification that is being given already.

What is the process of deploying and administrating the application?

The application deploying and administrating allow the user to configure and deploy the application components in the J2EE application. The administration of the computing can be done to find out the infrastructure that is being used. The networking resources are also included in this, which allows the server to get the configuration for it and allow the client to request the application that is required. It allows the applications to run in the environment that is provided. The models that are used in this include the transaction control, security control models that allow the specification to be provided for the use of database connection. This allow the communication be done between the different components.

What is the procedure to deploy the administrating policies for an application?

- When the configuration that has to be applied is set then the content that is provided with it is used to resolve the dependencies that are coming from outside and allow user to modify the security setting and assign transactions parameters to make it more secure.
- The steps that are involved in installing and configuring the J2EE application requires:
1. J2EE application uses EAR file that is added when it is created in the phases before.
2. Configuration of the environment is being done by modifying the setting of it that allow the application to compatible with the environment. This is having a descriptor that allows describing the component that is in use.
3. The contents of EAR file are verified and specifications are checked to meet the requirements. • Installation or the deployment of the services takes place in the J2EE application file that is deployed on the server.

How is the J2EE API integration being performed?

- The J2EE API allows the system and applications to integrate the components that are being provided with it.
- It enables this by the following methods and ways:
1. The application that is used using the API gets incorporated on all the tiers of the enterprise bean. This follows the unified application model.
2. The J2EE API provides the request and response in a simplified manner. This is the mechanism that allows the JSP page and servlet to be represented in an easy way so that it can be implemented on the server.
3. It also follows the reliable security model that uses JAAS and it enables the security mechanism to be used with the entire application model.
4. It allows easy integration of the APIs using the JAXP that is an XML-based data interchange model which is simplified and added to provide the extra properties and manage them from one place.
5. It provides interoperability between the connector and uses the J2EE Connector Architecture in a simplified manner.
6. It allows connectivity of the database between many database systems using the JDBC APIs.

What are the features that are provided by different components of J2EE?

- J2EE provides a reference to all the components that it is using to allow an application deployment tool to be used for various purposes.
- The deployment tool is used to assemble, verify, and deploy the J2EE applications.
- These tools are used to automate the procedure of writing and compiling a code. The tools can be used using the command line or the graphical user interface.
- The interface is used as graphical and allows configuring different components of the J2EE as :
1. J2EE applications can be chosen to configure, package and deploy those applications on the server. These provide easy integration properties and can be used to create an API.
2. J2EE provides enterprise beans that allow the same operations to be used which is provided in the application part. It also provides the same functionality for the web components, application clients and the resource adaptors that provide resources to the application for execution.

What is the procedure to be followed to create a J2EE application?

To create the application in J2EE it requires to have predefined components that need to be used in order to successfully execute the application. The components that are used, enterprise bean, application client and the web component. To build the component it is necessary to create an application. This file name can be given according to the requirement and this will get stored in the EAR file like file-name.ear. The procedure that is followed for this is :
1. The tool that is used is the deploy-tool. This can be done by selecting the file and then new and then application in the new.
2. The browse option can be selected to select the application that needs to be included.
4. Enter the field name and save the file with the name that is entered by the user.
5. Save and exit and a new application gets created.

What do you understand by the JTA and JTS in reference to J2EE?

JTA (Java Transaction API) :
The JTA is responsible for providing an interface that allows the user to segregate transactions in a way that it does not depend on the transaction manger implementation. The transaction processing monitor is responsible for coordinating the transactions across various resources. Every resource has its own manager. The JTA architecture makes it mandatory for each resource manager to implement the interface so that it can be managed by the TP monitor.

JTS (Java Transaction Service) :
The JTS is used for the implementation of the transaction manager. It is responsible for providing services related to transaction to the various parties involved in distributed transactions. These can be the application server, the communication resource manager or a standalone transactional application.
The JTA can be considered to be a high level transaction interface used by an application to control a transaction whereas the JTS can be considered to be a low level API used in the background processes.

Why is J2EE the choice for distributed multi-tiered Applications?

- J2EE is a platform that uses multi-tiered distributed application divided into components that are divided on the basis of function, applications and other components that gets installed with the platform.
- There are different parts that are used for this multi-tiered application :
1. Client-tier components : This is the component that is used to run on the client machine.
2. Web-tier components : They are executed and maintained on a J2EE server.
3. Business-tier components : These are also executed and maintained on a J2EE server.
4. Enterprise Information System (EIS) : This tire of software executes specifically on EIS servers.

How can user package J2EE components?

The J2EE components of an application are packaged separately and then are bundled into a J2EE application. All the related files of a component such as the html, server utility classes etc. are clubbed together along with a deployment descriptor and assembled into a module. This module can be added to a J2EE application. The deployment descriptor is made using an xml file and it defines a components deployment settings. A J2EE application comprises of one or multiple enterprise bean, web or client component modules. Every J2EE application and the modules that make it have their own deployment descriptor file. Depending upon the design requirements the final enterprise solution may consist of one or more J2EE applications.
J2EE application
J2EE application - Explain the components of J2EE architecture, Explain the Java Servlets. Explain its lifecycle, Explain JSP, Describe JSP lifecycle.
J2EE web container
J2EE web container - overview of web container, Java Servlet programming model, deployment descriptors...
J2EE Architecture
J2EE Architecture - Types of container, J2EE container architecture, Technologies that J2EE platform provides, J2EE APIs
Post your comment