• Complain

Tom Marrs - JBoss at Work: A Practical Guide

Here you can read online Tom Marrs - JBoss at Work: A Practical Guide full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2005, publisher: OReilly Media, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Tom Marrs JBoss at Work: A Practical Guide
  • Book:
    JBoss at Work: A Practical Guide
  • Author:
  • Publisher:
    OReilly Media
  • Genre:
  • Year:
    2005
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

JBoss at Work: A Practical Guide: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "JBoss at Work: A Practical Guide" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Consisting of a number of well-known open source products, JBoss is more a family of interrelated services than a single monolithic application. But, as with any tool thats as feature-rich as JBoss, there are number of pitfalls and complexities, too. Most developers struggle with the same issues when deploying J2EE applications on JBoss: they have trouble getting the many J2EE and JBoss deployment descriptors to work together; they have difficulty finding out how to get started; their projects dont have a packaging and deployment strategy that grows with the application; or, they find the Class Loaders confusing and dont know how to use them, which can cause problems. JBoss at Work: A Practical Guide helps developers overcome these challenges. As you work through the book, youll build a project using extensive code examples. Youll delve into all the major facets of J2EE application deployment on JBoss, including JSPs, Servlets, EJBs, JMS, JNDI, web services, JavaMail, JDBC, and Hibernate. With the help of this book, youll: Implement a full J2EE application and deploy it on JBoss Discover how to use the latest features of JBoss 4 and J2EE 1.4, including J2EE-compliant web services Master J2EE application deployment on JBoss with EARs, WARs, and EJB JARs Understand the core J2EE deployment descriptors and how they integrate with JBoss-specific descriptors Base your security strategy on JAASWritten for Java developers who want to use JBoss on their projects, the book covers the gamut of deploying J2EE technologies on JBoss, providing a brief survey of each subject aimed at the working professional with limited time. If youre one of the legions of developers who have decided to give JBoss a try, then JBoss at Work: A Practical Guide is your next logical purchase. Itll show you in plain language how to use the fastest growing open source tool in the industry today. If youve worked with JBoss before, this book will get you up to speed on JBoss 4, JBoss WS (web services), and Hibernate 3.

Tom Marrs: author's other books


Who wrote JBoss at Work: A Practical Guide? Find out the surname, the name of the author of the book and a list of all author's works by series.

JBoss at Work: A Practical Guide — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "JBoss at Work: A Practical Guide" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Index
[]AntApacheapplicationsauthenticationauthorization
Index
[]
Index
[]classesClassLoadersclientsconfigurationController Servlet
Index
[]DataSourcedebuggingdeploymentdeployment descriptorsdirectoriesdomains
Index
[]EAR filesEJB JAR filetransactionsemailsending messages
Index
[]
Index
[]HARs (Hibernate Archives)carsHome InterfacesHypersonic databases
Index
[]implementationinitializationinstallationinterfacesHome InterfacesIteration 1, JAW Motors example
Index
[]J2EEDeclarative SecurityJAR filesJavaMail APIJNDI referencesJAW Motors exampleIteration 1Session BeansJAX-RPC mapping fileJBossjboss.xmlJDBCJMS (Java Message Service)message modelsJNDI referencesJavaMail-basedJSPs
Index
[]logging
Index
[]
Index
[]
Index
[]persistence
Index
[]
Index
[]securityprogrammaticsecurity credentials propagationdeployment
Index
[]
Index
[]testingtierstransactionsEJBs
Index
[]
Index
[]View Cars page
Index
[]WAR filesWeb Servicesweb-based deployment descriptorsweb.xml
Index
[]
Index
[]
Index
[]
A.1. Namespaces

The JVM recognizes a class by its runtime identitythe class' full name (the package plus class name), along with the instance of the ClassLoader that instantiated the class. Each ClassLoader has its own namespace consisting of the classes it loads, and each fully qualified class name MUST be unique within that namespace. This naming convention is required by the J2EE specification. Two ClassLoaders could each load the same class, and the JVM would treat each class as a distinct type. Thus the JVM considers class com.jbossatwork.util.TextEmail in ClassLoader 1 different from the com.jbossatwork.util.TextEmail in ClassLoader 2 because they have different runtime identities based on the ClassLoader name. We'll see why this distinction is important when we get to the section on the JBoss ClassLoaders.

A.2. Class Loading in the J2EE

Class Loading is one of the least understood aspects of J2EE deployment. Although not officially part of the J2EE specification, most application servers use a strategy similar to the ClassLoader hierarchy in to support J2EE component deployment.

The J2EE-based ClassLoaders work as follows:

  • The EAR ClassLoader loads the classes from JARs contained in the EAR file.

  • The EJB ClassLoader loads EJBs and related classes that reside in the EJB JAR file.

  • The WAR ClassLoader loads the web-specific classes and JARs in the WAR file's WEB-INF/{class,lib} directories.

Because each ClassLoader has no access to the classes loaded by its children or siblings, the classes in the WAR file are not visible to EJBs. Of course EJBs shouldn't try to reference things in the WAR in the first place because it is poor architecture. Each layer should not know about the invoking layer, and you can't assume that a web-based presentation layer will always be in your application.

Figure A-2. Generic J2EE Application Server Class Loader Hierarchy
The J2EE specification is vague concerning the deployment order of the J2EE - photo 1

The J2EE specification is vague concerning the deployment order of the J2EE modules. Many application servers deploy the JARs and classes in the EAR, and then the classes in the EJB JAR, and finally, the classes and JARs in the WAR. In the JAW Motors application, the Common JAR strategy works because the EAR contains the Common JAR, so the application-specific dependency classes and the third party utility JARs get deployed first, then the EJBs in the EJB JAR are loaded, and the web components from the WARwhich depend on the EJBs and common classes and JARsdeploy last.

Here is a practical example that uses the class-loading scenario from . In the JAW Motors application, a JSP invokes a Servlet, which in turn uses an EJB; both the Servlet and the EJB use Log4J. Since the JSP and Servlet are packaged in the WAR, the WAR ClassLoader finds and loads the JSP and Servlet. When the Servlet instantiates the EJB, the WAR ClassLoader cannot find the EJB, so WAR ClassLoader defers to its parentthe EJB ClassLoader. The EJB JAR contains the EJB, so the EJB ClassLoader finds and loads the EJB on behalf of the WAR ClassLoader. When the Servlet instantiates the Log4J Logger to log messages, neither the WAR ClassLoader nor the EJB ClassLoader can find the Log4J JAR, so they delegate to their parent, the EAR ClassLoader. Since The Common JAR contains the Log4J JAR, the EAR ClassLoader finds and loads the Log4J Logger on behalf of the child ClassLoaders.

A.3. Class Loading with JBoss

JBoss.

Figure A-3. JBoss ClassLoader Hierarchy
JBoss ClassLoader hierarchy differs from the strategy used by other J2EE - photo 2

JBoss' ClassLoader hierarchy differs from the strategy used by other J2EE application servers in the following ways:


The ClassLoader Repository

The ClassLoader Repository contains all classes loaded by a JBoss instance, including:

  • JBoss' internal boot classes, including its J2EE component implementations

  • Any classes or JARs specified on the command line when starting JBoss

  • All classes or JARs from each deployed application

By default, only one ClassLoader Repository covers the entire server. But you are free to declare any number of repositories and associate any deployed applications with a repository. To keep deployment simple, the JAW Motors application uses the default ClassLoader Repository.


Cross-referencing between EJB JAR and WAR files

Within an EAR, an EJB could access classes and/or properties packaged in a WAR file (Log4J for example). The converse is true as wellweb components could access resources bundled in an EJB JAR. However, we do not recommend this practice because it ties you to JBossyour application will not deploy on other application servers.


Loading classes

The WAR, EJB JAR, and EAR ClassLoaders do NOT load any classes. When an application loads its classes, each ClassLoader adds its contextual information (classes, property files, and JARs) to the ClassLoader context and defers to its parent. Finally, control passes to the JBoss Application ClassLoader, which loads the class from the ClassLoader Repository.

We still recommend using a Common JAR (that resides in the EAR), which contains all JARs and classes common to both an application's EJB JAR and WAR, because:

  • Some form of packaging JARs in an EAR file works with most J2EE application servers.

  • It enables you to share classes between applications. For example, if EAR 1 and EAR 2 both use com.jbossatwork.util.TextEmail.class , you could factor it out of both applications into a separate deployment. Then you would be free to cycle the EAR files independently and never have to worry about ClassCastException s when you hot deploy one of the applications.

A.4. Common ClassLoader Issues

ClassLoader issues are difficult to find and take a long time to debug. They fall into one of two categories:


Not enough visibility

You'll see one of the following exceptions:

  • ClassNotFoundException

Java API methods such as Class.forName( ) or ClassLoader.loadClass( ) throw a ClassNotFoundException . This exception happens when a class loader tries to load a class and can't find the class. Here are some possible causes:

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «JBoss at Work: A Practical Guide»

Look at similar books to JBoss at Work: A Practical Guide. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «JBoss at Work: A Practical Guide»

Discussion, reviews of the book JBoss at Work: A Practical Guide and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.