Bullsfirst Installation Guide

aquahellishΛογισμικό & κατασκευή λογ/κού

13 Δεκ 2013 (πριν από 3 χρόνια και 7 μήνες)

119 εμφανίσεις

Bullsfirst

Installation Guide

Install
programs

ArchfirstToolKit
\
JDK (version 6u22)
@
C:
\
apps
\
j
ava
\
jdk6

and
C:
\
apps
\
java
\
j
re
6

ArchfirstToolKit
\
TortoiseSVN (version
1.6.11
)

ArchfirstToolKit
\
SlikSVN (version
1.6.1
3)
(required for Subclipse inside 64
-
bit Eclip
se)

ArchfirstToolKit
\
WinMerge

(version
2.12.4
)

ArchfirstToolKit
\
devtools.zip

(unzip under C:
\
)


Install
\
MySQL
\
mysql
-
5.1.
52
-
win32.msi

or
mysql
-
5.1.
52
-
winx64
.msi

Inst
all
\
MySQL
\
mysql
-
workbench
-
gpl
-
5.2.29
-
win32
.msi

Inst
all
\
MySQL
\
mysql
-
connector
-
java
-
5.1.13
.zip

(unzip under S:
\
lib)

Inst
all
\
MySQL
\
SQLyog
-
8.7.0
-
3Community
.exe


Install
\
GlassFish
\
glassfish
-
3.1
-
windows.exe

@
C:
\
apps
\
glassfish
-
3.1

-

This is the full version


don’t install the Web profile

-

If the installer cannot find Java use the

j option as shown below
:


glassfish
-
3.1
-
windows.exe
-
j c:
\
apps
\
java
\
jdk
6

-

The install may still fail (see
this

bug report). It is probably
because
it

can
not find the Java path through the Wind
ows registry. Try
install
ing latest Java 6 using Windows installer.

Setup Environment Variables

ANT_HOME=C:
\
devtools
\
ant

GLASSFISH_HOME=C:
\
apps
\
glassfish
-
3.1
\
glassfish

JAVA_HOME=C
:
\
apps
\
java
\
jdk6

M2_REPO
=C
:
\
m2
\
repository

MAVEN_HOME=C:
\
devtools
\
maven
-
3.0

MYSQL_HOME=C:
\
Prog
ram Files
\
MySQL
\
MySQL Server 5.1

T
ORTOISE_
SVN
_HOME=
C:
\
Program Files
\
TortoiseSVN

Path=%JAVA_HOME%
\
bin;%MAVEN_HOME%
\
bin;%ANT_HOME%
\
bin;
%
GLASSFISH_HOME
%
\
bin;
%MY
SQL_HOME%
\
bin;
%
T
ORTOISE_
SVN
_HOME%
\
bin

Configure Maven



Edit MAVEN_HOME/conf/settings.xml
. Find the comment fo
r <localRepository>. Add the following
line under this comment to change its location.


<localRepository>C:
\
m2
\
repository</localRepository>




Here’s another alternative to change the location of the local repository (although the option above is
preferred).



Create a file called C:
\
Documents and
Settings
\
<your
-
username>
\
.m2
\
settings.xml

and paste the
following text into it. (On Windows 7
,

C:
\
Documents and Settings is replaced by C:
\
Users.)


<?xml version="1.0" encoding="UTF
-
8"?>

<settings>


<localRepositor
y>C:
\
m2
\
repository</localRepository>

</settings>




This
step
is required just because I was having trouble connecting to the quickfixj maven repository. I
was giving the following error:


No connector available to access repository MarketceteraRepo
(>http:/
/repo.marketcetera.org/maven) of type default using the
available factories WagonRepositoryConnectorFactory



Download quickfixj 1.5
.0 from
http://sourceforge.net/project/showfiles.
php?group_id=163099

and unzip it at C
:/lib/quickfixj
-
1.5
.0

(you will have to rename to this). Run the following
command to install the library in the Maven repository:


mvn install:install
-
fil
e
-
Dfile=C
:/lib/quickfixj
-
1.
5
.0/quickfixj
-
all
-
1.
5
.0.jar
-
Dgroup
Id=quickfixj
-
DartifactId=quickfixj
-
all
-
Dversion=1.
5
.0
-
Dpackaging=jar
-
DgeneratePom=true


Configure Eclipse



Start Eclipse (located at C:
\
devtools
\
eclipse
-
helios
)



When prompted, let it create a wo
rkspace at C:
\
eclipse
-
helios
-
workspace.



Choose File > Impor
t
> General
> Preferences and import preferences from C
:
\
devtools
\
eclipse
-
config
\
archfirst.epf



Choose Window > Preferences > General > Editors >
Text Editors

> Spelling and set User Defined
Dictionary as
C:
\
devtools
\
eclipse
-
config
\
dictionary.txt



Choose Win
dow > Preferences > Maven >
Installations
.

Choose Add and add C:
\
devtools
\
maven
-
3.0
as an external installation. Make sure it is checked.

Under Maven > User Settings, make sure local
repository is set to C:
\
m2
\
repository.

Start MySQL Database Server

and l
ogin as root



Start MySQL System Tray Monitor (from Start > All Programs > MySQL).



In the system tray, right click on MySQL System Tray Monitor and select Start Instance.


>

mysql
--
user=root
--
password

Enter password: xxxx

mysql> show databases;

Create a D
atabase for Bullsfirst Exchange

mysql> create database bfexch_javaee;

mysql> create user 'bfexch_ja
vaee'@'localhost' identified by
'<password>'
;

mysql> grant all on bfexch_javaee.* TO 'bfexch_javaee'@'localhost';

Create a Database for Bullsfirst OMS JavaEE

mysql> create database bfoms_javaee;

mysql> create

user

'
bfoms_javaee
'@'localhost'
identified by

'
<password>
';

mysql> grant

all

on
bfoms_javaee
.* TO '
bfoms_javaee
'@'localhost';

Create a Database for Bullsfirst
OMS
Spring

mysql> create database bfoms_
sprin
g
;

mysql> create

user

'
bfoms_
spring
'@'localhost'
identified by

'
<password>
';

mysql> grant

all

on
bfoms_
spring
.* TO '
bfoms_
spring
'@'localhost';

Configure GlassFish



Open a Co
mmand shell and traverse to GLASSFISH_HOME
\
bin



Rename asadmin (with no extension) to

asadmin.sh (otherwise maven plug
-
in for glassfish gets
confused between asadmin and asadmin.bat).



Stop the GlassFish server.

asadmin stop
-
domain domain1



Go to
GLASSFISH_HOME
\
modules

and delete
weld
-
osgi
-
bundle.jar
. This version of weld has
problems with r
esolving dependencies (see
here
).

Replace with
most recent (look at date)
Weld OSGi
Bundle 1.1.0
-
SNAPSHOT

(these are post 1.1.0.Final snapshots)

(Tested version saved under
Install
\
GlassFish)
.

Rename the jar to
weld
-
osgi
-
bundle.jar

(take out the version and date).



In the same
modules directory re
place the version of Jersey. The supplied version has old Jackson
JSON libraries (version 1.5.5) which do not work with Bullsfirst. The procedure below is a variation on
the article
here
.



Remove the following
11
jars from the modules directory:

jackson
-
core
-
asl.jar

jackson
-
jaxrs.jar

jackson
-
mapper
-
asl.jar

jackson
-
xc.jar

jersey
-
client.jar

jersey
-
core.jar

jersey
-
gf
-
server.jar

jersey
-
gf
-
statsproviders.jar

jersey
-
json
.jar

jersey
-
multipart.jar

jettison.jar




Add the following 8 jars from
http://download.java.net/maven/2/com/sun/jerse
y/glassfish/v3/jersey
-
gfv3
-
core/1.6/jersey
-
gfv3
-
core
-
1.6
-
project.zip
:

jersey
-
client.jar

jersey
-
core.jar

jersey
-
gf
-
server.jar

jersey
-
gf
-
statsproviders.jar

jersey
-
grizzly.jar

jersey
-
json.jar

jersey
-
multipart.jar

jettison.jar




Add the following 4 jars from f
rom the Jackson 1.7.6 distribution:

jackson
-
core
-
asl
-
1.7.6.jar

jackson
-
jaxrs
-
1.7.6.jar

jackson
-
mapper
-
asl
-
1.7.6.jar

jackson
-
xc
-
1.7.6.jar




Remove the osgi cache directory called felix under
GLASSFISH_HOME
\
domains
\
domain1
\
osgi
-
cache



Create a file called
clie
ntaccesspolicy.xml

under
GLASSFISH_HOME
\
domains
\
domain1
\
docroot

with the following content. This allows a web
application loaded from a different domain to access web
-
services hosted by this GlassFish domain
(a.k.a. cross
-
domain access).


<?xml version="1.
0" encoding="utf
-
8"?>

<access
-
policy>


<cross
-
domain
-
access>


<policy>


<allow
-
from http
-
request
-
headers="*">


<domain uri="*"/>


</allow
-
from>


<grant
-
to>


<resource path="/" include
-
subpaths="true"/>


</grant
-
to>



</policy>


</cross
-
domain
-
access>

</access
-
policy>




Copy the MySQL driver (
mysql
-
connector
-
java
-
5.1.13
-
bin
.jar
) to
GLASSFISH_HOME
\
lib
.



Type the following command
to create a master
-
password file
under
GLASSFISH_HOME
\
domains
\
domain1

(required by
maven
-
gla
ssfish
-
plugin
):

asadmin change
-
master
-
password
--
savemasterpassword=true domain1

Enter the current master password> changeit

Enter the new master password> [new
-
password]

Enter the new master password again> [new
-
password]



Type the following command at

the

command prompt to start the server:


asadmin start
-
domain domain1



Login to the GlassFish admin console (
url
http://localhost:4848
)



Add
Hibernate JPA provider

(in addition to the default TopLink JPA provider).



In the

navigation bar
, click on Update Tool.



Select Component called hibernate and click Install.



Stop GlassFish before proceeding to the next step. (Hibernate JPA provider will be automaticaly
recognized during the next startup):


asadmin stop
-
domain dom
ain1



Unfortunately what gets installed is hibernate 3.5.0 which is incompatible with Bullsfirst. Replace it
with hibernate 3.6.0. To do this, pick up the
hibernate3.jar

from
hibernate
-
3.6.0.Final

distribution
and drop it in
GLASSFISH_HOME
\
lib
, overwriting
the original file.

Configure GlassFish for slf4j Logging

Based on
this

article



Copy
the following

JARs to
GLASSFISH_HOME
\
lib
\
endorsed:

o

jul
-
to
-
slf4j
-
1.6.1.jar (f
rom sl4j)

o

slf4j
-
api
-
1.6.1.jar (from sl4j)

o

slf4j
-
log4j12
-
1.6.1.jar (from sl4j)

o

log4j
-
1.2.8.jar (from log4j)

o

log4j
-
config
-
xxx
.jar (from
archfirst
-
docs
\
trunk
\
bullsfirst
\
GlassFish Logging Configuration
)

(choose between

de
v

or prod)



Edit
GLASSFISH_HOME
\
domains
\
domain1
\
config
\
domain.xml

and add the following properties in
the jvm
-
options section:

<jvm
-
options>
-
Djava.util.logging.config.file=${com.sun.aas.instanceRoot}/config/my_logging.properties</jvm
-
options>

<jvm
-
options>
-
Dlog4j.log.file=${com.sun.aas.instanceR
oot}/logs/glassfish.log</jvm
-
options>



Create
my_logging.properties

file
as
specified above under
GLASSFISH_HOME
\
domains
\
domain1
\
config

with the following contents:

handlers = org.slf4j.bridge.SLF4JBridgeHandler

com.sun.enterprise.server.logging.GFFileHandl
er.flushFrequency=1

com.sun.enterprise.server.logging.GFFileHandler.file=${com.sun.aas.instanceRoot}/logs/server.log

com.sun.enterprise.server.logging.GFFileHandler.rotationTimelimitInMinutes=0

com.sun.enterprise.server.logging.GFFileHandler.logtoConsole=f
alse

com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes=2000000

com.sun.enterprise.server.logging.GFFileHandler.alarms=false

com.sun.enterprise.server.logging.GFFileHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter

c
om.sun.enterprise.server.logging.GFFileHandler.retainErrorsStasticsForHours=0



Restart GlassFish. You will now see only a few messages
in server.log, all the rest go

to

glassfish.log.

Create JDBC Connection Pools on GlassFish

Create
bfexch_javaee

Connection

Pool



In the navigation bar
, click on Resources > JDBC > Connection Pools



Click New on the Connection Pools page.



Create a new connection pool using the following parameters

and click Next

Pool
Name:

bfexch_javaee

Resource Type:

javax.sql.ConnectionPoolDat
aSource

Database Vendor:
MySql



Fill in the following
properties

and click Finish

User
:
bfexch_javaee

Password
:
bfexch_javaee

URL

& Url
:
jdbc:mysql://localhost:3306/
bfexch_javaee



You will now b
e on

the JDBC Connection Pools page. Click on the connection poo
l you just created
and then click on Ping to make sure the connection is setup properly.



In the navigation bar
, click on Resources > JDBC > JDBC Resources



Click New on the JDBC Resources page.



Create a new JDBC resource using the following parameters and c
lick OK

JNDI
Name:
bfexch_javaee
_connection_pool

Pool Name
:
bfexch_javaee

Create bfoms
_javaee

Connection Pool

Follow the same steps above but replace
bfexch_javaee

with
bfoms_javaee
.

Create JDBC Security Realm



In the navigation bar, click on Configurations

> server
-
config > Security > Realms



Click New.



Fill in the Fields as follows:



Name: bullsfirst
-
javaee



Class Name: com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm



JAAS Context: jdbcRealm



JNDI (datasource):
bfoms_javaee_connection_pool



User Table: Use
rs



User Name Column: username



Password Column: passwordHash



Group Table: UserGroup



Group Name Column: groupname



Digest Algorithm: MD5



Encoding: Base64

Configure JMS on GlassFish (Open MQ)



In the navigation bar, c
lick on Configurations > server
-
config > Jav
a Message Service



Confirm that the Type field is set to EMBEDDED



In the navigation bar, click on Resources > JMS Resources > Connection Factories



Click on New…



Fill in the following fields:

Pool

Name: jms/ConnectionFactory

Resource Type:
javax.jms.Connecti
onFactory



Click Ok. This creates a connection factory called
jms/ConnectionFactory

and also (under
Connectors)



a Connector Resource called
jms/ConnectionFactory



a Connection Pool called
jms/ConnectionFactory



In the navigation bar, click on Resources > JMS
Resources > Destination Resources



Click on New…



Fill in the following fields (this step also creates an Admin Object resource called
jms/OmsT
o
E
xchange
Q
ueue
):

JNDI

Name:
jms/OmsT
o
E
xchange
Q
ueue

Physical Destination Name: OmsT
o
E
xchange
Q
ueue

Resource Type:
jav
ax.jms.
Queue




Similarly cre
ate two more queues and a topic (even though we are don’t have a Spring OMS yet, the
queue must be created. The exchange expects it to be there).

JNDI
Name: jms/ExchangeToOmsJavaee
Queue

Physical Destinat
ion Name: ExchangeToOmsJav
aee
Queue

Resource Type: javax.jms.Queue


JNDI Name: jms/Exchange
ToOmsSpring
Queue

Physical Destination Name: Exchange
ToOmsSpring
Queue

Resource Type: javax.jms.Queue


JNDI Name: jms/Exchange
MarketPriceTopic

Physical Destination Name: Exchange
MarketPriceTopic

Resource Type: javax.jms.
Topic




Expose the dead message queue (mq.sys.dmq) to JNDI by creating a resource as follows:

JNDI Name: jms/DeadMessageQueue

Physical Destination Name: mq.sys.dmq

Resource Type: javax.jms.
Queue




You can use imqcmd (under
C:
\
apps
\
g
lassfish
-
3.1
\
mq
\
bin
) to manage the queues. Default credentials
to run this command are admin/admin.

To query a queue:


imqcmd query ds
t
-
t q
-
n ExchangeToOmsJavaee
Queue


imqcmd query dst
-
t q
-
n
mq.sys.dmq

(dead message queue)

To
purge

a queue:


i
mqcmd
purge

dst
-
t q
-
n Excha
ngeToOmsJavaee
Queue


imqcmd purge

dst
-
t q
-
n
mq.sys.dmq

(dead message queue)


Configure JMS on GlassFish (ActiveMQ)

This is a replacement for Open MQ but does not work currently.

See the following Section in the GlassFish 3
.1 Administration Guide for high
-
level instructions (page 328):

Using the Generic Resource Adapter for JMS to Integrate Supported External JMS Providers



Copy the following ActiveMQ jars to
%GLASSFISH_HOME%
\
lib

activeio
-
core
-
3.1.2.jar

activemq
-
core
-
5.4.0.ja
r

commons
-
logging
-
1.1.jar



Restart GlassFish so that ActiveMQ jars are recognized:


asadmin stop
-
domain domain1


asadmin start
-
domain domain1



In the navigation bar, click on
Update Tool



Select glassfish
-
generic
-
ra and click Install.

This creat
es a folder called
GLASSFISH_HOME
\
lib
\
addons
\
resourceadapters
\
genericjmsra

and adds to files to it:
genericra.jar

and
genericra.rar
.

(The rar essentially contains the jar and some configuration)



Deploy
genericra.rar

(You can also do this via the console


Applications > Deploy):

asadmin deploy
%GLASSFISH_HOME%
\
lib
\
addons
\
resourceadapters
\
genericjmsra
\
genericra.rar



Configure the resource adapter

using the following command
. Note that this command should be
executed as one single line
and hence we are using t
he ‘^’ as the line continuation character for DOS.
(Use
create
-
resource
-
adapter
-
config.bat

in this directory)
. Also in Unix, you will have to escape the
broker URL with two backslashes (
brokerURL
\
\
=tcp
\
\
://127.0.0.1
\
\
:61616
)
. Note that this command
create
a new section in domain1/config/domain.xml
(<resource
-
adapter
-
config resource
-
adapter
-
name="genericra">
)


asadmin create
-
resource
-
adapter
-
config
--
property^


ConnectionFactoryClassName=org.apache.activemq.ActiveMQConnectionFactory^

:ConnectionFactoryProper
ties=brokerURL
\
=tcp
\
://127.0.0.1
\
:61616^

:DeliveryType=Asynchronous^

:LogLevel=FINE^

:ProviderIntegrationMode=javabean^

:QueueClassName=org.apache.activemq.command.ActiveMQQueue^

:QueueConnectionFactoryClassName=org.apache.activemq.ActiveMQConnectionFactor
y^

:RMPolicy=OnePerPhysicalConnection^

:SupportsXA=true^

:TopicClassName=org.apache.activemq.command.ActiveMQTopic^

:TopicConnectionFactoryClassName=org.apache.activemq.ActiveMQConnectionFactory^

:UnifiedDestinationClassName=org.apache.activemq.command.Act
iveMQDestination^

:XAConnectionFactoryClassName=org.apache.activemq.ActiveMQXAConnectionFactory^

:XAQueueConnectionFactoryClassName=org.apache.activemq.ActiveMQXAConnectionFactory^

:XATopicConnectionFactoryClassName=org.apache.activemq.ActiveMQXAConnection
Factory^


genericra



Create a new connection pool for the genericra connector:



In the admin console, click on Resources > Connectors > Connector Connection Pools



Click New and fill in the following fields:

Pool Name: jms/AmqConnectionFactory

Resource Adapte
r: genericra

Connection Definition: jax.jms.ConnectionFactory

Transaction Support: XATransaction



Click Next, you will reach to step 2 of this process.



Click finish.



Create a new connector

resource for the pool created above:



In the admin console, click on
Resources > Connectors > Connector Resources



Click New and fill in the following fields:

JNDI Name: jms/AmqConnectionFactory

Pool Name: jms/AmqConnectionFactory



Click Ok.



Create a new
admin object resource
:



In the admin console, click on Resources > Connec
tors >
Admin Object

Resources



Click New and fill in the following fields:

JNDI Name: jms/
OmsT
o
E
xchange
Q
ueue

Resource Adapter: genericra

Resource Type: javax.jms.Queue

Class Name: com.sun.genericra.outbound.QueueProxy



Click Ok.



In the navigation bar, click
on Resources > JMS Resources > Destination Resources

>
jms/
OmsToExchange
Queue



Fill in the following fields
:

JNDI

Name:
jms/OmsT
o
E
xchange
Q
ueue

Physical Destination Name: OmsT
o
E
xchange
Q
ueue

Resource Type:
javax.jms.
Queue



Click Save

Checkout the Source

Checko
ut the source from the
follow
ing project

in

subversion

to
C:
\
Projects
\
archfirst

(SRC_DIR)
:

https://www.archfirst.org/svn/repos/archfirst

B
uild
Maven Projects

Either build
projects

one at a time

as
described

below or run the
build
-
all.bat

batch file to build all
projects in one shot.

Archfirst Common Libraries



Open a Co
mmand shell and traverse to
SRC_DIR
\
java
\
projects
\
archfirst
-
common
:



Type the following command at

the command prompt to build the

project


mvn
clean
install


Bullsfirst Common Libraries



Open a Co
mmand shell and traverse to SRC_DIR
\
java
\
projects
\
bulls
first
-
common
:



Type the following command at

the command prompt to build the project


mvn
clean
install


Bullsfirst Exchan
ge



Traverse to SRC_DIR
\
java
\
projects
\
bullsfirst
-
exchange
-
javaee
:



Type the following command at

the command prompt to build the project

mvn
clean
install



Create database schema and import data

cd bfexch
-
ddl

create
-
schema

import



Deploy application to Glassfi
sh

cd
..
\
bf
exch
-
javaee
-
web

mvn glassfish:deploy
(assuming that GlassFish server is running)


Bullsfirst
OMS Common



Traverse to SRC_DIR
\
java
\
projects
\
bullsfirst
-
oms
-
common
:



Type the following command at

the command prompt to build the project

mvn
clean
inst
all



Create database schema and import data

cd
bfoms
-
common
-
ddl

create
-
schema

import

(optional


create jhorner user)


Bullsfirst
Java EE



Traverse to SRC_DIR
\
java
\
projects
\
bullsfirst
-
oms
-
javaee
:



Type the following command at

the command prompt to build the
project

mvn
clean
install



Deploy application to
Glassfish

cd
bfoms
-
javaee
-
web

mvn glassfish:deploy
(assuming that GlassFish server is running)


Build Bullsfirst Silverlight Client

and deploy to localhost

Prerequisites

1.

Visual Studio 2010

2.

Prism 4.0


November 2010

3.

Microsoft Silverlight 4 Tools for Visual Studio 2010

4.

Silverlight 4 Toolkit


April 2010

5.

Microsoft Expression Blend SDK for Silverlight 4



Build the solution in release mode.



Go to
SRC_DIR
\
dotnet
\
Projects
\
Bullsfirst
\
Silverlight
\
Bullsfirst.Web



Copy
BullsfirstTestPage.h
tml

to
GLASSFISH_HOME
\
domains
\
domain1
\
docroot
\
apps
\
bfclient
-
silverlight
. Rename to
bullsfirst.html
.



Copy
Silverlight.js

to
GLASSFISH_HOME
\
domains
\
domain1
\
docroot
\
apps
\
bfclient
-
silverlight
.



Copy
ClientBin/Bullsfirst.xap

to
GLASSFISH_HOME
\
domains
\
domain1
\
doc
root
\
apps
\
bfclient
-
silverlight
/ClientBin
.

Start Trading!

Point your browser to the following URL to start trading:

http://localhost:8080/apps/bfclient
-
silverlight/bullsfirst.htm
l