16th April, 2021
Looking to grab the job opportunities in the multinational organizations into J2EE? Then, you are at the right place. According to one of the surveys in recent times, it is known that J2EE holds a market share of 7.0% which is amazing. Hence, looking for opportunities around this technology is also worthy. In this article, you will review the J2EE interview questions asked during the interviews by different organizations. These frequently asked interview questions are curated by experts and I would recommend you to give a quick review on them which would help you crack the interview easily. Let’s get started now!
Most frequently asked J2EE Interview Questions
Ans: J2EE stands for Java 2 enterprise edition. J2EE is one of the platforms that consists of the specifications and practices which will help in enabling the solutions for the development, deployment and management of the applications. J2EE is a flexible platform that allows the addition of the capabilities that are required to ensure that a robust and stable platform is provided at the enterprise level. In simple terms, J2EE is a platform that is a combination of different protocols, APIs, services, etc.
Ans: J2EE is referred to as the software unit that includes one or more J2EE components for the same container type along with one deployment descriptor of that type. The process of deploying and assembling the modules is easier in J2EE. There are 4 different types of J2EE modules. They are:
Application client module: The application client module consists of the class files and the client deployment descriptor. The application client module is packed as JAR files with an extension called .jar.
Web module: The web module consists of four components called Java Server Pages (JSP) files, class files for the servlets, web deployment descriptor and Graphical Interchange Format (GIF) and Hypertext markup language (HTML) files. These components or modules will be packaged under the JAR files with the .war extension.
Enterprise JavaBeans Module: The enterprise JavaBeans module consists of the class files for enterprise bans and also an EJB deployment descriptor. These modules or components are packaged as JAR files with .jar extension.
Resource Adapter Module: The resource adapter module comprises different concepts of java interfaces, resource adapter deployment descriptor, classes, native libraries, and other documentation.
Ans: Below listed are the design goals of the J2EE architecture.
Accessibility: The application has to be designed in such a way that it is capable of allowing the user to connect from any kind of device from anywhere around the globe.
Data connectivity: The application should be capable of connecting to the mainframe systems and any other legal systems to make sure that the business functions are running as usual without any issues.
User interaction: The application has to be designed in such a way that the user is allowed to connect to the application using different devices like laptop, desktop, mobile phones, PDA, etc.
Service availability: We need to ensure that the application is available 24*7. There will be a dependency on the application without the need of the customer service agents.
Flexibility: The architecture has to be designed in such a way that the developer focuses on the business components and the other services will be handled by the server.
|Want to acquire industry skills and gain complete knowledge of J2EE? Enroll in Instructor-Led live "J2EE Training" to become Job Ready!|
Ans: JSF stands for Java Server Faces, referred to as a user interface designing framework that is used for the development of web applications. There are a set of reusable components that are associated with the java server faces. JSF is based on the MVC (model view controller) patterns and designs.
Ans: Hibernate is referred to as the open-source object-relational mapping and query service. It is possible to use HQL instead of SQL in Hibernate which will help the developers to save time and invest more time in writing the native SQL. Hibernate is capable of using inheritance, polymorphism, collections, composition, association. Apart from this, it is also considered as one of the beautiful approaches which help in persisting to the database by making use of the java objects. It is one of the platforms that will help you to express their queries by making use of the Java-based criteria.
Below are the advantages of using hibernate:
1. Hibernate is one of the portable platforms that are independent of the database and also independent of the vendor.
2. It includes a standard or a which is also providing support to JPA.
3. It also allows the mapping of the domain object to the relational database system.
4. When compared with the plain JDBC, Hibernate is very far better.
Ans: save(): The save() method is used in Hibernate in order to store the objects in the database. Apart from this, it also helps you to insert an entry if the record does not exist in the database.
saveorupdate(): The saveorupdate() method is used in Hibernate for updating the object using the identifier. If there is no identifier or if the identifier is missing this method with call save(). If the identifier exists, then it will call the update method.
Ans: ORM refers to the object-relational mapping. The objects that are used in a java class will be mapped to the tables that are present in a relational database by making use of the metadata which will describe the mapping that exists between the object and the database. The object-relational mapping allows you to transform the data from one representation to another. Below listed are the set of advantages of ORM.
1. Vendor Independence
Ans: There are four different types of J2EE clients. They are:
1. Application clients
2. Java Web start enabled clients
3. Wireless clients
Java server pages and Java servlet Technology components are considered web components. Servlets are the Java programming language that will be dynamically receiving the request and make responses accordingly. The Java server pages will be executed as a servlet which will be a natural approach that will help in creating the static content.
Ans: Hashtable is similar to the hashmap which is a collection that has unique key and value pairs. Hashtable is considered as a collection synchronized object which will not allow duplicate values or null values.
Ans: Below is the set of limitations of Hibernate.
1. Hibernate is very slow in creating the queries when compared to the execution of the query that is used directly.
2. It does not include any shared preferences for the value type.
3. It is only flexible to provide the query language support for the composite keys.
Ans: A struct is usually referred to as an application development framework that is based on the model view controller architecture. It includes the combination of the custom tags, messages, java servlets and JSP. It also allows you to design applications for large companies or organizations. It can be briefly described as below:
Model: A Model refers to the internal state of the system. It is based on the app architecture and can be either single or a cluster.
View: In order to design a view for the application, JSP technology is used.
Controller: A controller is specifically used to perform the management of the user actions. It is responsible for processing the client requests and respond to them same accordingly. The servlet of the class ActionServlet is referred to as the primary component in the framework. The configuration of the servlet is based on the definition of the set of action mappings.
Ans: Authorization: An authorization is referred to as a process of identifying access to the method or the resource. It also helps you in determining whether the principle associated with the request through the authentication is within the security role or not. A deployer is responsible for mapping the security roles to the security identities. Security identities here refer to the groups or the principles that are available in the operational environment.
Authorization constraint: An authorization constraint is referred to as an authorization rule that will help you in identifying who is allowed to access the web resource collection.
Ans: Connection pooling is a simple concept or practice that is commonly used for reusing the already existing connections. Whenever there is a requirement of connections and if the object already has the well-defined connections, then these connections can be reused instead of creating or generating a new connection.
Ans: Below listed are the core interfaces of hibernate framework:
Ans: Below is the main components in the multi-tier architecture.
Presentation tier: The presentation tier is the front end component that is specifically used for displaying the presentation.
Resource tier: The resource tier is referred to as the back end component that is used for communicating with the database.
Business tier: The business tier is specifically used to provide the business logic for the system.
Ans: Below is the list of the modules that are available in the spring.
Ans: A servlet is referred to as a server-side component which is providing a powerful mechanism for the development of server-side programs. Servlets is called a server that is platform-independent, designed for different protocols. Among the different protocols available, HTTP protocols are the most commonly used. The servlets make use of the classes available in the java packages. All the servlets are capable of implementing the servlet interface which includes the defined life-cycle methods. Servlet is a pure java object.
Ans: Below is the list of different phases in the servlet life cycle.
|Related Article: J2EE Tutorial|
JTA: JTA refers to Java Transaction API. The Java transaction API is responsible for managing and coordinating the transactions in the enterprise information system.
JNDI: JNDI refers to Java Naming Directory Interface. It is used for accessing the information that is required from the directory services.
JMS: JMS refers to Java Messaging Service. The java messaging service is responsible for sending and receiving messages using the different messaging systems.
EAI: EAI refers to Enterprise Application Interface. EAI will help in making one or more applications into a single application and also helps in transmitting the required data to the appropriate system at the right time. Let us take an example of two different systems: sales and account systems. The sales team has to send the sales order to the accounting teams in order to generate the invoice. The accounting team has to then send the invoices to sales in order to update the data.
EDI: EDI stands for Electronic Data interchange. EDI helps in performing the exchange of the data via the value-added network which will be considered as the transmission medium. EDI requires customization by exchanging the clients and EDI is also expensive. EDI depends on the X12 standards to perform the interchanging of the documents.
Component provider: The component provider is involved in the development of the programming, modelling, architecture, business processes, etc.
Container provider: The container provider is responsible for providing the environment during the runtime to the server.
application server provider: The application server provider is responsible for providing a platform that will help in the development of the distributed applications. It also consists of the container which is involved in providing the runtime environment.
Ans: The load() method will be throwing an exception whenever the object is not existing either in the cache or the database. The load() method does not return any null values.
The get() will return the null when the object is not available either in the cache or the database.
Ans: The following are the advantages of using spring for the development of the applications.
The developmental costs can be reduced by ensuring that the productivity of the application development is improved.
It also helps in improving the maintainability and testability of the application by using the dependency injection along with reduced code coupling.
It allows the reuse of the existing components, saving the developers time.
It is not required to have an application server and is capable of working on the enterprise service.
Ans: Below are the four different types of JSP tags available. They are:
Ans: SSL or Secure socket layer is referred to as a technology that is helpful for establishing communication between the web browser and web server. It is also referred to as a protocol that helps us understand how the algorithms are designed to be used in encryption. It is responsible for establishing a link between the two different parties. This link will be used for the secured transmission of the information. Secure or sensitive information could be card information, social security numbers, login credentials, etc.
Ans: EJB stands for Enterprise Java Beans. EJB is referred to as a server-side container that performs the execution in the EJB container and is responsible for encapsulating the business logic for the application of the enterprise.
There are two main types in EJB with different subtypes as well. They are listed below.
Ans: JSP directive is referred to as a mechanism that is responsible for providing the metadata information to the web containers with respect to the JSP file. The metadata is used by the web container during the compilation and translation phases of the JSP lifecycle.
Below are the three different types of JSP directives.
Ans: HQL stands for Hibernate Query Language. The HQL language provides the users with the flexibility to express their queries through the portable SQL extension. It also provides the flexibility to the user to express in native SQL.
Hibernate Proxy: Hibernate proxy is referred to as the object proxy that includes the way or process to avoid retrieving the object unless and until you need it. By default, Hibernate 2 is not capable of providing the proxy objects.
Ans: A thin client is referred to as a program interface to the application that does not include any operations like the execution of the business rules which are complex, querying of the databases, establishing connections to the legacy applications.
Ans: URN refers to Uniform Resource Name. URN refers to a unique identifier that is responsible for identifying an entity. The information about the entity location will not be available.
Ans: It is Java 2 Enterprise Edition. This is based on Application programming interfaces(APIs), a set of services and protocols.
Types of components:
Ans: Spring is used for the development of enterprise application in an open-source framework, that solves the complexity of enterprise application development, which is primarily based on inversion control or dependency injection design pattern.
Ans: Dependency injection can be used to improve testability. It decreases coupling in code and increases maintainability. Increase productivity and subsequently decreases the development cost. Spring required enterprise services without the need for an expensive application server.
Ans: Servlet installation. Request handling The init method Removal from the service. Servlet class loading.
Ans: A servlet interface must be executed by all servlets.
Ans: Yes, it is a pure java object.
Ans: Yes, we can create objects without using new, here is an example:
Ans: Calendar c=Calender.getInstance();
Ans: 7 types of are there in spring, they are:
Ans) The modules in the J2EE Application are delivered by EAR File. it is nothing but an extension file, like a .ear extension.
Ans: Bag, Map, Array, Set, and List.
Ans: There are 4 JSP tags, they are Expressions. Scripts. Declarations Directives.
Ans: Vendor independence Performance Maintainability Productivity.
As you know that is a high demand for developing the applications as the customers are expecting new evolvements and enhancements. Business organizations are keeping up their efforts by ensuring that they are choosing the right language for the implementation of their projects or developments. Hence, looking for individuals who are expertized or knowledgeable has become common these days. And I know you are trying to crack the interview and grab one of the positions. These interview questions will definitely help you in cracking the interview. I wish you all the best for the interview and also for your future endeavours.
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .
Write For Us