Release 2.x‎ > ‎Development‎ > ‎Netbeans‎ > ‎

2.1: Server Configuration


This page is focused on setting up the NetBeans IDE and Glassfish to run the OpenPTK Server.  These processes apply to version 2.1 (and above) of OpenPTK because of they support maven builds.


Please follow the Setup Using Maven guide before continuing with this document.

Tested Versions

Product Version(s)
 OpenPTK  2.1
 NetBeans  6.9, 7.0, 7.1
 Glassfish 3.0.1*, 3.1.1, 3.1.2
 Tomcat  6
 Jersey  1.12
 Apache Commons Codec  1.6

The server uses the Apache commons codec version 1.6.  If you are deploying on Glassfish v3.0, you must replace the <glassfish>/modules/commons-codec-repackaged.jar with commons-codec-1.6.jar.

Overriding Jersey

Jersey is distributed with Glassfish, it needs to be overridden to use the Jersey that packaged with the jar file.  The instructions below will complete the configuration required (for additional details refer to the Jersey User Guide).

Review glassfish-web.xml

To override Jersey, the OpenPTK-Server project is configured with the class loader delegation is set to false in WEB-INF/glassfish-web.xmlThe provided glassfish-web.xml already has class loader delegation set to false.  This file is located in the directory $OPENPTK_HOME/projects/OpenPTK/Server/web/WEB-INF.  Reference the example below:

<glassfish-web-app error-url="">
   <class-loader delegate="false"/>

Update JVM Settings

The glassfish JVM settings need to be update to include a new option:,,

    1. Open Netbeans, start Glassfish
    2. In a web browser, login to the Glassfish console (ex:  http://localhost:4848/console)
    3. Expand Configuration
    4. Expand default-config
      1. Select JVM Settings
      2. Select JVM Options
      3. Click Add JVM Option
        1. Insert the above value into the new text field
      4. Click Save
    5. Expand server-config
      1. Select JVM Settings
      2. Select JVM Options
      3. Click Add JVM Option
        1. Insert the above value into the new text field
      4. Click Save
    6. Restart Glassfish

Disable Derby

The registered derby database within Glassfish needs to be disabled because it will conflict with the OpenPTK Server when it's configured to use the "embedded" (derby) Service.

Setting Glassfish Properties

  1. Open Netbeans
  2. Select the Services tab
  3. Expand the Servers
  4. Right-click the Glassfish Server 
    1. Select Properties
    2. Select the Common Tab
    3. un-checked all the Checkboxes
      1. Especially:
        1. Enable JDBC Driver Deployment
        2. Start Registered Derby Server
    4. Select Close
    5. Restart Glassfish

Make sure that a version Derby is not already running prior to proceeding (e.g.:  ps -ef |grep derby).  If it is running already, stop the process.

Open Server Project

  1. Select the Open Project icon
  2. Expand the projects folder
    1. Expand the OpenPTK folder
      1. Select the Server folder
      2. Check the Open Required Projects checkbox
      3. Click Open Projects

Open Embedded Service

  1. Select the Open Project icon
  2. Expand the ext folder
    1. Expand the Service folder
      1. Select the EmbedJDBC folder
      2. Check the Open Required Projects checkbox
      3. Click Open Projects

Set Maven Goal

  1. Right click the OpenPTK-Server Project
  2. Select Custom menu item
    1. Select Goals ...
  3. Dialog window is opened
    1. Set Goals to: install
    2. Set Profiles to: srvc-derby
    3. Set Remember as to: embedded
    4. Select OK
  4. The Server will be built

Run Server

  1. Start Glassfish
    1. Select the Services tab
    2. Expand Servers
    3. Right-click Glassfish Server 3.1.1
      1. Click Start
  2. Run OpenPTK Server
    1. Select the Projects tab
    2. Right-click the OpenPTK-Server Project
    3. Select Run
  3. After deployment completes
    1. A browser started
    2. The Server interface displayed
  4. Undeploy the application
    1. Expand Glassfish Server 3.1.1
    2. Expand Applications
      1. Right-click org.openptk_openptk-server_war_2.1.0-SNAPSHOT
      2. Select undeploy
  5. Stop the Glassfish Server

If a previous version of Derby was already running.   Stop the derby process, and undeploy the server.  Then follow the steps above.

Debug Server

  1. Start Glassfish in debug mode
    1. Select the Services tab
    2. Expand Servers
    3. Right-click Glassfish Server 3.1.1
      1. Click Start in Debug Mode
  2. Run OpenPTK Server
    1. Select the Projects tab
    2. Right-click the OpenPTK-Server Project
    3. Select Debug
  3. After deployment completes
    1. Debug panel is opened
    2. A browser started
    3. The Server interface displayed
  4. Stop the Glassfish Server