CONFIGURATION OF JBOSS WITH JETTY AND POSTGRESQL

assistantashamedData Management

Nov 29, 2012 (4 years and 6 months ago)

260 views

CONFIGURATION OF JBOSS WITH JETTY AND POSTGRESQL

IN WINDOWS 98.

by Vicent
-
Ramon Palasí Lallana.

Aurum Solutions.

El Salvador. Central America



This document explains the steps that have to be followed in order to configure Jboss with
Jetty and PostgreSQL

in a Windows 98. You can freely distribute this document and the
files attached to it but you must always include the name of the author and his company.


1.
-

Disclaimer.


This document is provided "AS IS," without a warranty of any kind. All representati
ons and
warranties are excluded. In no event will the author be liable for any lost revenue, profit or
data, or for indirect, special, consequential, incidental or punitive damages, arising out of
the use of or inability to apply the content of this docume
nt.


English is not the author’s mother tongue. So this document can contain language errors of
any kind. Feel free to correct them if you want it.


2.
-

Contents of the Zip file.


This document must be distributed compressed in a Zip file. The contents of
the ZIP file
has to be:


Jboss configuration.doc


This document in Word format (original format).

Jboss configuration.html
-
> This document in HTML format.

run.bat
-
> BAT file to start Jboss.

jboss.jcml
-
> Configuration file of jboss.

standardjaws.xml
-
>
Configuration file of jboss.


3.
-

Release info.


The information of this document refers to Windows 98, Jboss 2.4.4. with Jetty, Java SDK
1.4, PostgreSQL 7.1.3
-
2 (downloaded with Cygwin). The author has tested only this
environment, although he believes th
at part of this document or even the whole document
can be applied to other configurations of the same products.


4.
-

Why Jboss, Jetty and PostgreSQL?


The author has aimed at achieving an 100% Open Source Environment which could be
used in production in o
rder to provide commercial solutions. Jboss was the only J2EE
server capable to do that. PostgreSQL is the only Open Source Database with JDBC driver
supporting transactions (although the last versions of MySQL also support transactions, the
JDBC driver ha
s not been updated to reflect that). Jetty has been chosen because it is an
HTML, servlet and JSP server. Another servlet server would have not been able to provide
static content so it would have been necessary to install a Web server (like Apache).
Choos
ing Jetty avoid the need to install another product.


5.
-

Downloading and installing.


First, download jBoss 2.4.4. from the Download link at Jboss site (
www.jboss.org
). This is
easy. Then download Cygwin from
www.cygwin.org

(this is a bit more hard, follow the
instructions of this site). Make sure you download PostgreSQL 7.1.3
-
2 and bunzip2 with
cygwin and all the “base”, “shell” and “database” utilities (not all of these are mand
atory,
but I have had no time to test which of them are needed and which are not).


Install Cygwin on your computer (the Cygwin setup program does that). At this document,
it is assumed that the folder is
<cygfol>
.


Then, download CygIPC at this site:

http://www.neuro.gatech.edu/users/cwilson/cygutils/V1.1/cygipc/


You will download the latest binary file (e.g.,
cygipc
-
1.10
-
1.tar.bz2
). Save it to the
<cygfol>
folder. Launch a
Cygwin window (clicking the Cygwin icon on your desktop or
running
<cygfol>
\
cygwin.bat). Inside Cygwin, uncompress the binary file with a command
like this: “
bunzip2
-
c <path
-
to
-
archive>/cygipc
-
1.10
-
1.tar.bz2 | tar xvf
-
”(don’t forget the final dash).


To
test the CygIPC install, launch a Cygwin window and type: “
ipc
-
daemon &


It should
echo its process number and give no errors.


Uncompress Jboss and place it on a folder. We will name it
<jbossfol>.

The folder
<jbossfold>

has to include the following subf
olders:


Jboss

Jetty

Jetty
-
jmx


The Jboss subfolder will be named
<jbosssub>

in this document (please don’t confuse it
with
<jbossfol>

which has the same name, that is, “Jboss”).


Add the following lines to your autoexec.bat (every sentence beginning with
“set” must be
in one different line, be careful not to leave superfluous blank spaces) :


set JAVA_HOME=
<the folder of your Java SDK installation>

set JBOSS_DIST=
<jbosssub>

set JBOSS_CLASSPATH= %JBOSS_DIST%
\
LIB
\
EXT;%JAVA_HOME%
\
jre
\
lib
\
rt.jar;%JAVA_HOME%
\
lib
\
tools.jar;%JBOSS_DIST
%
\
lib
\
ext
\
*.jar


set
CLASSPATH=%JBOSS_DIST%
\
JBOSS
\
LIB
\
EXT;%JAVA_HOME%
\
jre
\
lib
\
rt.jar;%JAV
A_HOME%
\
lib
\
tools.jar;%JBOSS_DIST%
\
lib
\
ext
\
*.jar
(optionally, this is followed by the
rest of your classpath).


6.
-

Configuring Jboss


There
is a run.bat file at the <jbosssub>
\
bin directory. Replace this file with the run.bat file
attached to the present document.


Copy the files jboss.jcml and standardjaws.xml (that are attached to the present document),
to the
<jbosssub
>
\
conf
\
default and
<j
bosssub
>
\
conf
\
jetty directories. By doing so, you will
replace four existing files.


Remove the file named “tomcat
-
test.ear” from the
<jbosssub
>
\
deploy directory since we
are working with Jetty and not with Tomcat.


7.
-

Configuring PostgreSQL


Copy the fil
e “
<cygfol>
\
usr
\
share
\
postgresql
\
java
\
postgresql.jar
” to the
directory
<jbosssub>
\
lib
\
ext.


Launch a Cygwin window and type the command “
ipc
-
daemon &
“. Then, initialize
PostgreSQL with “
initdb
-
W
-
D /usr/share/postgresql/data
”. When the program
asks twice
for superuser password, press ENTER twice (this is provisional, you should
change it later)


Reboot the machine in order to set the changes made to autoexec.bat.


8.
-

Running it all.


Steps from 1 to 7 must be followed only once or, more exactly, each time

jBoss is installed.
But step 8 (the present one) must be followed each time jBoss is runned.


First, we must run PostgreSQL. Launch a Cygwin window and type

ipc
-
daemon &
“.
Then, run “
postmaster
-
i
-
D /usr/share/postgresql/data
”.


Then execute one of thes
e programs:
<jbosssub>
\
bin
\
run.bat (if you want to run jBoss
without Jetty) or
<jbosssub>
\
bin
\
run_with_jetty.bat (if you want to run jBoss with Jetty).


That’s all. One last note, if you want a GUI to manage PostGreSQL, download PgAdminII
from
http://pgadmin.postgresql.org/

This is not necessary so information regarding
pgAdminII installation and execution is not included here.



9.
-

References


This document is the result of the work of the author. This work
has been partially based on
the following documents:


http://www.ejip.net/faq/postgresql_win_setup_faq.jsp


and


http://main.jboss.org/thread.jsp?forum=61&thread=7205&message=377518&q=PostgreSQ
L#377518


Since these documents have some inaccuracies and don’t have the same objectives than the
present document, my advise is not to cons
ult them.