Sunday, May 30, 2010

Deployment in JBoss

Following are the steps to deploy a war file in JBoss.
1) First, create a HTML page - form.html or a JSP file.
2) Have a folder say, CoffeeV1. Have a folder inside CoffeeV1 with the name WEB-INF. Place the form.html file or JSP inside CoffeeV1.
3) Create a folder under WEB-INF called classes.
4) Create deployment descriptor(web.xml) file with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"&gt;
<web-app>

<display-name>Hello Coffee</display-name>
</web-app>
5) Place the web.xml file inside WEB-INF.
6) Run the following commands to create a war file.
D:\HFSApps>cd CoffeeV1
D:\HFSApps\CoffeeV1>set CLASSPATH=C:\j2sdk1.4.2_02\bin
D:\HFSApps\CoffeeV1>set JAVA_HOME=C:\j2sdk1.4.2_02
D:\HFSApps\CoffeeV1>"%JAVA_HOME%\bin\jar.exe" -cvf CoffeeV1.war *.html WEB-INF
D:\HFSApps\CoffeeV1>copy CoffeeV1.war C:\jboss\server\default\deploy\
7) Start the JBoss server using run.bat command.
8) In web browser, enter http://localhost:8080/CoffeeV1/form.html.


No comments: