More Books
JBoss 4.0 The Official Guide
JBoss® 4.0 The Official Guide
Table of Contents
Copyright
About the Authors
We Want to Hear from You!
Introduction
What This Book Covers
About JBoss
About Open Source
About Professional Open Source
What's New in JBoss 4.0
Chapter 1.  Installing and Building the JBoss Server
Getting the Binary Files
Installing the Binary Package
Basic Installation Testing
Booting from a Network Server
Building the Server from Source Code
Chapter 2.  The JBoss JMX Microkernel
JMX
The JBoss JMX Implementation Architecture
Connecting to the JMX Server
Using JMX as a Microkernel
The JBoss Deployer Architecture
Exposing MBean Events via SNMP
Remote Access to Services, Detached Invokers
Chapter 3.  Naming on JBoss
An Overview of JNDI
The JBossNS Architecture
Chapter 4.  Transactions on JBoss
Transaction and JTA Overview
JBoss Transaction Internals
Chapter 5.  EJBs on JBoss
The EJB Client-Side View
The EJB Server-Side View
The EJB Container
Entity Bean Locking and Deadlock Detection
Chapter 6.  Messaging on JBoss
JMS Examples
JBossMQ Overview
JBossMQ Configuration and MBeans
Specifying the MDB JMS Provider
Chapter 7.  Connectors on JBoss
JCA Overview
An Overview of the JBossCX Architecture
Configuring JDBC Datasources
Configuring Generic JCA Adaptors
Chapter 8.  Security on JBoss
J2EE Declarative Security Overview
An Introduction to JAAS
The JBoss Security Model
The JBossSX Architecture
The Secure Remote Password (SRP) Protocol
Running JBoss with a Java 2 Security Manager
Using SSL with JBoss and JSSE
Configuring JBoss for Use Behind a Firewall
Securing the JBoss Server
Chapter 9.  Web Applications
The Tomcat Service
The Tomcat server.xml File
The Engine Element
The Host Element
Using SSL with the JBoss/Tomcat Bundle
Setting the Context Root of a Web Application
Setting Up Virtual Hosts
Serving Static Content
Using Apache with Tomcat
Using Clustering
Integrating Third-Party Servlet Containers
Chapter 10.  MBean Services Miscellany
System Properties Management
Property Editor Management
Services Binding Management
Scheduling Tasks
The Log4j Service MBean
RMI Dynamic Class Loading
Chapter 11.  The CMP Engine
Example Code
The jbosscmp-jdbc Structure
Entity Beans
CMP Fields
Container-Managed Relationships
Declaring Queries
Optimized Loading
The Loading Process
Transactions
Optimistic Locking
Entity Commands and Primary Key Generation
JBoss Global Defaults
Datasource Customization
Chapter 12.  Web Services
JAX-RPC Service Endpoints
Enterprise JavaBean Endpoints
Web Services ClientsA JAX-RPC Client
Service References
Chapter 13.  Hibernate
The Hibernate MBean
Hibernate Archives
Using Hibernate Objects
Using a HAR File Inside an EAR File
The HAR Deployer
Chapter 14.  Aspect-Oriented Programming (AOP) Support
JBoss AOP: EJB-Style Services for Plain Java Objects
Why AOP?
Basic Concepts of AOP
Building JBoss AOP Applications
The JBoss AOP Deployer
Packaging and Deploying AOP Applications to JBoss
Appendix A.  The GNU Lesser General Public License (LGPL)
GNU General Public License
Appendix B.  Example Installation
Index
SYMBOL
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X

Booting from a Network Server

One very useful command-line option is the --netboot=url option, which causes JBoss to start up using the given URL as the base URL from which all libraries and configurations are loaded. Specifying the netboot option sets ServerConfig.HOME_URL to the netboot option URL argument value. In the absence of any other overrides, all the locations found in the standard JBOSS_DIST structure will be resolved relative to the HOME_URL value. This means that if you make a JBoss distribution available from a web server, you can boot JBoss using only the run scripts and run.jar file from the JBOSS_DIST/bin directory. Note that the web server must support the PROPFIND WebDAV command. JBoss includes a simple servlet filter that provides minimal support for the PROPFIND command so that JBoss itself may be used as the netboot web server.

An Ant build script example that creates a custom netboot configuration file set for booting the default configuration is available in the examples/src/main/org/jboss/chap1/build-netboot.xml file. To test the netboot feature, you run the build-netboot. xml script, specifying the location of the JBOSS_DIST you want to use as the netboot web server, as shown here:

[examples]$ ant -Djboss.dist=/tmp/jboss-4.0.1
-buildfile src/main/org/jboss/chap1/build-netboot.xml

You then start up the netboot server by specifying the netboot configuration, as follows:


[bin]$ ./run.sh -c netboot
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /tmp/jboss-4.0.1

  JAVA: /System/Library/Frameworks/JavaVM.framework/Home//bin/java

  JAVA_OPTS: -server -Xms128m -Xmx128m -Dprogram.name=run.sh

  CLASSPATH: /tmp/jboss-4.0.1/bin/run.jar:/System/Library/Frameworks/JavaVM.framework/Home
//lib/tools.jar

=========================================================================

17:42:52,042 INFO  [Server] Starting JBoss (MX MicroKernel)...
...
17:43:06,818 INFO  [Server] JBoss (MX MicroKernel) [4.0.1RC2 (build:
 CVSTag=JBoss_4_0_1_RC2 date=200411302349)] Started in 13s:918ms

You can now start up any other instance of JBoss, using just the run script and run.jar from the JBOSS_DIST/bin directory. Here's an example:


[bin]$ sh run.sh --netboot=http://192.168.0.101:8080/netboot/
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /tmp/jboss-4.0.1

  JAVA: /System/Library/Frameworks/JavaVM.framework/Home//bin/java

  JAVA_OPTS: -server -Xms128m -Xmx128m -Dprogram.name=run.sh

  CLASSPATH: /tmp/jboss-4.0.1/bin/run.jar:/System/Library/Frameworks/JavaVM.framework/Home
//lib/tools.jar

=========================================================================

18:14:29,828 INFO  [Server] Starting JBoss (MX MicroKernel)...
18:14:29,833 INFO  [Server] Release ID: JBoss [Zion] 4.0.1RC2 (build:
 CVSTag=JBoss_4_0_1_RC2 date=200411302349)
18:14:29,836 INFO  [Server] Home Dir: /private/tmp/jboss-4.0.1
18:14:29,838 INFO  [Server] Home URL: http://192.168.0.101:8080/netboot/
18:14:29,840 INFO  [Server] Library URL: http://192.168.0.101:8080/netboot/lib/
18:14:29,869 INFO  [Server] Patch URL: null
18:14:29,871 INFO  [Server] Server Name: default
18:14:29,874 INFO  [Server] Server Home Dir: /private/tmp/jboss-4.0.1/server/default
18:14:29,879 INFO  [Server] Server Home URL: http://192.168.0.101:8080/netboot/server/default/
18:14:29,881 INFO  [Server] Server Data Dir: /private/tmp/jboss-4.0.1/server/default/data
18:14:29,884 INFO  [Server] Server Temp Dir: /private/tmp/jboss-4.0.1/server/default/tmp
18:14:29,887 INFO  [Server] Server Config URL: http://192.168.0.101:8080/netboot/server
/default/conf/
18:14:29,889 INFO  [Server] Server Library URL: http://192.168.0.101:8080/netboot/server
/default/lib/
18:14:29,890 INFO  [Server] Root Deployment Filename: jboss-service.xml
18:14:29,900 INFO  [Server] Starting General Purpose Architecture (GPA)...
...

The custom netboot configuration file set consists simply of the files needed to run the jbossweb-tomcat50.sar web server and a netboot.war file whose content is the JBOSS_DIST/lib and JBOSS_DIST/server/default files.