INTRODUCTION TO J2EEJava Enterprise Edition - Sahil Kukreja (C.S.E – 5th B)
WHAT IS J2EE ? Java EE is Oracle’s enterprise Java computingplatform. Platform provides an API and runtime environment fordeveloping and running enterprise software. Java EE extends the Java Platform, StandardEdition (Java SE/J2SE), providing an API for object –relational mapping, distributed and multi-tier architectures.
WHAT MAKES A PLATFORM? J2EE is neither a hardware(it can run on any hardwarewith apt JVM) , nor a software exactly (J2EE-compatiblesystems available). So what sort of a platform is J2EE ? In the world of software, a platform is a combination ofhardware and software necessary to run applications.
PLATFORM REQUIREMENTS Consistency : Consistency is a basic platformrequirement. Applications depend on platforms to provide aspecific set of well-known services. Adoption : Adoption provides established platforms withenormous momentum and market clout. Openness : Some degree of openness is necessary forsoftware vendors to develop products for a platform. Specification : The platform specification defines theplatform, usually in terms of required APIs, policies, andinterfaces.
J2EE – BUILDING BLOCKS Servlets : A servlet is a small Java program that runswithin a Web server. Servlets receive and respond torequests from Web clients, usually across HTTP. JSP : With JSP you could write HTML in a JSP file, andthe server would automatically create a servlet from thepage. JSP also allows you to write blocks of Java codeinside the JSP. Web Frameworks : The shortcomings of plain servletsand JSP sparked the creation of many Webframeworks that intended to make Web applicationdevelopment easier.
A timeline with the release dates of some Web frameworks.Most of them are Java frameworks, but some other ones are included.
J2EE HISTORYThe original J2EE specification was developed by SunMicrosystems.The year 2000 has seen J2EE compliancy move out ofrealm of marketing and into nine shipping products. JSR 58 specifies J2EE 1.3 and JSR 151 specifies theJ2EE 1.4 specification. The Java EE 5 specification was developed under JSR244 and the final release was made on May 11 2006. In short, the server side java industry has gonethrough a whirl wind of change.
JAVA WEB APPLICATION SERVERSUnderstanding the differences between a web server, aservlet container and an application server is importantwhen learning how a Java Web application is presented toits end users.The servlet/application/EJB container terms are a bitambiguous, but we will try to come to a workable definition.Let’s take a look.
1. WEB SERVER A Web server handles the HTTP protocol. When the Webserver receives an HTTP request, it responds with anHTTP response.The Web server itself does not dynamically generateresponses, it just handles receiving the request andsending the response.The most commonly used Web serversare Apache, Microsoft IIS and nginx.
2. WEB CONTAINERA Web container (or servlet container) is a program thatprovides an environment for the servlets and JSP to run.The Web container is responsible for managing thelifecycle of servlets, mapping a URL to a particular servletand ensuring that the URL requester has the correct accessrights. So a Web container provides a runtime environment fora subset of the Java EE specification, usually only the JSPand Servlet parts. The most common Web container are Tomcat and Jetty.
3. Application ServerAn application server is a server that provides support forthe entire Java EE specification.In addition it provides the capabilities of a Web Container aswell as of a Web Server.
J2EE DEPLOYMENTHow do you present a Web application to the server?Web applications are packaged in WAR and EAR files.Web containers (e.g. Tomcat) accept WAR files.Application servers (e.g. Glassfish) accept WAR files andEAR files.A Java EE application is delivered in a Java Archive (JAR)file, a Web Archive (WAR) file, or an Enterprise Archive(EAR) file. A WAR or EAR file is a standard JAR file with a .war or.ear extension.
1. JAR : JAVA ARCHIVEA JAR is an archive file format typically used to aggregatemany Java class files and associated metadata andresources into one file to distribute application software orlibraries on the Java platform.A manifest file is a specific file contained within a JARarchive. It is used to define information about the JAR.Application client modules are packaged as JAR files witha .jar extension.
2. WAR : Web Application ARchive A WAR file is a JAR file used to distribute a Web Module. The top-level directory of a web module is the document root of the application. The structure of a WAR file looks like this:
3. EAR : Enterprise ArchiveWhen a large Web application is deployed, all its .jar and .war files are packagedas JAR file with .ear extension and deployed into an application server.Deploying EAR files requires an application server such as Glassfish.Web containers such as Tomcat can not deploy EAR files, only WAR files.EAR file structure :
FUTURE OF JAVA TECHNOLOGYWhen Java was developed initially , even its developerswere not sure in which direction the technology will grow.And actually Java has taken an unexpected turn around asa development technology.Some people say there is no need of separate Core Java,which is now known as J2SE. J2SE comprise of core Javacomponents and libraries like core language library,utilities, SWT, Swing, Networking, Security etc.Let us examine possible directions where there arechances Java will grow as development technology.
NEW TRENDSPeople are always in search of implementing J2EE, away that it can be used optimally.Several new frameworks, practices and design patternsare developed to make proper utilization of advantages ofJ2EE.Some of them are discussed here : Design Patterns : For enterprise applications , it is veryimportant that they are well designed prior to start of theirdevelopment phase because they are large in scale.Some of the design patterns are MVC (Model-View-Controller), DAO (Data Access Objects) and many more.
Frameworks :Some organizations have developed their ownframeworks over the top of J2EE.Also such frameworks implement best J2EE practices toachieve high performance and other advantages of J2EE.Some popular J2EE frameworks are Struts, Spring etc.J2EE Best Practices :Ways to utilize J2EE framework that it can perform at itsbest with its all advantages like scalability, remote accessetc. Such practices are used by many developers and provento be useful to achieve such goals in J2EE applications.and are also known as J2EE best practices.
New TechnologiesThe Java community which is controlled by Sun keepsincluding new features and technologies to J2EE such asJFS (Java Faces Service), Java.net, Java gaming, Java AIetc.Go MobileMobile phone applications are very wide scope area whereJava is being used for its portability and independence. Most of mobile phones operate over Javaimplementations.EmbeddedJava is gaining more popularity to develop embeddedapplications. The reason after such popularity is itsplatform independence.The principle of reusability is gaining more popularityamong embedded applications community and so Java.
SUMMARYAfterexamining scope, usage and potential of differentareas of Java technology we can summarize that it has stilllong way to go.Java has got a lot of potential to develop and grow inmany areas.For existing areas like desktop applications andenterprise applications there are chances for Java to gainbetter role. Also it has got to grow in new areas of embeddedapplications in future.