1. What is an Application Server?
An application server is a program that handles all application operations between users and an organization’s backend business applications or databases. An application server is software that doesn’t do regular stuff like sell your stocks or let you write documents. A server’s users aren’t people; the server’s users are other applications. Application servers provide services to distributed applications. These services include security, data integrity, and resource management (making sure there’s enough memory to go around). These services are already written up and ready for you the application developer to take advantage of. All you have to do is write your application to hook up to an application server.
2. What are different kinds of application servers?
There are lots of different kinds of application servers. J2EE is one kind of application server. CICS and Tuxedo are other types of application servers. The one that comes in .NET is another.
3. What are the different services provided by the J2EE Application Server?
A J2EE application server gives you three main categories of services:
Security – The J2EE application server takes care of security. Security makes sure people who aren’t authorized to get at the application, or to do things that aren’t authorized, can’t do stuff they shouldn’t. It keeps a list around of what each part of the application can and can’t be asked to do, and by whom. And more.
Data integrity – The server manages transactions. This capability also helps the application get information in and out of the database without screwing up the data.
Resource Management – The server takes care of resource management. One aspect of this is ensuring that memory used by one part of the application gets freed up and available for use by other parts. The container can also create ready-made connections to the database to make database access quicker and cheaper.
4. Which applications need J2EE and what are the characteristics of a Distributed application?
Applications that need J2EE are Distributed Enterprise System. Distributed means that the application, including the data, is two or more different computers.
Two basic things create the need to be distributed:
Being online means you’re distributed automatically. Not all online applications need to use J2EE, but being online does mean you’re distributed.
Having a lot of users means you probably want to be distributed. The more different computers you can use, the more computer power you have to run your application, and you’ll need a lot in order to make the application run fast enough for all those users. The more users you have, the more storage space you’ll need for user data, as well.
5. What is the Java 2 Platform, Enterprise Edition (J2EE)?
Enterprise Edition (J2EE)
J2EE isn’t a specific application server product. It’s a standard, a type, rather than a specific server product.
J2EE is a standard for creating servers. A standard is just a set of rules people follow to make things easier and more consistent. If you try to hook a J2EE application up to a non-J2EE application server, it wouldn’t work because they use different standards.
J2EE is an open standard. Sun gives people instructions for how to write servers, and applications, to the J2EE standard. This is unusual because software companies usually like to keep how to make their applications to themselves, but not in this case. Anyone can download the specification and write themselves a J2EE application server.
That means two things.
First, there’s a lot of choice when you’re shopping for a J2EE application server: BEA WebLogic, IBM WebSphere, Sun’s Java enterprise System, and so on. All those companies have downloaded the information for how to build J2EE application servers, and built them.
Second, that you’re not stuck. Let’s say you’ve bought a J2EE application server. If you don’t like your first pick – maybe the company doesn’t give good customer service or they’re overpriced – you can go out shopping again for a J2EE application server from a different company.
Once you get the new application server, switching your application to it goes relatively easy. All the J2EE application servers work fundamentally the same way.
6. Is J2EE a platform?
Yes, J2EE is a platform. A platform is a large collection of features that can be used by a bunch of different applications. The features are administrative things, not central to what the applications do, but still necessary. And the features provided by platforms are generally difficult enough to write. It’s nice to just be able to hook up to them rather than to write the code for them yourself.
7. What are J2SE, J2ME, and J2EE?
The splitting of Java resulted in what’s explained below.
J2SE – Java 2 Standard edition. The basics for writing regular programs that probably aren’t going to stray too far from their home computer. If you wrote a regular text editor application in Java that just runs on one person’s local computer, you’d be using the Standard Edition, J2SE.
J2EE – Java 2, Enterprise Edition. These are the big tools that are used to create servers and the applications that work with them. These are the tools for handling applications that have separate bits working together and distributed all over the world.
8. What are the components of a J2EE Application Server?
J2ME – Java 2 Micro Edition. Java that does stuff that’s similar to J2SE, but generally smaller cuter applications and on pagers, PDAs, smart cards, etc.
A J2EE application server is actually one or more pieces of software that together make the application server product. There are usually a couple containers, some deployment tools, and a Web server.
9. What is a Container?
The container program is what gives you the services of Security, data Integrity, and Resource Management. The container does all the smart stuff: takes requests from the clients and relays the appropriate messages to the application, takes care of security and sends data to and from the database.
10. How the Container interacts with the Application and the user?
The applications never interact directly with the outside world. Requests that come in from customers go through the container, and the container tells the application what to do. The application does it, tells the container, and the container does what’s necessary to report back to the customer.
11. What are the different kinds of Containers for different types of J2EE application code?
Different kinds of Containers are the Web container, the EJB container, and the Web server.
12. What is an EJB and what are the services provided by the EJB Container?
EJBs is short for Enterprise Java Beans. Enterprise Java Beans are powerful code that can do business logic for you. And represent your application’s objects like customers, products, and so on.
Business Logic is the guts of your application, and the kind of beans that do that are session beans. The kind of beans that represent the main things in your application like customers are called entity beans.
The EJB container provides all three of the services: Data integrity, security and resource management. The Web container, by way of contrast, only gives security.
13. What are the different tiers in a J2EE application?
The different tiers, a J2EE application is generally divided into are:
Presentation tier – The presentation tier mainly concerns with presentation logic generally implemented by servlets and jsps.
Business tier – Business tier contains business components such as EJBs implementing logic.
Database tier – Database tier contains persistent data generally stored in a RDBMS such as Oracle, DB2 and so on.
14. What are JavaServer Pages, or JSPs?
JSP is server-side technology, which combines both- application logic (java code) and presentation logic (HTML code), so that HTML designers and java code developers can work in tandem (simultaneously) by providing there max skills on the application.
JSPs are HTML with a little java code inside.
15. What are servlets?
A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers. For such applications, Java Servlet technology defines HTTP-specific servlet classes.
16. What is the difference between Servlets and JSPs?
JSP is Java code embedded in HTML. The Java code is compiled (if necessary) and run by the container on the server and the client only sees the results of that code’s execution mixed in appropriately with the html.
Servlets are compiled pure Java class files (not mixed with HTML) where the entire html page can be generated.
17. What are the different types of Enterprise JavaBeans?
Enterprise JavaBeans
There are three kinds of EJBs:
Entity beans
Session beans
Message-driven beans
18. What is an Entity Bean?
The entity bean is used to represent data in the database. Entity beans are the only things that have to deal with the database and all the complexity therein. 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).
19. What is a Session Bean?
Session beans are all about functionality, application logic, and application state. Session beans are usually associated with one client. Each session bean is created and destroyed by the particular EJB client that is associated with it. These beans do not survive after system shutdown.
There are two types of session beans: stateful session beans and stateless session beans.
Stateful session beans maintain conversational state between subsequent calls by a client.
The statefulness in their name has to do with the state, the data, gathered from the client they are working with. They carry around a lot of data with them which make them useful in that respect, but slower.
Stateless session beans are just used to service clients regardless of state. They don’t carry around any state with them from one client request to another, so they are generally zippier than stateful session beans when it comes to performance.
20. What is a Message-Driven Bean?
A message-driven bean is an enterprise bean that allows J2EE applications to process messages asynchronously. It does not have Home and Remote interface as Session or Entity bean. It is called by container when container receives JMS asynchronous message.
21. What is the difference between JavaBeans and Enterprise JavaBeans?
Enterprise JavaBeans
Java Beans and EJBs are used for different purposes altogether, though both specifications are provided by Sun micro Systems. Java Beans are mainly meant for building extendable components and typically contain getters and setters for all its data members, along with other required functionality. EJBs are server side programs that typically implement middle layer business functionality, providing 3 – layer architecture for applications. EJBs can be Entity, Session or Message depending on the required functionality. Most of the critical services are provided by EJB containers and thus allowing the programmer to concentrate on the business logic on hand.
22. What is Deployment Descriptor?
Some of how a J2EE application runs is controlled by a configuration file called a deployment descriptor. If you want to change any of the settings, you just change the information in the deployment descriptor. No touching the code and risking breaking something else in the code; just a nice neat little configuration file. (You still have to redeploy the application, which is not a trivial task, but at least you don’t have to touch the code.)
23. What Deployment Descriptors are made of?
The file is created in XML. XML stands for eXtensible Markup Language. XML is a highly structured, user extensible, data-centric way to represent data. This just means that you can pretty much do whatever you want with it if you set it up right, and it can do a lot.
There’s an XML deployment descriptor for EJBs, and for servlets and JSPs.
One thing that makes XML so popular and an obvious choice for J2EE is that XML is platform independent; any computer can read XML. XML is relatively easy for a computer program to read and do stuff with, and surprisingly at the same time, humans can usually look at it and get the gist, as well.
24. What are handles?
When you have got the beans and you want one bean to do something with another bean, you need to get a handle to it.
In regular Java, or in any regular object-oriented application, one object tells another object what to do; might call an invoice object’s print method, for instance. To do that, the object needs a reference to the Invoice object. Just a special kind of code that lets you talk to that object.
J2EE is a little different since you don’t get to have a reference to the object itself; you get a reference to a bean’s remote interface which is kind of like the bean’s personal manager. You can’t get to the bean itself. And so since the mechanics are a little different, the EJB folks called the reference something different: a handle. A handle is just an EJB-style reference.
25. How is the Web Container different from the Web server?
Basically, the Web container is different from the Web server because it manages dynamic content. Dynamic content is a file that does not exist already and is created on the fly by some programming logic.
Some content needs to be very up to date, and to ensure this content is up to date, you create it dynamically.
You can write a servlet that would query the database and create the HTML page for you right there, on the fly. That created information would be dynamic content. And instead of saving it to a file you can have that same servlet send its output directly to the Web server, which in turn displays it to the user. The Web container is responsible for starting the servlet and directing the servlet’s output to the Web server.
Related posts:
Tags: Business tier, Components of a J2EE Application Server, Container interacts with the Application and the user, Database tier , Deployment Descriptor, Difference between JavaBeans and Enterprise JavaBeans, Difference between Servlets and JSP, Different tiers in a J2EE application, Different types of Enterprise JavaBeans, Distributed Enterprise System, EJB container, Entity Bean, Handles, How is the Web Container different from the Web server, J2EE Frequently Asked Questions, J2EE Interview Questions, J2EE Technical Questions, J2EE Tutorial, Java 2 Enterprise Edition, Java 2 Standard edition, Message-Driven Bean, Presentation tier, Services provided by the EJB Container, Servlets, Session Bean, Web container, Web server, What are servlets