JBoss AS 7 Development

Book description

Learn from an expert and master JBoss Application Server through this brilliantly accessible book. It irons out the difficulties and covers creating, debugging, and securing Java EE applications. The only manual you need.

  • 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.1, JPA, Contexts and Dependency Injection, web services, the security framework, and more
  • Starts with the basics of JBoss AS 7 and moves on to cover important advanced topics with the help of easy-to-understand, practical examples

In Detail

JBoss Application Server meets 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.1, Contexts and Dependency Injection, JAX-WS and JAX-RS 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 plugins—to the skills that will make you a JBoss developer to be reckoned with, covering advanced topics such as developing applications with the 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. You will also learn how to design Enterprise applications using Eclipse, JBoss plugins, and Maven to build and deploy your applications. Readers will learn how to enable distributed communication using JMS. Storing and retrieving objects will be made easier using the Java Persistence API. 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 practical guide will show you how to gain hands-on experience rapidly on Java EE development using JBoss AS with easy-to-understand and practical programming examples.

Table of contents

  1. JBoss AS 7 Development
    1. Table of Contents
    2. JBoss AS 7 Development
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Getting Started with JBoss AS 7
      1. An overview of Java EE and JBoss AS 7
        1. Welcome to Java EE 6
          1. JavaServer Faces (JSF) 2.0
          2. Enterprise JavaBeans (EJB) 3.1
          3. Java Persistence API (JPA) 2.0
          4. Contexts and Dependency Injection for Java
          5. Java Servlet API 3.0
          6. Java API for web services (JAX-RS and JAX-WS)
          7. Java API for XML-based web services (JAX-WS)
          8. Java architecture for XML Binding (JAXB) 2.2
      2. New features in JBoss AS 7
      3. Installing the server and client components
        1. Installing Java SE
          1. Testing the installation
          2. Installing JBoss AS 7
          3. Starting up JBoss AS
          4. Connecting to the server with the Command Line Interface
          5. Stopping JBoss
            1. Locating the shutdown script
            2. Stopping JBoss on a remote machine
          6. Restarting JBoss
        2. Installing the Eclipse environment
          1. Installing JBoss Tools
        3. Alternative development environments
        4. Installing Maven
          1. Testing the installation
      4. Summary
    9. 2. What's New in JBoss AS 7
      1. AS 7 core concepts
      2. The AS 7 filesystem
      3. Managing the application server
        1. Managing JBoss AS 7 with the web interface
      4. Launching the web console
      5. Deploying your first application to JBoss AS 7
        1. Advanced Eclipse deployment options
        2. Managing deployments with the web console
          1. Changing the deployment scanner properties
        3. Deploying applications using the CLI
          1. Deploying applications to a domain
      6. Summary
    10. 3. Beginning Java EE 6 – EJBs
      1. EJB 3.1 – new features
      2. Developing singleton EJBs
        1. Configuring the project object module (pom.xml)
        2. Coding our EJB application
        3. Controlling bean concurrency
          1. Using bean-managed concurrency
        4. Cooking session beans
        5. Adding a stateless bean
        6. Adding a stateful bean
      3. Deploying the EJB application
      4. Creating a remote EJB client
        1. Configuring the client's project object module
        2. Coding the EJB client
          1. Adding EJB client configuration
        3. Running the client application
          1. Adding user authentication
        4. Using the EJB timer service
          1. Programmatic timer creation
          2. Scheduling timer events
        5. Adding asynchronous methods to our EJBs
          1. Using fire-and-forget asynchronous calls
          2. Returning a Future object to the client
      5. Summary
    11. 4. Learning Context Dependency Injection
      1. Introducing Context and Dependency Injection
        1. Named beans
        2. CDI scopes
        3. JBoss AS CDI implementation
        4. Rethinking your ticketing system
          1. Adding the required dependencies
        5. Coding the beans
          1. Building the view
            1. JSF 2 facet suggestions
          2. Getting ready to run the application
          3. Combining the scheduler into our application
            1. Installing RichFaces
            2. Making your application rich
            3. Running the application
        6. Are EJBs and JSF Managed Beans obsolete?
      2. Summary
    12. 5. Combining Persistence with CDI
      1. Data persistence meets a standard
        1. Working with JPA
      2. Adding persistence to our application
        1. Setting up the database
        2. Installing the JDBC driver on JBoss AS 7
          1. Using the command-line interface to create a new data source
      3. Creating the Maven project
        1. Adding Maven configuration
        2. Cooking entities
        3. Adding JavaBeans Validation
      4. Configuring persistence
        1. Adding producer classes
        2. Coding queries for your application
        3. Adding services to your application
        4. Adding a controller to drive user requests
        5. Coding the JSF view
        6. Running the example
      5. Summary
    13. 6. Testing Your Applications
      1. Unit testing and integration testing
        1. Instruments for testing
      2. Getting started with Arquillian
        1. Writing an Arquillian test
        2. Configuring the pom.xml file
        3. Writing your first Arquillian test
        4. Running Arquillian TicketTest
        5. Running Arquillian TicketTest with a managed container
        6. Enhancing your Arquillian test
        7. Additional information
      3. Summary
    14. 7. Developing Applications with JBoss JMS Provider
      1. A short introduction to JMS
      2. The building blocks of JMS
        1. The JBoss messaging subsystem
        2. Creating and using connection factories
        3. Using JMS destinations
        4. Adding message-driven beans to your application
          1. Cooking message-driven beans
          2. Adding the JMS producer
          3. Compiling and deploying the application
          4. Optimizing JMS connections
          5. Specifying which message to receive using selectors
        5. Using JMS to integrate with external systems
        6. A real-world example – HornetQ and ActiveMQ integration
          1. Installing the ActiveMQ resource adapter
          2. Consuming ActiveMQ messages
      3. Summary
    15. 8. Adding Web Services to Your Applications
      1. Developing SOAP-based web services
        1. Strategies for building SOAP web services
        2. JBoss SOAP web services stack
        3. A brief look at the JAX WS architecture
        4. Coding SOAP web services with JBoss AS 7
          1. Developing a POJO web service
          2. Inspecting the web service from the console
          3. Testing our simple web service
          4. EJB3 Stateless Session Beans (SLSB) web services
          5. Developing a web service consumer
          6. Compiling the example
      2. Developing REST-based web services
        1. Accessing REST resources
        2. JBoss REST web services
          1. Activating RESTEasy
          2. Adding REST to our Ticket example
          3. Consuming our REST service
          4. Compiling our Ticket example
      3. Choosing between SOAP and REST services
      4. Summary
    16. 9. Managing the Application Server
      1. Entering the JBoss Command Line Interface (CLI)
        1. Launching the CLI
          1. Connecting from remote hosts
          2. Using the CLI in the graphical mode
        2. Constructing the CLI commands
          1. Determining the resource address
          2. Performing operations on resources
            1. Using the tab completion helper
        3. Deploying applications using the CLI
          1. Deploying applications to a JBoss AS 7 domain
          2. Deploy to all server groups
          3. Deploy to a single server group
        4. Creating CLI scripts
          1. Deploying an application to several JBoss AS 7 nodes
          2. Restarting servers in a domain
          3. Installing a datasource as a module
          4. Adding JMS resources
      2. Using advanced languages to create powerful CLI scripts
        1. Using scripting languages to wrap CLI execution
      3. Using the raw management API to manage the application server
        1. Reading management model descriptions via the raw management API
          1. Creating your resource watches using the detyped API
      4. Summary
    17. 10. Clustering JBoss AS 7 Applications
      1. Clustering basics
      2. JBoss AS 7 clustering
        1. Starting a cluster of standalone nodes
        2. Starting a cluster of domain nodes
          1. The domain controller configuration
          2. Host configurations
      3. Deploying clustered applications
        1. Clustering EJBs
          1. Creating HA Stateful Session Beans
            1. Clustering the Ticket example
            2. Turning your cache into a distributed cache
            3. Coding the cluster-aware remote client
            4. Deploying and testing high availability
      4. Web application clustering
        1. Load balancing your web applications
          1. Installing mod_cluster
          2. Clustering your web applications
            1. Programming considerations to achieve HA
            2. Achieving HA in JSF applications
      5. Summary
    18. 11. Securing JBoss AS 7 Applications
      1. Approaching the Java security API
        1. JBoss AS 7 security subsystem
        2. Setting up your first login module
        3. Using the login module in the Ticket web application
        4. Switching to FORM-based security
        5. Creating a Database login module
          1. Encrypting passwords
          2. Using the Database login module in your application
        6. Securing EJBs
          1. Securing web services
      2. Securing the transport layer
        1. Enabling the Secure Socket Layer on JBoss AS
          1. Certificate management tools
          2. Securing the HTTP communication with a self-signed certificate
          3. Securing HTTP communication with a certificate signed by a CA
          4. Securing EJB communication
          5. Generating the server and client certificates
          6. Creating an SSL-aware security realm
          7. Creating an SSL-aware security realm
      3. Summary
    19. A. Rapid Development Using JBoss Forge
      1. Installing Forge
      2. Starting Forge
      3. Creating your first Java EE 6 application with JBoss Forge
        1. Building and deploying the application
      4. Your forge-demo application in action
    20. Index

Product information

  • Title: JBoss AS 7 Development
  • Author(s): Francesco Marchioni
  • Release date: June 2013
  • Publisher(s): Packt Publishing
  • ISBN: 9781782161349