User Tools

Site Tools


Medical Server

Before deploying the medical server there are some requirements which have to be fullfilled.


Java JDK 7

Since the server is implemented in Java it is necessary that your local machine runs the JRE (tested with version 7) and the current JDK is installed. (also tested with version 7)


The server uses an SQL-database to organize its userdata. In the developement process the “Oracle MySQL 5.6 Community Edition” was used and it is therefore recommended to use this version.

If necessary, instal-instructions for installing a mySQL server using the Ubuntu OS can be found at:


A MongoDB database is used by the server to store the medical-data. In the developement process the “MongoDB 2.4” was used and it is therefore recommended to use at least this version.

If necessary, instal-instructions for installing a MongoDB database using the Ubuntu OS can be found at:


The medical server is set-up on an Oracle Glassfish server. In this project the version 4.1 of Oracle Glassfish was used and it can installed following the guidelines of

While it is possible to install and run a glassfish server separately, it is recommended to use the NetBeans IDE in order to setup the server.


NetBeans IDE

In order to compile your own changes to the sourcecode of the server, it is necessary to install the NetBeans IDE. Furthermore it already includes means to work with Oracle Glassfish and is therefore recommended to use.

To install, you either need to download the “Java EE” or the “All” version and follow the instructions from this site


PhpMyAdmin is a management tool for mySQL databases which allows you to administer your database with an intuitive graphical user interface. While not being mandatory, it is recommended to use this tool in order to create and edit your database.


For this chapter it is assumed the required software as well as the recommended software is installed and ready to use.

Setup the database

First of all it is necessary to create the mySQL database using phpMyAdmin. Therefore start phpMyAdmin and in the query tab, execute all scripts stored in the institute's svn at according to their numeration.

Next it is necessary to give the medical server access to the database. Therefore select mySQL on the left-hand side and select Add a new user. Insert the following credentials into the corresponding fields:

Hostname: localhost

name: tpmsd

username: tpmsd

password: tuhh

And provide this user with all rights for the database “tpmsd”.

Additionally there have to be made some changes to the created database that correspond to your sensor setup. For example, let's assaume the following setup:

1x MedicController: entity=2, IP=64:29:30:31::3011 port=22222

2x MedicSensor Type=2 and Type=3

The MedicController corresponds to the entry “Entity” in the database, so make sure that there is an entity with id=2, endpoint=64:29:30:31:0:0:0:3011, port=22222 and protocol=udp. It is important that the IP-address is written out and not shortened by ::. In the sensor table you have to make sure that corresponding sensortypes are mapped with your patient and in the UserEntity table check that your user has acces rights to the correct patient.

Setup the server

Start the NetBeans IDE and under Tools–>Servers check whether there already is a Glassfish server or, if not, create one. Now checkout the svn-repository from via Team–>Subversion–>Checkout. Next, go into the directory of your Glassfish installation and furthermore into <Glassfish directory>/glassfish/domains/domain1/lib and copy all files from <repository>/Auxiliaries/internal_lib and /external_libs into that directory.

Additionally you have to add all files from external_libs as jars to all the projects in your NetBeans IDE and you should also make sure that the Java EE 7 API library is added as library to all projects. Now you should be able to build all projects beginning iwth Commons, going over the different SDKs and finally building the rest. <repository>/Auxiliaries/internal_lib contains already compiled versions of Commons and of the SDKs but if you make any changes to those projects, make sure to update the corresponding files in <Glassfish directory>/glassfish/domains/domain1/lib.


In order to start the medical server, you have to start the Glassfish server first. In the NetBeans IDE you therefore switch on the right hand side to the tab “Services” and under Servers you select the Glassfish server, rightclick on it and start the server. After this is done you can visit in your webbrowser localhost:4848 to see a graphical interface for the Glassfish server. Using the NetBeans IDE you can now, after building the ECP, Queue and WebInterface project, rightclick those projects and select deploy to install them on your server.

Now make sure that all nodes are running and the borderrouter is in place. After this is done, select Applications in the GUI of the Glassfish server. The three prior deployed projects should be listed there. Launch the ECP and in the upcoming window, go to the following URL:


where <endpoint> is the MedicController endpoint defined in the database as well as <port> is the specified portnumber. Considering the given example, the correct call would be:

http://localhost:8080/ECP/webresources/connector/execute?command=receive&endpoint=64:29:30:31:0:0:0:3011&port=22222&protocol=aa4r (again it's important that there is no abbreviation of the IP-address)

If everything went succesfully, the console log of the server should point out that the connection to the MedicController was established.

Next thing to do is to start the Packethandler. Just rightclick the Deamon project in the NetBeans IDE and select Start. Or use the terminal to go to the dist folder in the Deamon project and call

java -cp Deamon.jar:./lib/* com.aa4r.deamon.Deamon ${NUM_DEAMONS}

The system is now running and switching back to the webbrowser, the WebInterface can be launched. After choosing the https link the previously defined user in the database can login and select the specified patient(entity) to see his medical data.

Start script

You can use the following script to start the server. It copies the libraries and deploys the war files.

GLASSFISHFOLDER=Your Installation location
AA4RFOLDER=Your location of the projects
	${GLASSFISHFOLDER}/bin/asadmin stop-domain ${DOMAIN}
	exit 0
trap onExit SIGINT
trap onExit SIGKILL
LIBS=( "Commons" "Deamon_SDK" "ECP_SDK" "WebInterfaceSDK" )
WARS=( "Queue" "ECP" "WebInterface" )
echo "Copying Libraries"
for LIB in "${LIBS[@]}"; do
	echo "$LIB"
	cp -f ${AA4RFOLDER}/${LIB}/dist/${LIB}.jar ${DOMAINLIBFOLDER}
${GLASSFISHFOLDER}/bin/asadmin start-domain ${DOMAIN}
echo "Deploying WAR Files:"
for WAR in "${WARS[@]}"; do
	echo "$WAR"
	${GLASSFISHFOLDER}/bin/asadmin deploy --force ${AA4RFOLDER}/${WAR}/dist/${WAR}.war
echo "Starting Deamon"
cd ${AA4RFOLDER}/Deamon/dist
java -cp Deamon.jar:./lib/* com.aa4r.deamon.Deamon ${NUM_DEAMONS}
projects/aa4rdemonstrator/server.txt · Last modified: 2015/07/15 13:59 by ti5mr