Test Server Environment Setup

You require an appropriate operating environment to run a Nexacro Platform-based app. Nexacro Studio allows you to test an app without having to establish a separate environment. The tool lets you test an app in the Windows NRE, emulator or local web server.

If you want to test data transactions—requesting and saving actual data—in addition to other types of actions taken by a Nexacro Platform-based app, you should set a web application server (WAS). To this end, this chapter explains how to install the Java SE Development Kit (JDK) for the installation of a WAS and how to configure Apache Tomcat.

The following table compares the local web server and Apache Tomcat. Choose one of them according to your particular needs.

Feature

Local Web Server

Apache Tomcat

Installation file

None

(included in Nexacro Studio)

Installation file provided

You must install the web server before you can use it.

JDK Installation

Not required

Separate JDK installation required

Contexts

None

(The Generate folder is the web server root.)

Create contexts using the Apache interface or by deploying a war file.

X-API support

Not available

Available through separate installation

You can use Local Web Server only when you are using Nexacro Studio. If you want to test your app without opening Nexacro Studio, you should install a web server or WAS on your own.

For more information about various web servers, refer to the vendor's documentation.

Using Local Web Server

You are led to use Local Web Server by default upon the installation of Nexacro Studio. In this case, Local Web Server runs automatically when you execute Launch or Quick View in Nexacro Studio. The web server automatically ends when you quit Nexacro Studio.

When using Local Web Server, you can see the messages printed from the server through the Output pane in Nexacro Studio.

Using WAS

Installing the JDK(Java SE Development Kit)

To test data transactions and other types of actions, you need to install a WAS. You can use either a free application such as Tomcat, Jetty or Winstone or a commercial application. This section illustrates how to install Apache Tomcat and the required JDK.

Tomcat is a Java-based program and requires the Java SE Development Kit (JDK) to run. The JDK is distributed by Oracle Software.

  1. Download the JDK for your environment from Oracle via this URL:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

As for the version of the JDK, jdk-9.0.1_windows-x64_bin.exe applies to the sample in this chapter. The contents about installation and settings written in this chapter can vary according to the versions of the JDK.

If you are running Windows, download the 32- or 64-bit JDK that matches your operating system.

  1. Run the downloaded installation file to automatically install and configure the JDK.

  1. You can use the command line interface to confirm that Java has installed successfully with the following command:

java -version

When installing JDK version 1.5 and later, you can access the system path by copying execution files without setting up the environment variables (Java_Home) needed for execution.

Installing Apache Tomcat

You should establish a web server to enable a Nexacro Platform-based app to run in a web browser. Apache Tomcat provides such an environment just with simple installation.

  1. Download the version of Tomcat appropriate for your environment from the following URL:

http://tomcat.apache.org

Depending on the environment, Tomcat may execute a binary file directly or use a separate installation file. This section assumes you are using an installation file.

  1. Run the downloaded file, the installation wizard leads you through the installation process and automatically locates your JRE path.

Testing your Tomcat Installation

  1. Once Tomcat has been installed, it registers as a Windows service and starts the web server. In the System tray, right click on the Tomcat icon to view status information or to make configuration changes.

  1. In your web browser, enter the following URL to confirm that the server has installed successfully.

http://localhost:8080

Adding Context

For Tomcat to display the information that you requested, you must add a context. Although there are several ways to add a context, this chapter discusses ways to create a context file and set up a temporary folder.

Depending on your operating system configuration, you may need system administrator privileges to add or edit files.

Adding External Context

A context file designates a Generate Path in Nexacro Studio and connects the path with Tomcat. To do this, add a context file (created in the form of a XML file) to a designated folder under the path where Tomcat is installed.

C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\Catalina\localhost

Create an XML file as below. For the path attribute, enter a string that will be included in the URL. For the docBase attribute, enter the path specified as a Generate Path. If you specify path as below, the format of the URL will be http://localhost:8080/Hello/... The name of the created file must be the same as the name specified as path. Therefore, the below sample code will create the Hello.xml file.

$r_title(Hello.xml)

<Context path="/Hello" docBase="E:\88_TEST\02_BUILD\Hello"
  debug="0" prvileged="true" reloadable="true">
  <Logger className="org.apache.catalina.logger.FileLogger"
    directory="logs" prefix="localhost_log." suffix=".txt"
    timestame="true"/>
</Context>

You can create an XML file with Windows Notepad or any already-installed editor program. If you are using Nexacro Studio, go to the menu [File > New > XML(.xml)] to create a new XML file.


While you can create different context files for each project, you can also create one context file that manages multiple projects. In this sample here, we choose the former—creating different context files for each project.

Testing Your Nexacro Platform App

To use another web server or a WAS instead of a local web server, you should configure Web Server, which is located in the menu [Tools > Options > Project > Launch > Web Server]. If you specify a URL, your app will be launched based on the specified location.

To shut down the web server, right-click on the Tomcat icon and select Exit.