J2EE Interview Questions
J2EE Interview Questions
Q. What is the Java 2 Platform Enterprise Edition (J2EE)?
The Java 2 Platform Enterprise Edition (J2EE) is a set of coordinated specifications and practices that together enable solutions for developing, deploying, and managing multi-tier server-centric applications. Building on the Java 2 Platform, Standard Edition (J2SE), the J2EE platform adds the capabilities necessary to provide a complete, stable, secure, and fast Java platform to the enterprise level. It provides value by significantly reducing the cost and complexity of developing and deploying multi-tier solutions, resulting in services that can be rapidly deployed and easily enhanced.
Q. What are the main benefits of the J2EE platform?
The J2EE platform provides the following:
Complete Web services support. The J2EE platform provides a framework for developing and deploying web services on the Java platform. The Java API for XML-based RPC (JAX-RPC) enables Java technology developers to develop SOAP based interoperable and portable web services. Developers use the standard JAX-RPC programming model to develop SOAP based web service clients and endpoints. A web service endpoint is described using a Web Services Description Language (WSDL) document. JAX-RPC enables JAX-RPC clients to invoke web services developed across heterogeneous platforms. In a similar manner, JAX-RPC web service endpoints can be invoked by heterogeneous clients. For more info, see http://java.sun.com/webservices/.
It provides faster solutions delivery time to market. The J2EE platform uses “containers” to simplify development. J2EE containers provide for the separation of business logic from resource and lifecycle management, which means that developers can focus on writing business logic — their value add — rather than writing enterprise infrastructure. For example, the Enterprise JavaBeans (EJB) container (implemented by J2EE technology vendors) handles distributed communication, threading, scaling, transaction management, etc. Similarly, Java Servlets simplify web development by providing infrastructure for component, communication, and session management in a web container that is integrated with a web server.
It provides freedom of choice. J2EE technology is a set of standards that many vendors can implement. The vendors are free to compete on implementations but not on standards or APIs. Sun supplies a comprehensive J2EE Compatibility Test Suite (CTS) to J2EE licensees. The J2EE CTS helps ensure compatibility among the application vendors which helps ensure portability for the applications and components written for the J2EE platform. The J2EE platform brings Write Once, Run Anywhere (WORA) to the server.
It provides simplified connectivity. J2EE technology makes it easier to connect the applications and systems you already have and bring those capabilities to the web, to cell phones, and to devices. J2EE offers Java Message Service for integrating diverse applications in a loosely coupled, asynchronous way. The J2EE platform also offers CORBA support for tightly linking systems through remote method calls. In addition, the J2EE platform has J2EE Connectors for linking to enterprise information systems such as ERP systems, packaged financial applications, and CRM applications.
By offering one platform with faster solution delivery time to market, freedom of choice, and simplified connectivity, the J2EE platform helps IT by reducing TCO and simultaneously avoiding single-source for their enterprise software needs.
Q. Can the J2EE platform interoperate with other WS-I implementations?
Yes, if the other implementations are WS-I compliant.
Q. What technologies are included in the J2EE platform?
The primary technologies in the J2EE platform are: Java API for XML-Based RPC (JAX-RPC), JavaServer Pages, Java Servlets, Enterprise Java Beans components, J2EE Connector Architecture, J2EE Management Model, J2EE Deployment API, Java Management Extensions (JMX), J2EE Authorization Contract for Containers, Java API for XML Registries (JAXR), Java Message Service (JMS), Java Naming and Directory Interface (JNDI), Java Transaction API (JTA), CORBA, and JDBC data access API.
Q. What’s new in the J2EE 1.4 platform?
The Java 2 Platform, Enterprise Edition version 1.4 features complete Web services support through the new JAX-RPC 1.1 API, which supports service endpoints based on servlets and enterprise beans. JAX-RPC 1.1 provides interoperability with Web services based on the WSDL and SOAP protocols. The J2EE 1.4 platform also supports the Web Services for J2EE specification (JSR 921), which defines deployment requirements for Web services and utilizes the JAX-RPC programming model. In addition to numerous Web services APIs, J2EE 1.4 platform also features support for the WS-I Basic Profile 1.0. This means that in addition to platform independence and complete Web services support, J2EE 1.4 offers platform Web services interoperability.
The J2EE 1.4 platform also introduces the J2EE Management 1.0 API, which defines the information model for J2EE management, including the standard Management EJB (MEJB). The J2EE Management 1.0 API uses the Java Management Extensions API (JMX). The J2EE 1.4 platform also introduces the J2EE Deployment 1.1 API, which provides a standard API for deployment of J2EE applications.
The J2EE platform now makes it easier to develop web front ends with enhancements to Java Servlet and JavaServer Pages (JSP) technologies. Servlets now support request listeners and enhanced filters. JSP technology has simplified the page and extension development models with the introduction of a simple expression language, tag files, and a simpler tag extension API, among other features. This makes it easier than ever for developers to build JSP-enabled pages, especially those who are familiar with scripting languages.
Other enhancements to the J2EE platform include the J2EE Connector Architecture, which provides incoming resource adapter and Java Message Service (JMS) pluggability. New features in Enterprise JavaBeans (EJB) technology include Web service endpoints, a timer service, and enhancements to EJB QL and message-driven beans. The J2EE 1.4 platform also includes enhancements to deployment descriptors. They are now defined using XML Schema which can also be used by developers to validate their XML structures.
Q. What is the J2EE 1.4 SDK?
The Java 2 SDK, Enterprise Edition 1.4 (J2EE 1.4 SDK) is a complete package for developing and deploying J2EE 1.4 applications. The J2EE 1.4 SDK contains the Sun Java System Application Server Platform Edition 8, the J2SE 1.4.2 SDK, J2EE 1.4 platform API documentation, and a slew of samples to help developers learn about the J2EE platform and technologies and prototype J2EE applications. The J2EE 1.4 SDK is for both development and deployment.
Q. Which version of the platform should I use now — 1.4 or 1.3?
The J2EE 1.4 specification is final and you can use the J2EE 1.4 SDK to deploy applications today. However, for improved reliability, scalability, and performance, it is recommended that you deploy your applications on J2EE 1.4 commercial implementations that will be available early in 2004. If you want to deploy your application before 2004, and reliability,scability, and performance are critical, you should consider using a high performance application server that supports J2EE v1.3 such as the Sun Java System Application Server 7. Many application server vendors are expected to release J2EE platform v1.4 versions of their product before the spring.
Q. Can applications written for the J2EE platform v1.3 run in a J2EE platform v1.4 implementation?
J2EE applications that are written to the J2EE 1.3 specification will run in a J2EE 1.4 implementation. Backwards compatibility is a requirement of the specification.
Q. How are the J2EE architecture and the Sun Java Enterprise System related?
The J2EE architecture is the foundation of the Sun Java System Application Server, a component of the Sun Java Enterprise System. The Sun Java System Application Server in the current Sun Java Enterprise System is based on the J2EE platform v1.3, with additional support for Web services. Developers familiar with J2EE technology can easily apply their skills to building applications, including Web services applications, using the Sun Java Enterprise System. For more information, see the Sun Java Enterprise System Web site.
Q. Can I get the source for the Sun Java System Application Server?
You can get the source for the J2EE 1.4.1 Reference Implementation from the Sun Community Source Licensing site. The J2EE 1.4.1 Reference Implementation is the Sun Java System Application Server Platform Edition 8 minus the following components:
The Web-based administration GUI
JavaServer Faces 1.0 and JSTL 1.1
Solaris specific enhancements for security and logging
Higher performance message queue implementation
Q. What tools can I use to build J2EE applications?
There are numerous choices of tools available for developing Java and J2EE applications. You can download the Open Source NetBeans IDE for free at http://netbeans.org. Many of the J2EE compatible vendors offer tools that support any J2EE compatible application server.
Q. Who needs the J2EE platform?
ISVs need the J2EE platform because it gives them a blueprint for providing a complete enterprise computing solution on the Java platform. Enterprise developers need J2EE because writing distributed business applications is hard, and they need a high-productivity solution that allows them to focus only on writing their business logic and having a full range of enterprise-class services to rely on, like transactional distributed objects, message oriented middleware, and naming and directory services.
Q. What does Sun mean by “Free” platform use?
When Sun says “Free” it means that you don’t pay Sun to develop or deploy the J2EE 1.4 SDK or the Sun Java System Application Server Platform Edition 8. Free means that you don’t pay Sun for supplementary materials including documentation, tutorials and/or J2EE Blueprints. You are also free to bundle and distribute (OEM) Sun Java System Application Server Platform Edition 8 with your software distribution. When we say “Free”, we mean “Free for all”.
Here are some examples of how you can use Sun Java System Application Server Platform Edition 8 for free.
If you are a developer you can build an application with the J2EE 1.4 SDK and then deploy it on the Sun Java System Application Server Platform Edition 8 (included with the J2EE 1.4 SDK or available separately). No matter how many developers are on your team, all of them can use the J2EE 1.4 SDK at no charge. Once your application is ready for production, you can deploy including the Sun Java System Application Server Platform 8 Edition in production on as many servers or CPUs as you want.
If you are an ISV, you don’t have to pay to include Sun Java System Application Server Platform Edition 8 with your product, no matter how many copies of your software that you distribute. Bundling Sun Java System Application Server Platform Edition 8 makes good business sense because it ensures that you are distributing a J2EE 1.4 platform compatible server that doesn’t lock you or your customers into a proprietary product. ISV’s that wish to bundle Sun Java System Application Server Platform Edition 8 (for free of course) should contact Sun OEM sales.
If you are a System Administrator or IT manager, you can install Sun Java System Application Server Platform Edition 8 on as many servers and CPUs as you wish. Using Sun Java System Application Server Platform Edition 8 also gives reduced cost and complexity by saving money on licensing fees and the assurance of a J2EE 1.4 platform compatible application server that can be used with other J2EE 1.4 platform compatible application servers.
Q. Is technical support “Free” as well?
A: There are resources that are available for free on the Sun Solaris website that may help you resolve your issues without requiring technical support. For example you can ask questions on the forum, search for known issues on the bug data base, review the documentation, or take a look at code samples and applications to help you at no cost.
Production support is also available for a fee through Sun Service. For more information about Developer Technical Service and Sun Service, you can go visit: http://wwws.sun.com/software/products/appsrvr/support.html.
Q. Are there compatibility tests for the J2EE platform?
Yes. The J2EE Compatibility Test Suite (CTS) is available for the J2EE platform. The J2EE CTS contains over 5,000 tests for J2EE 1.4 and will contain more for later versions. This test suite tests compatibility by performing specific application functions and checking results. For example, to test the JDBC call to insert a row in a database, an EJB component makes a call to insert a row and then a call is made to check that the row was inserted.
Q. What is the difference between being a J2EE licensee and being J2EE compatible?
A J2EE licensee has signed a commercial distribution license for J2EE. That means the licensee has the compatibility tests and has made a commitment to compatibility. It does not mean the licensees’ products are necessarily compatible yet. Look for the J2EE brand which signifies that the specific branded product has passed the Compatibility Test Suite (CTS) and is compatible.
Q. What is the relationship of the Apache Tomcat open-source application server to the J2EE SDK?
Tomcat is based on the original implementation of the JavaServer Pages (JSP) and Java Servlet specifications, which was donated by Sun to the Apache Software Foundation in 1999. Sun continues to participate in development of Tomcat at Apache, focusing on keeping Tomcat current with new versions of the specifications coming out of the Java Community Source Process. Sun adapts and integrates the then-current Tomcat source code into new releases of the J2EE SDK. However, since Tomcat evolves rapidly at Apache, there are additional differences between the JSP and Servlet implementations in the J2EE SDK and in Tomcat between J2EE SDK releases. Tomcat source and binary code is governed by the ASF license, which freely allows deployment and redistribution.
Q. How is the J2EE different from Java EE 5 SDK?
The Java EE 5 SDK provides a complete implementation of the Java EE 5 specification along with extra features to help developers learn about what’s new and improved in the specification. The Java EE 5 SDK includes the Sun Java System Application Server Platform Edition 9, the Java SE platform as its foundation, and various tools to help developers’ prototype Java EE applications and learn about the Java EE platform and technologies.
Q. What is an EJB Platform?
The Enterprise JavaBeans or EJB platform handles functions such as transaction and state management, multithreading, resource pooling, and simple searches while you concentrate on writing business logic.
Q. What is the JavaMail API?
The JavaMail API provides a set of abstract classes that model a mail system. The API provides a platform independent and protocol independent framework to build Java technology based email client applications.
Q. What are the design goals of J2EE architecture?
The following are the design goals of J2EE architecture:
a) Service Availability:The application should be available 24 * 7. The business depends on the application without the need for customer service representatives
b) Data Connectivity:The application should be able to connect to mainframe systems and other legacy systems to ensure business functions as usual
c) Accessibility:User should be able to connect the application from anywhere and from any electronic devices
d) User Interaction:The user should be able to connect to the application from desktop, laptop, PDA, and mobile
e) Flexibility:The architecture should be created in such a way that the developer just concentrates on the business component model (business logic) and the rest of the services are handled by the server
Q. What are the roles of J2EE Architect?
The following are the roles of J2EE architect:
a) Visualizing the behavior of the system
b) Creating the system blue print
c) Defining the way how the system elements work together
d) Defining non-functional and functional requirements
e) Integrating non-functional requirements into the functional system
Q. What is the difference between architecture and design?
Architecture defines the structural issues, communication protocols, data access, synchronization, and subsystems’ classification. It also defines the architectural design of the component interfaces.
In Design, we define the components to be created for each interface, the inputs, the outputs, algorithms, and data structures. In short, the designers describe each component’s internal details.
Q. What are the activities performed in Architectural Analysis?
The following activities will be performed in Architectural Analysis:
a) Use case diagram:This is developed to depict the high level system functionality
b) Class Diagram:This is developed to depict the functionality as classes and methods
c) Collaboration Diagram:This is developed to depict how each class talk to each other
d) Sequence Diagram:This is developed to depict the operation sequence
Q. What are the activities performed in Architectural Design?
The following activities will be performed in Architectural Design:
a) The framework (example: Remote Method Invocation) to be used will be decided
b) The software and hardware requirements are defined
c) The performance parameter and the approach to achieve will be defined
d) Analyze for reusing existing components or technology
e) Define the business logic, security, and performance of the system
6: What are the activities performed in the object oriented design?
The following activities will be performed in object oriented design:
a) Decide on how classes interact with packages
b) Create dependency diagrams
c) Create deployment diagrams
d) Decide if the components (software) reside in deployment folder
Q. What are the components of multi-tier architecture?
The following are the components of multi-tier architecture:
a) Presentation Tier:The front end component is present in this tier which is used to display the presentation
b) Resource Tier:The back end component is present in this tier which is used to communicate with database
c) Business Tier:The component present in this tier is used to provide business logic for the system
Q. What are the advantages of multi-tier client server architecture?
The following are the advantages of multi-tier client server architecture:
a) Changes to business logic or user interface can be made independently
b) The client accesses data easily without knowing where data comes from and how many servers available for the system
c) The DB (database) connections can be pooled so that the data can be shared for several users without making DB request for each user
d) The middle tier component (business logic) can be written in any standard programming languages such as C or Java
Q. What are the responsibilities of the bean developer?
The following are the responsibilities of the bean developer:
a) Write the systems business logic in java
b) Integrate java components with third party components
c) Control access and set transaction parameters
d) Create home interface to find the beans and remote interface to create business logic
e) Create the deployment descriptor xml
Q. What are the responsibilities of application assembler?
The following are the responsibilities of application assembler:
a) Build presentation layer i.e., user interface
b) Specify the requirements of transaction management
c) Set transaction parameters for all the bean’s methods
d) Define security roles and assign permissions
e) Specify wild card character (*) to the methods
Q. What are the responsibilities of bean deployer?
The following are the responsibilities of bean deployer:
a) Map fields to DB (database) columns and manage persistence
b) Define users, groups, roles, and manage security
c) Use the deployment tools and generate wrapper classes
d) Map user roles and groups
e) Ensure all the deployed bean is assigned a transaction parameter
Q. What are the roles of third party software in EJB framework?
The third party companies that provide the software can play any of the following three roles:
a) Component Provider:Responsible for developing object modeling, programming, architecture, and business process
b) Container Provider:Responsible for proving the environment during runtime to the server
c) Application Server Provider:Responsible for providing platform to develop distributed applications. It usually contains the container which provides the runtime environment
Q. Explain MVC architecture.
MVC represents Model View Controller architecture. The activity performed in MVC is explained below:
a) In Model, the developer creates the business logic of the system
b) In View, the developer creates the presentation logic
c) In Controller, the developer receives the request and transfers the response
Q. Explain EAR, WAR, and JAR.
EAR represents Enterprise Archive file. It contains the components of web, EJB, and client. All the components are packed in a compressed file called .ear file.
WAR represents Web Archive file. It contains all the components related to the web application. All the components are packed in a compressed file called .war file.
JAR represents Java Archive file. It contains all the class files and library files which constitute an API (Application Programming Interface). All the components are packed in a compressed file called .jar file.
Q. Explain JTA, JNDI, and JMS.
JTA represents Java Transaction API. It is used for coordinating and managing transactions across enterprise information system.
JNDI represents Java Naming Directory Interface. It is used for accessing information from directory services.
JMS represents Java Messaging Service. It is used for receiving and sending messages through messaging systems.
Q. Explain EDI.
EDI represents Electronic Data Interchange. It is used for exchanging data through Value Added Network (VAN) which acts as the transmission medium.
EDI is expensive to install and requires customization by the exchanging clients. EDI also relies on X12 standards to interchange documents.
Q. Explain EAI?
EAI represents Enterprise Application Integration. This makes one or more applications as single application and requires data to be transmitted to the appropriate system at the right time.
For example, while integrating sales and account systems, it is necessary for sales to send sales order to accounting to generate invoice. Also, accounting must send an invoice to sales to update data for the sales professionals.
This system handles transaction automatically across application and eliminates human errors.
Q. What is the intent for supporting XML in Java?
The intent to support XML is to:
a) Ensure Java developers understand XML easier and use XML and XML developers use Java
b) Provide standard for Java to ensure consistent and compatible implementations
c) Ensure java platform can be integrated with high quality
Q. What are the protocols used for communicating between business tier and user interface?
The following protocols are used for communicating between business tier and user interface:
a) HTTP:It denotes ‘Hyper Text Transfer Protocol’
b) JMS:It denotes ‘Java Messaging Service’
c) RMI:It denotes ‘Remote Method Invocation’
d) CORBA:It denotes ‘Common Object Request Broker Architecture’
e) DCOM:It denotes ‘Distributed Component Object Model’
Q. What are the advantages and disadvantages of HTTP protocol?
The following are the advantages of HTTP protocol:
a) Stateless and firewall friendly
b) Easier to load balance and scale HTTP servers
The following are the disadvantages of HTTP protocol:
a) Difficult to maintain user sessions
b) Limited communication with JSP and servlets
Q. Explain JRMP.
JRMP represents Java Remote Method Protocol. This is used by Remote Method Invocation (RMI) to pass java objects as arguments.
Since Java relies on Object Serialization which marshal objects as stream, RMI relies on the protocol JRMP to transfer objects from one JVM (Java Virtual Machine) to another.
Q. What are the advantages and disadvantages of CORBA?
The following are the advantages of CORBA:
a) Supports heterogeneous object
b) Extends the capabilities of ORB (Object Request Broker)
The following are the disadvantages of CORBA:
a) Objects cannot be passed, only arguments can be passed
b) Accepted types of data can only be passed
Q. Explain DCOM.
DCOM represents Distributed Component Object Model. This uses ORPC (Object Remote Procedure Call) protocol to support remote objects.
ORPC is built on top of RPC (Remote Procedure Call) and interact with runtime services. DCOM supports multiple interfaces and the components can be created in various programming languages. Example of languages are: Java, C, Visual Basic, etc. DCOM is widely used in windows platform.
Q. Explain the capabilities of J2EE architecture.
The following are the capabilities of J2EE architecture:
a) Performance:performs functionality in a short time frame
b) Scalability:Supports even if the load on the server increases
c) Availability:The system is always accessible across 24 * 7
d) Flexibility:Change in hardware or architecture does not impact the system
e) Security:The information cannot be hacked and modified
f) Reusability:The component created for a system can be reused and save development time
Q. Explain System architecture and Reference architecture.
System architecture represents the architecture as product. This comprises the component functions, interfaces of the proposed system, constraints, and interactions. This is the base for application design implementation.
Reference architecture represents architecture as method or style. For a specific domain, reference architecture refers coherent design principle.
Q. Explain Best Practice.
Best Practice can be defined as follows:
a) Technique that drives your application design at component level
b) Process recognized by the fellow team members who work on a similar project
c) Takes design or system requirement into consideration
d) Applicable to the entire software development life cycle
Q. Explain the J2EE tiers.
J2EE has the following tiers:
a) Client Tier:It represents the browser from which request is sent to the server. The interfaces used in this tier are HTML browser, java application, an applet, or a non-java application.
b) Middle Tier:It comprises of presentation tier, business tier, and integration tier. The user interface is created in the presentation tier using JSP. The business logic is written in the business tier using EJB. The database objects are created in the integration tier.
c) Backend: This constitutes the Enterprise Information System (EIS) which is used to store data.
Q. What are the best practices to be followed in the presentation layer?
The best practices to be followed in the presentation layer are explained below:
a) Separate Hyper Text Markup Language (HTML) from java
b) Always write business logic in a Bean class
c) Use JSP templates and comments
d) Use Model View Controller (MVC) Pattern
e) Use custom libraries and tag handlers
Q. What type of components is used in MVC?
MVC represents Model View Controller. The component used in Model, View, and Controller is explained below:
a) An application represents the Model which constitutes the system’s state. The systems state is created as business logic in a Bean class
b) The user interface represents the View which is created using Java Server Pages
c) The request received from the client is always the controller which is created using Servlets
Q. What are the requirements that a J2EE system must possess to operate in a global economy?
The J2EE system must possess the following to operate globally:
a) Financial Considerations:The method of payment to buy an item should contain many forms as not all the visitors will have a credit card. Also, a government has its own taxes, custom restrictions and tariffs.
b) Language Requirements:The application should support multiple languages and it has to be country specific.
c) Legal Differences:Customs laws and privacy requirements are different for each country and each government has restrictions on images, ideas, and speeches.
Q. What are the best practices to be followed in DAO?
DAO represents Data Access Object. The best practices to be followed in DAO are explained below:
a) DAO should not be coupled tightly to the business logic
b) Each enterprise bean should be associated with a DAO class
c) DAO should be used only to access data from DB
d) DAO should be written in such a way that it allows cross schema and database capability
e) DAO should be written in such a way that it supports portability
Q. Explain Guideline.
Guideline refers to rule or agreement on operations which are developed by the professionally recognized organization or associations. It also includes approved formal proprietary standards to be followed during the project activities.
Example for a Guideline is: Analysts attempting to maximize data content to reduce network traffic.
Q. What are the best practices to be followed in VO?
VO represents Value Object. The best practices to be followed in Value Objects are explained below:
a) VO should contain business objects with get and set methods
b) VO should update the model bean object with the respective value
c) VO should not reference an object on the server
d) VO should represent a value from the server
Q. What are the best practices to be followed in session bean façade?
The following are the best practices to be followed in session bean façade:
a) It should reduce remote call to the application server
b) Apply transactional scope to methods which calls entity bean group
c) Simplify the client tier code so that business logic gets executed only on the application server
d) Coding should be done in such a way that it identifies user permissions and provide flexibility and reusability
Q. What are the benefits of Model View Controller (MVC)?
The following are the benefits of MVC:
a) Separates data model from user interaction and data display and clarifies application design
b) Allows viewing data in many forms and by large number of users
c) Enhances reusability by separating functionality from presentation
d) Increases flexibility and improves extensibility
e) Encapsulates application functions and facilitates maintenance
f) Supports incremental updates and divides deployment