NexJ Logo

Starting Model Server

NexJ Model Server runs the NexJ applications deployed on the server. You can start Model Server using a batch file (modeld.bat) on Windows or using a shell file (modeld.sh) on Linux. Both these files are located in the <SERVER_HOME>\bin directory.

You can use the modeld.bat -? in Windows or the ./modeld.sh -? command in Linux to view all Model Server options.

To start Model Server on Windows:

  1. Open a Command Prompt window using the Run As Administrator option.
  2. From the <SERVER_HOME>/bin directory, run the following command:
    modeld.bat [-dsmj] ["-D..."] ["-X..."] [options]

To start Model Server on Linux:

  1. Open a terminal.
  2. From the <SERVER_HOME>/bin directory, run the following command:
    ./modeld.sh [-dsmj] ["-D..."] ["-X..."] [options]

where:

-d <number>
Enables remote debugging on the specified port number, for example, -d 7777.

-s          
Suspends JVM until a debugger connects. Ignored unless -d is also specified.

-m <number>
Sets the heap size, for example, -m 1024M or -m 1G.

-j <filename>
Loads JVM arguments from the specified custom file instead of loading them from jvm.conf.

-D<property>
Specifies JVM properties to pass through to the application. For example, use -Dnexj.ajp.port=8509 to set the AJP port to 8509.

Info

Model Server options require a space between the option and option value. JVM options do not require a space. Additionally, values that contain a space must be enclosed in quotation marks.

-X<argument>
Specifies additional JVM options that can be passed to the JVM to overwrite batch file defaults. For example, use -Xss4096k to change the default thread stack size.

-c url
Path to the node configuration file, for example, -c <SERVER_HOME>/modeld.conf.

-n name
Node name, for example, -n node1.

-o number
Port offset number, for example, -o 100.

-l name
Path to the log file directory, for example, -l <SERVER_HOME>/logfile.log

-C url
Path to the environment file, for example, -C <SERVER_HOME>/workspace/env/envFile.environment.

-P url
Path to the environment properties file, for example, -P <SERVER_HOME>/workspace/env/propertiesFile.properties. If you want to issue the -P command, ensure that an environment file exists and has been specified using the -C command.

-M url
Path to the metadata directory, for example, -M <SERVER_HOME>/workspace/meta.

To shut down the server, press Ctrl+C in the command line and then press Y when prompted.

Invoking tools using modeld.sh or modeld.bat

You can use the model.bat or modeld.sh files to invoke specific tools available in NexJ Studio. This allows you to perform a recreate during Model Server deployment.
The following is an example command to run a specified unit test using modeld.bat:

modeld.bat <-Dnexj.bootstrap.classpath.suffix=d:<classpath>\*.jar> "-Dnexj.uitest.webdriverDir=c:\java" "-Dnexj.uitest.headless=false" -C "C:\<project>\env\Development.environment" -P "C:\<project>\env\Unittest.properties" -M "meta://http://www.nexjsystems.com/ns/<project>" nexj.core.tools.UnitTestTool main perftest

You can also pass the same arguments to the Model Server docker image. For example, you can use the Model Server docker image as the initialization container for Kubernetes to perform a recreate.