📄 ch02s03.html
字号:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Configuration files</title><link rel="stylesheet" href="styles.css" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/styles.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets Vimages/callouts/"><link rel="home" href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html" title="JBoss 3.0 Documentation"><link rel="up" href="ch02.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch02.html" title="Chapter 2. Configuration"><link rel="previous" href="ch02s02.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch02s02.html" title="Directory structure"><link rel="next" href="ch03.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch03.html" title="Chapter 3. Using Databases and other Enterprise Resources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="jboss.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/jboss.gif" border="0"></td><td rowspan="2" background="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="100%" align="right" valign="top"><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="doc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/doc.gif" border="0"></a><a href="ch02.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch02.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch02s02.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch02s02.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch03.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch03.html"><img src="next.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/next.gif" border="0"></a></td></tr><tr></tr></table><div class="section"><a name="configuration-files"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="configuration-files"></a>Configuration files</h2></div></div><p>
The default JBoss configuration set is located in the
<tt>conf/default</tt> directory.
</p><p>
JBoss allows the administrator to maintain more than one
configuration set. All one has to do is to copy all the files from
the default configuration into a new subdirectory of
<tt>conf</tt>.
</p><p>
For example, you can create a new configuration
<span class="emphasis"><i>"myjboss"</i></span> by creating under the
<tt>conf</tt> directory a subdirectory called
<tt>myjboss</tt> and copying all the files from
subdirectory <tt>conf/default</tt> into
<tt>conf/myjboss</tt>. After possibly altering certain
settings in the newly created files, you can run JBoss with the new
configuration by invoking the platform-dependent scripts and just
passing the configuration name as a parameter, like this:
</p><p><b>run.bat myjboss</b></p><p>
There are several configuration files for JBoss. A description of
each is given below:
</p><div class="itemizedlist"><ul><li><p><a name="d0e715"></a><tt>jboss.properties</tt></p><p>
This is a file in the standard Java Properties format that
is loaded into the System properties on startup of the JBoss
server. System properties that are not required to be
available prior to the invocation of the JBoss server main
method can be specified here.
</p></li><li><p><a name="d0e721"></a><a name="jboss.conf-file"></a>
<tt>jboss.conf</tt>
</p><p>
The configuration file <tt>jboss.conf</tt>
contains typically only those core service MBeans that are
necessary to achieve the initial bootstrap of JBoss, like
the class path extension inclusion mechanism shown in
<a href="ch02s03.html#jboss.conf-excerpt" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch02s03.html#jboss.conf-excerpt" title="Figure 2.2. Excerpt from jboss.conf">Figure 2.2</a>, logging,
configuration service, service control, etc.
</p><div class="figure"><p><a name="jboss.conf-excerpt"></a><b>Figure 2.2. Excerpt from <tt>jboss.conf</tt></b></p><pre class="programlisting">
<MLET CODE="org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/">
<ARG TYPE="java.lang.String" VALUE="../../log/">
</MLET>
</pre></div><p>
This file is loaded by an instance of the
<tt>javax.management.loading.MLet</tt> class and
it is written following the standard MLet syntax for JMX
MBeans (refer to the
<a href="javascript:if(confirm('http://java.sun.com/products/JavaManagement \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://java.sun.com/products/JavaManagement'" tppabs="http://java.sun.com/products/JavaManagement" target="_top">
JMX specification
</a>
for more details). Any standard JMX MBean can be placed in
the <tt>jboss.conf</tt> file as long as it does
not depend on JBoss service MBeans like naming. MBeans that
depend on JBoss service MBeans need to be configured in the
<tt>jboss.jcml</tt> file so that startup
dependencies can be managed.
</p><p>Usually, you would never have to change this file.</p></li><li><p><a name="d0e757"></a><a name="jboss.jcml-file"></a>
<tt>jboss.jcml</tt>
</p><p>
This file lists all the JMX service MBeans that need to be
included in the running instance of JBoss. Notice that,
contrary to the MLet syntax, this file contains well-formed
XML.
</p><p>
The need for deviation from MLet syntax is justified by the
fact that MLet doesn't allow named parameters, only
TYPE-VALUE pairs. Having only TYPE-VALUE pairs easily leads
to problems due to MBean parameter mismatches.
</p><p>
The syntax of <tt>jboss.jcml</tt> allows the use
of named parameters in MBean instantiation directives and it
is a lot easier to use. For example,
<a href="ch02s03.html#jboss.jcml-example-entry" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch02s03.html#jboss.jcml-example-entry" title="Figure 2.3. 
 Excerpt from jboss.jcml
 ">Figure 2.3</a> shows an MBean
element used to create and include MailService in JBoss.
</p><p>
<div class="figure"><p><a name="jboss.jcml-example-entry"></a><b>Figure 2.3.
Excerpt from <tt>jboss.jcml</tt>
</b></p><pre class="programlisting">
<mbean code="org.jboss.mail.MailService" name="DefaultDomain:service=Mail">
<attribute name="JNDIName">Mail</attribute>
<attribute name="ConfigurationFile">mail.properties</attribute>
<attribute name="User">user_id</attribute>
<attribute name="Password">password</attribute>
</mbean>
</pre></div>
</p><p>
In a nutshell:
<div class="itemizedlist"><ul><li><p><a name="d0e788"></a>
The <tt>code</tt> attribute of the
MBean element specifies which class to load and
instantiate.
</p></li><li><p><a name="d0e794"></a>
The <tt>name</tt> attribute of the
MBean element specifies the unique name of the
MBean under the specified JMX domain.
</p></li><li><p><a name="d0e800"></a>
The attribute child elements of the MBean
element specify the corresponding attributes of
the instantiated MBean. The values of the
attributes can be any Java primitives or String
objects.
</p></li></ul></div>
</p><p>
The <tt>jboss.jcml</tt> file is loaded by the
<tt>
org.jboss.configuration.ConfigurationService
</tt>
MBean. This service acts much like the standard JMX MLet
class in that it loads and configures MBeans. The
dependencies among MBeans are managed by the
<tt>org.jboss.util.ServiceControl</tt> MBean. The
ServiceControl MBean listens for
<tt>REGISTRATION_NOTIFICATION</tt> and
<tt>UNREGISTRATION_NOTIFICATION</tt> JMX events to
determine which MBeans are available. The order of
registration determines the order of initialization and
startup. The ServiceControl expects MBeans requiring
dependency management to conform to the
<tt>org.jboss.util.Service</tt> interface. This
interface allows for the orderly initialization, startup,
stop and destroying of MBeans. The sequence is based on the
order in which MBeans are specified in the
<tt>jboss.jcml</tt> file. See
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -