Configuring JBoss AS7 and deploying applications under Linux
1. Test platform and Software
CentOS 5.4
jdk-7u5-linux-i586.rpm
Jboss-as-7.1.1.final.zip
Jboss-as-quickstarts-7.1.1.cr2-dist.zip
Apache-maven-3.0.4-bin.tar.gz
2. Install related software
A. Installing the JDK
[Email protected] ~]# chmod +x jdk-7u5-linux-i586.rpm
[Email protected] ~]# RPM-IVH jdk-7u5-linux-i586.rpm
[Email protected] ~]# java-version
Java Version "1.7.0_05"
Java (TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot (TM) Client VMs (build 23.1-b03, mixed mode, sharing)
B. Installing Apache-maven
[Email protected] ~]# tar zxvf apache-maven-3.0.4-bin.tar.gz
C. Installing JBoss
[Email protected] ~]# Unzip Jboss-as-7.1.1.final.zip
Add user
[Email protected] jboss-as-7.1.1.final]#/root/jboss-as-7.1.1.final/bin/add-user.sh
What type of user does wish to add?
A) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
Enter the details of the new user to add.
Realm (Managementrealm):
Username:ppzlyg
Password:
Re-enter Password:
About-to-add user ' Ppzlyg ' for Realm ' Managementrealm '
Is this correct yes/no? Yes
Added user ' Ppzlyg ' to file '/root/jboss-as-7.1.1.final/standalone/configuration/mgmt-users.properties '
Added user ' Ppzlyg ' to file '/root/jboss-as-7.1.1.final/domain/configuration/mgmt-users.properties '
Start
[Email protected] bin]#/root/jboss-as-7.1.1.final/bin/standalone.sh-djboss.bind.address=0.0.0.0- djboss.bind.address.management=0.0.0.0&
Visit the homepage
http://192.168.1.109:8080/
Access console
http://192.168.1.109:9990/
Enter the user name and password created
Shut down
[Email protected] bin]#/root/jboss-as-7.1.1.final/bin/jboss-cli.sh--connect Command=:shutdown
{"Outcome" = "Success"}
3. Deploy Application Testing
[Email protected] ~]# Unzip Jboss-as-quickstarts-7.1.1.cr2-dist.zip
[Email protected] ~]# CD JBOSS-AS-QUICKSTARTS-7.1.1.CR2
Test HelloWorld
[Email protected] jboss-as-quickstarts-7.1.1.cr2]# CD HelloWorld
[Email protected] helloworld]#/ROOT/APACHE-MAVEN-3.0.4/BIN/MVN package Jboss-as:deploy
After the deployment is complete, you can see the deployed apps in the console
Access test
Http://192.168.1.109:8080/jboss-as-helloworld/HelloWorld
4. Modify the default home page
The first step
[Email protected] bin]# Vim/root/jboss-as-7.1.1.final/standalone/configuration/standalone.xml
Enable-welcome-root= "true" modified to
Enable-welcome-root= "false"
Step Two
Add the Jboss-web.xml file under the Web-inf folder of the application you want to deploy, with the following contents:
<?xml version= "1.0" encoding= "UTF-8"?>
< jboss-web>
<context-root>/</context-root>
</jboss-web>
Then repackage it into a war package for deployment
The time you visit http://192.168.1.109:8080/is the homepage of your deployed project!