J2EE Interview Questions

J2EE Interview Questions

1. What do you understand by the term J2EE?
J2EE is a specification. provides middleware services.
EJB JDBC JNDI JMS JavaMail JTA Servlets JSPs Connectors JAAS

EJB : is Server Side component architecture for developing distributed applications.
Developers need to concentrate only on business logic.
The middleware services are provided by appserver.
(transaction management,persistence, threading,concurreny )


Session Beans : Model processes
Entity Beans : Model data
Message Driven beans : Similar to session beans. Invoked only by sending messages.

2. Diff between RMI and EJB

EJB uses RMI technology.
We have to declare the middleware services needed by the EJB in a descriptor.
The Appserver will generate stubs for the same.

RMI : one has to write the middleware services. (txn mgmt, persitence.)

EJB cannot be invoked directly by remote clients because there are not network enabled.
Location transparency.


3. How many tiers does an J2EE application have? Explain multi-tier applications?

4. What is a web component?
A web componenet is a software entity which runs on a web server, handles requests and generates dynamic web content.

5. What is a web container?
Runtime environment for servlets and jsp
Manages lifecycle of instances
Supports HTTP

6. Should web container always be a part of web server?
No.

7.What are servlets?
8. What are JSP’s?
9.What are web services?
10.Explain SOA?
11. Explain EJB containers?
12.What is the purpose of init() in servlet class?


13. Can servlets have constructors? Can they be used for initializing servlets instead of init()
Yes. But we shouldn’t. Reason being init has access to servlet config and servlet context object , constructors won’t.


14.Name JSP scripting elements?
declarations, scriptlets, expressions.

15.What is SingleThreadModel ?
16. How to implement a thread-safe JSP page? What directive should be added?

‹ %@ page isThreadSafe="false" %


17 .How can we include static files within a JSP page?
Answer: using the JSP include directive.

18.Distinguish between servletconfig and servlet context?
19.What is the difference in between doPost and doGet methods ?
20.Why does EJB needs two interface( Home and Remote Interface) ?
21.Explain deployment descriptors?
22.Why cant we invoke methods on ejbs directly ?
23.Explain clustering and fault tolerance
24.How would you go about analyzing performance of the application

Application performance testing

When performance testing a Web application, several requirements must be
determined either through interpretation of data from an existing application that
performs similar work. Those requirements are:

User base
What is the expected number of users that will access this application? This is
generally expressed in hits per month, day, hour, or minute depending on
volumes.

Total concurrent users

During a peak interval, what is the maximum possible number of users
accessing the application at the same time.

Peak request rate
How many pages will need to be served per second?