Get Java TU-running locally

 

​Preconditions
  • Apache Tomcat 7.0.55 can be downloaded here >
  • Java JDK 1.7 can be downloaded here >
  • Eclipse developer IDE can be downloaded here >
  • Apache Maven 3.2.2 can be downloaded here >
  • Company / developer has ordered access to the test environment
  • (Server setup: Own firewall changed to allow outgoing traffic on port 389. Access through Nets DanID firewal by supplying one or more servers that your requests will originate from.)
  • To complete later step regarding using your own company certificate. Company / developer has ordered a test VOCES certificate and issued to a .jks file. See glossary 

 Walkthrough

1. Download the latest  Java source in the Service Provider Package


Calling the PID/CPR webservice and checking certificates is functionality provided by the ooapi project, that is bundled with the example application as a .jar. You can also download the source from the same location that you will download the service provider example application.


2. Create a project folder
Create a workspace/directory fx. tuexample-source and unzip the tuexample source to this location, so that you have the structure "workspace\tuexample-source"


3. Make sure maven is installed correctly
Follow the installation guide here for maven (Link => http://maven.apache.org/download.cgi)

After installation start a dosprompt and type in 'mvn' and enter and you should see something like this:

maven-installed.jpg

 

4. Install the supplied jar files(you only have to do this once)
Go to the folder "workspace\tuexample-source\lib" or the similar folder you installed the project in - and run the batch command "install-jars.bat" from the dosprompt.

install-jars.jpg

 

5. Create the web archive file for the project (the tuexample.war file)
The project depends on the ooapi package which can be downloaded and compiled seperatly if needed and this is how the project is configured by default.
If you want to avoid downloading and compiling the ooapi package seperatly the pom.xml can be modified to use a project provided ooapi library instead. This is done by opening the pom.xml located in project root folder in an editor and replace the following:
< ooapi.version>x.yyy.z-SNAPSHOT</ooapi.version> with <ooapi.version>x.yyy.z</ooapi.version> where x.yyy.z is a version number.

Run the maven command 'mvn clean install' from project root folder where the project file pom.xml exists:

maven-build.jpg


When the build finishes with success the 'tuexample.war' file will be located in the generated target folder, target\tuexample.war

This web arhive file contains the tuexample web application and can be deployed in the desired application server. For Tomcat applications server place the file in the folder \tomcat-installation-folder\webapps

You can also run the application in the maven supplied application server by running the command: 'mvn jetty:run'

maven-jetty.jpg 

 

maven-jetty-started.jpg 


The webapplication will now be accessible the link: http://localhost:8085/tuexample/

The maven command 'mvn clean install' and 'mvn jetty:run' has to be runned when you have source changes. Jetty has autodeploy so most changes should be caught automatically.

Also the you can just combine the maven arguments to one - like 'mvn clean install jetty:run' so that you can do all in one command. Read more about how to use maven in the maven documentation.

6. Import the source to Eclipse
Generate the Eclipse config files by running this maven command from the root folder of the source: 'mvn eclipse:eclipse'

maven-eclipse.jpg
 

Then import the project to eclipse by these steps:

eclipse-import-1.jpg 


Then import is as existing projects


eclipse-import-2.jpg 


And finally import the project by selecting the root directory of the tuexample-source project you installed.


eclipse-import-3.jpg 

You should now have the tuexample-source project installed in Eclipse.​​