You are previewing JBoss AS 5 Development.
O'Reilly logo
JBoss AS 5 Development

Book Description

Develop, deploy, and secure Java applications on this robust, open source application server

  • A complete guide for JBoss developers covering everything from basic installation to creating, debugging, and securing Java EE applications on this popular, award-winning JBoss application server

  • Master the most important areas of Java Enterprise programming including EJB 3.0, web services, the security framework, and more

  • Starts with the basics of JBoss AS and moves on to cover important advanced topics with the help of easy-to-understand practical examples

  • Written in a very simple and readable style, this book includes essential tips and tricks that will help you master JBoss AS development

In Detail

JBoss AS is the most used Java application server on the market meeting high standards of reliability, efficiency, and robustness and is used to build powerful and secure Java EE applications. It supports the most important areas of Java Enterprise programming including EJB 3.0, dependency injection, web services, the security framework, and more. Getting started with JBoss application server development can be challenging; however, with the right approach and guidance, you can easily master it and this book promises that.

Written in an easy-to-read style, this book will take you from the basics of JBoss AS—such as installing core components and plug-ins—to the skills that will make you a JBoss developer to be reckoned with, covering advanced topics such as developing applications with JBoss Messaging service, JBoss web services, clustered applications, and more.

You will learn the necessary steps to install a suitable environment for developing enterprise applications on JBoss AS. Then, your journey will continue through the heart of the application server, explaining how to customize each service for optimal usage. You will learn how to design Enterprise applications using Eclipse and JBoss plug-ins. You will then learn how to enable distributed communication using JMS. Storing and retrieving objects will be made easier using Hibernate. The core section of the book will take you into the programming arena with tested, real-world examples. The example programs have been carefully crafted to be easy to understand and useful as starting points for your applications.

This book will kick-start your productivity and help you to master JBoss AS development. The author's experience with JBoss enables him to share insights on JBoss AS development, in a clear and friendly way. By the end of the book, you will have the confidence to apply all the newest programming techniques to your JBoss applications.

Table of Contents

  1. JBoss AS 5 Development
    1. JBoss AS 5 Development
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. Preface
      1. What this book covers
      2. Who this book is for
      3. Conventions
      4. Reader feedback
      5. Customer support
        1. Errata
        2. Piracy
        3. Questions
    6. 1. Installing Core Components
      1. Prologue
        1. What you will get in this book
        2. JBoss big bang
      2. Introduction
      3. Installing the Java environment
      4. Installing JBoss AS 5
        1. Starting up JBoss AS
        2. Stopping JBoss
          1. Stopping JBoss on a remote machine
      5. Installing Eclipse
      6. Plugins: The heart of Eclipse
        1. Installing JBoss Tools plugins
        2. Installing JBoss Tools plugins manually
          1. Connecting Eclipse with JBoss
      7. Summary
    7. 2. What's New in JBoss AS 5?
      1. Application server features
        1. The core modules of JBoss AS 5
          1. Cutting edge EJB container
          2. The new messaging provider
          3. Rock solid transaction manager
          4. Enhanced web container
          5. JBoss Web Services 3.0
          6. Improved clustering support
        2. The application server structure
      2. The next generation application server
        1. From JMX to the Microcontainer
          1. The new library configuration
        2. JBoss AS 5 server configurations
        3. The "standard" configuration
          1. The "web" configuration
          2. The former server configurations
      3. Creating a custom server configuration
        1. The starting point: JBoss AS service map
        2. Custom configuration sample: Adding JMS to the web configuration
        3. JBoss virtual file system
      4. Summary
    8. 3. Customizing JBoss AS Services
      1. How to monitor JBoss AS services
        1. The JMX console
          1. An example: Using the JMX console to display the JNDI tree
        2. The admin console
        3. The twiddle utility
      2. JBoss AS thread pool
        1. Application server thread pool anatomy
        2. How many threads for your applications?
          1. Analyze what your threads are doing
      3. Configuring logging services
        1. Appenders
          1. Console file appender
            1. Changing the configuration at runtime
          2. File appenders
            1. Rolling the file by size
          3. Other appenders
        2. Layout of logs
        3. Logging categories
          1. Configuring your own logger
        4. Managing logs through JMX agents
      4. Configuring the connection to the database
        1. Configuring a datasource in JBoss AS
          1. Additional datasource properties
        2. Setting up a new datasource
          1. Gathering connection pool statistics
            1. Managing datasources from the admin console
            2. Using statistics to tune the connection pool
          2. Deploying datasources at application level
          3. High availability datasources
            1. Clustered RDBMS
          4. Connecting from a remote client
      5. Configuring the transaction service
        1. Preserving data integrity
        2. Global and local transactions
        3. Configuring JBoss transactions
          1. Monitoring transactions
      6. Summary
    9. 4. Developing EJB 3 Session Beans
      1. Java EE made easier
      2. Developing Enterprise JavaBeans
        1. Developing Session Beans
          1. Stateless Session Beans
            1. Life cycle of a Stateless Session Bean
            2. Setting up a simple example
            3. Deploying your application
            4. Creating a test client
            5. Adding interceptors to your Bean
          2. Stateful Session Beans
            1. Stateful Bean life cycle
            2. Developing a simple Stateful Session Bean
      3. Configuring the EJB container
        1. Configuring Stateless Session Bean pool size
          1. Specializing the configuration
        2. Configuring the Stateful Session Bean cache
          1. How to disable Stateful Bean passivation
      4. Summary
    10. 5. Developing JPA Entities
      1. Data persistence meets a standard
        1. Working with JPA
        2. Creating a sample application
        3. Setting up the database
          1. Rolling the EJB project
            1. Configuring the database connection
            2. Generating entities
            3. Reverse engineering aftermath
            4. Configuring persistence
          2. Creating a Session Bean client
          3. Creating a test client for our AppStore
      2. Summary
    11. 6. Creating a Web Application
      1. Developing web layout
        1. Installing JSF on JBoss AS
        2. Setting up navigation rules
        3. Adding a JSF managed bean
        4. Setting up the view
        5. Assembling and deploying the application
          1. Running the store
      2. Configuring JBoss Web Server
        1. Customizing connectors
          1. The new Apache Portable Runtime connector
          2. Installing the APR connector
        2. Configuring contexts
        3. Configuring virtual hosts
        4. Configuring HTTP logs
        5. Tuning advice
          1. Disable DNS lookup
          2. Choose the right HTTP connector
          3. Set the correct size for your thread pool
          4. Monitoring your thread pool
      3. Summary
    12. 7. Developing Applications with JBoss Messaging Service
      1. Short introduction to JMS
        1. The building blocks of JMS
      2. The new JBoss Messaging system
        1. Configuring connection factories
        2. Configuring JMS destinations
          1. Inspecting destination attributes
          2. Advanced message configuration
            1. Scheduled delivery
      3. Developing JMS applications
        1. Message-driven beans
          1. Configuring message-driven beans
        2. Creating a sample application
          1. Creating MDB singletons
        3. Message-driven POJOs
      4. Advanced JBoss Messaging
        1. JBoss Messaging bridge
          1. Adding a remote JMS provider
        2. Configuring the persistence service
        3. Securing destinations
          1. MDB access control
      5. Summary
    13. 8. Developing Applications with JBoss and Hibernate
      1. Introducing Hibernate
        1. Creating a Hibernate application
          1. Setting up the database schema
          2. A new Eclipse project
          3. Reversing your schema into Java classes
          4. Adding Hibernate configuration to your project
          5. Adding a web client to your project
          6. Packaging and deploying the application
          7. Using the wizard to generate EJB 3
          8. Hibernate and EJB: Friends or opponents?
          9. Using Hibernate with EJB
            1. Injecting key Hibernate objects
      2. Summary
    14. 9. Managing JBoss AS
      1. Introducing Java Management Extension
      2. Developing MBeans
        1. A simple MBean
          1. Testing your MBean from the JMX console
          2. Testing your application programmatically
        2. MBeans dependency
        3. Sending MBeans notifications
          1. Receiving heartbeat notifications
          2. Sending your own notifications
      3. Service POJOs
        1. Creating a web test client
        2. Exposing your service as an EJB
        3. Service POJO dependency
      4. JBoss AS Administration Console
        1. Managing applications
        2. Deploying/undeploying applications
          1. Updating an application
          2. Starting/stopping/restarting an application
        3. Administering resources
          1. Adding a new resource
          2. Managing resources
        4. Metrics
      5. Summary
    15. 10. Developing Applications with JBoss Web Services
      1. Web Service concepts
        1. Strategies for building up Web Services
        2. JBoss Web Services stack
          1. A brief look at the JAX WS architecture
      2. Coding Web Services with JBossWS
        1. Developing a POJO Web Service
          1. Inspecting the Web Service from the console
          2. Using JBossWS tools
          3. External Web Service clients
        2. Exposing EJB as Web Services
          1. Handling exceptions in Web Services
          2. Generating a test client
          3. Injecting Web Services
          4. Web Service Handler chains
      3. Summary
    16. 11. Clustering JBoss AS
      1. Cluster basics
      2. Introducing JBoss AS cluster
        1. JBoss AS clustering architecture
          1. Smart proxies
          2. External load balancer
      3. JBoss AS 5 cluster configuration
        1. Starting JBoss AS in cluster mode
          1. Running cluster nodes on separate machines
          2. Running cluster nodes on the same machine
            1. Running multiple clusters on the same network
      4. JBoss AS clustered services
        1. JBoss Cache (JBC)
          1. Cache modes
          2. Cache configuration
          3. Configuring HTTP cache management
          4. Configuring EJB 3.0 Stateful Session Bean cache
          5. Configuring entity caching
          6. JBoss cache and concurrency
        2. The HAPartition service
          1. Exploring HA singletons
        3. The HA-JNDI service
          1. Accessing HA-JNDI
          2. HA-JNDI configuration
      5. Clustering web applications
        1. Configuring HTTP replication
        2. HttpSession passivation/activation
        3. Configuring load balancing
      6. JMS clustering
      7. Summary
    17. 12. Developing a Clustered Application
      1. Clustering Stateless Session Beans
      2. Clustering Stateful Session Beans
        1. Deploying a clustered SFSB
        2. Testing the clustered SFSB
          1. Programmatic replication of the session
      3. Clustering entities
        1. Revisiting the AppStore example
          1. Inside the second-level cache
            1. Evicting entities from the cache
            2. General guidelines for a good cache
      4. Clustering web applications
        1. Testing HTTP session replication
      5. Summary
    18. 13. JBoss AS Security
      1. Approaching Java Security API
        1. The JAAS security model
      2. Introducing JBossSX
        1. Securing the JMX console
          1. Dynamic login configuration
          2. Stacked login configuration
          3. Logging and auditing
          4. Securing the transport layer
          5. Enabling the Secure Socket Layer on JBoss AS
            1. Certificate management tools
            2. Securing the HTTP communication with a self-signed certificate
            3. Securing the HTTP communication with a certificate signed by a CA
            4. Securing the RMI transport
              1. Adding a client truststore
      3. Summary
    19. 14. Securing JBoss AS Applications
      1. Securing the AppStore application
        1. HTTP role authentication
          1. Encrypting passwords
        2. EJB role authorization
          1. Java EE programmatic security
        3. Writing secure Java SE clients
      2. Securing applications at transport level
        1. Running the AppStore with HTTPS
        2. Securing the RMI-IIOP transport: SSL BlackJack
      3. Securing Web Services
        1. Web Services authorization
        2. Web Services encryption
          1. Client and server configuration files
      4. Encrypting the POJOWebService
        1. Securing the Web Service
        2. Securing the client
        3. Running the example
        4. Signing SOAP messages
          1. Debugging SOAP messages
      5. Summary