JBoss 5.0 installation and configuration Xiangjie
1. Download and install JBoss
In this article, I downloaded the JBoss version: JBOSS5.0 Beta4.
In the above download page to download JBOSS5.0 Beta4.zip file.
Download is complete, extract it can be completed after the installation, unzip and place it after a directory without spaces (if the directory with a space, for example: C: "Program Files, in the future may have some inexplicable error), eg: E: "JBossJBOSS5.0 Beta4. At the same time in the "environment variable" to set an environment variable called JBOSS_HOME, value JBoss installation path
In this, JBoss installation has been completed, can be as follows Testing the installation:
Run the JBoss installation directory "bin" run.bat, if the window does not appear abnormal, and appears: 10:16:19,765 INFO [Server] JBoss (MX MicroKernel) [5.0.Beta4 (build: SVNTag = 5.0.Beta4 date = 20080831605 )] Started in 30s: 828ms words, then installed successfully.
We can visit: http://localhost:8080/ into JBoss's Welcome screen, click on the JBoss Management under the JBoss JMX Console to enter the console.
If the launch fails, may be caused by the following reasons:
1) JBoss port used (8080,1099,1098,8083, etc.) to be occupied. Under normal circumstances for the 8080 port is occupied (for example, Oracle takes up 8080 port), then need to modify the JBoss port, methods for entry into the JBoss installation directory "server" default "deployer" jboss-web.deployer catalog, modify their under server.xml directory, search for 8080 in this file, to change the port you want you can (for example, 8088);
2) JDK is not installed correctly;
3) JBoss download incomplete.
2. JBoss directory structure Contents
JBoss startup and shutdown scripts (run.bat under the windows system startup scripts, shutdown.bat to close under the windows system scripts).
Communicate with the JBoss client required Java libraries (JARs).
Sample configuration files (database configuration, etc.).
docs / dtd
JBoss used in a variety of XML document DTD.
Some JAR, JBoss loads at startup, and JBoss configuration shared by all. (Do not put your library on here)
Various JBoss configuration. Each configuration must be placed in different subdirectories. Subdirectory name that configuration's name. JBoss default configuration contains three: minimial, default and all, you can choose to install.
server / all
JBoss fully configured, start all services, including clustering and IIOP.
server / default
JBoss default configuration. In the absence of the JBoss configuration name is specified in the command line use. (We downloaded JBOSS5.0 Beta4 version of the default with this configuration).
server / default / conf
JBoss configuration file.
server / default / data
JBoss database file. For example, the embedded database, or JBossMQ
server / default / deploy
JBoss hot deployment directory. Place where any files or directories will be automatically deployed JBoss. EJB, WAR, EAR, or services.
server / default / lib
Some JAR, JBoss specific configuration in the startup load them. (Default and minimial configuration is also included in this and the following two directories.)
server / default / log
JBoss's log file.
server / default / tmp
JBoss temporary files.
3. JBoss configuration
1. Log file settings
If you need to modify the JBoss default log4j settings, can modify the JBoss installation directory "server" default "conf file under jboss-log4j.xml, you can see in the file, log4j log output in the JBoss installation directory" server "default" log under the server.log file. The log4j settings, readers can search the web for more detailed information.
2. Web service changes the port number
This has been mentioned in the previous article, that modify the JBoss installation directory "server" default "deployer" jboss-web.deployer under the server.xml file, as follows:
<Connector port = "8080" address = "$ (jboss.bind.address)"
maxThreads = "250" maxHttpHeaderSize = "8192"
emptySessionPath = "true" protocol = "HTTP/1.1"
enableLookups = "false" redirectPort = "8443" acceptCount = "100"
connectionTimeout = "20000" disableUploadTimeout = "true" />
Port above 8080 will be amended to the port you want you can. After the visit to re-start JBoss: http://localhost/ : a new set of ports, you can see the welcome screen JBoss.
3. JBoss security settings
1) jmx-console login user name and password settings
By default, access http://localhost:8080/jmx-console jboss can browse some of the deployment of management information, do not enter a user name and password, to use a little security risk. Here we address this problem on jboss configuration, making access jmx-console also need to know the user name and password before they can go visit. Steps are as follows:
i) find the JBoss installation directory / server / default / deploy / jmx-console.war / WEB-INF / jboss-web.xml file, remove the <security-domain> java: / jaas / jmx-console </ security-domain > Notes. The revised contents of the file:
- <! - Uncomment the security-domain to enable security. You will
- need to edit the htmladaptor login configuration to setup the
- login modules used to authentication users .-->
- <security-domain> java: / jaas / jmx-console </ security-domain>
- </ Jboss-web>
<jboss-web> <!-- Uncomment the security-domain to enable security. You will need to edit the htmladaptor login configuration to setup the login modules used to authentication users.--> <security-domain>java:/jaas/jmx-console</security-domain> </jboss-web>
ii) modify and i) in the jboss-web.xml web.xml file under the same level directory, find <security-constraint/> node, remove its comments, the revised contents of this section:
- <! - A security constraint that restricts access to the HTML JMX console
- to users with the role JBossAdmin. Edit the roles to what you want and
- uncomment the WEB-INF/jboss-web.xml/security-domain element to enable
- secured access to the HTML JMX console .-->
- <web-resource-name> HtmlAdaptor </ web-resource-name>
- <description> An example security config that only allows users with the
- role JBossAdmin to access the HTML JMX console web application
- </ Description>
- <url-pattern> / * </ url-pattern>
- <http-method> GET </ http-method>
- <http-method> POST </ http-method>
- </ Web-resource-collection>
- <role-name> JBossAdmin </ role-name>
- </ Auth-constraint>
- </ Security-constraint>
<!-- A security constraint that restricts access to the HTML JMX console to users with the role JBossAdmin. Edit the roles to what you want and uncomment the WEB-INF/jboss-web.xml/security-domain element to enable secured access to the HTML JMX console.--> <security-constraint> <web-resource-collection> <web-resource-name>HtmlAdaptor</web-resource-name> <description>An example security config that only allows users with the role JBossAdmin to access the HTML JMX console web application </description> <url-pattern>/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>JBossAdmin</role-name> </auth-constraint> </security-constraint>
As can be seen here, for the log configuration of the role of the JBossAdmin.
iii) In the first step in the jmx-console security domain and the second step of running role JBossAdmin are configured in login-config.xml, we have JBoss installation directory / server / default / config to find it. Find the name to: jmx-console the application-policy:
- <application-policy name = "jmx-console">
- <Login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
- flag = "required">
- <module-option name="usersProperties"> props / jmx-console-users.properties </ module-option>
- <module-option name="rolesProperties"> props / jmx-console-roles.properties </ module-option>
- </ Login-module>
- </ Authentication>
- </ Application-policy>
<application-policy name = "jmx-console"> <authentication> <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag = "required"> <module-option name="usersProperties">props/jmx-console-users.properties</module-option> <module-option name="rolesProperties">props/jmx-console-roles.properties</module-option> </login-module> </authentication> </application-policy>
Here you can see, the role of the registry, users and other information at props directory jmx-console-roles.properties and jmx-console-users.properties file settings, open the two files respectively.
One jmx-console-users.properties file reads as follows:
# A sample users.properties file for use with the UsersRolesLoginModule
admin = admin
The document defines the format: user name = password, the file defines a default user name admin, password for admin user, the reader may be required to change the user name and password.
jmx-console-roles.properties reads as follows:
# A sample roles.properties file for use with the UsersRolesLoginModule
admin = JBossAdmin, HttpInvoker
The document defines the format: user name = role, multiple roles in "," to separate the file defaults to the admin user defined JBossAdmin and HttpInvoker these two roles.
After configuration, the reader can visit: http://localhost:8088/jmx-console/ , enter the jmx-console-roles.properties file defined in the user name and password, to access jmx-console page.
4. Configuring JBoss in MyEclipse
Author MyEclipse version: 6.5 GA
JBoss Version: 5.0
JDK version: 1.6
Into the Window-> Preferences-> MyEclipse -> Application Servers -> JBoss5, for the following settings: