Difference between revisions of "YAJSW"
(Adding delayed auto start can resolve a problem where the service fails to start with when the machine boots) |
m (Text replacement - "syntaxhighlight" to "pre") |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 18: | Line 18: | ||
== Gather the files == | == Gather the files == | ||
− | * Download the latest version of [ | + | * Download the latest version of [https://basex.org/products/download/all-downloads/ BaseX]. Select the Zip Archive. |
* Download the latest version of [https://sourceforge.net/projects/yajsw/ YAJSW]. | * Download the latest version of [https://sourceforge.net/projects/yajsw/ YAJSW]. | ||
− | * Download the latest version of [ | + | * Download the latest version of [https://java.com/en/download/ Java]. |
== Install BaseX as a Windows Service == | == Install BaseX as a Windows Service == | ||
Line 37: | Line 37: | ||
# Extract YAJSW to <code>C:\Programs\yajsw\yajsw-beta-12.05</code> | # Extract YAJSW to <code>C:\Programs\yajsw\yajsw-beta-12.05</code> | ||
# Extract BaseX to <code>C:\Programs\BaseX\basex</code> | # Extract BaseX to <code>C:\Programs\BaseX\basex</code> | ||
+ | |||
+ | See [[Database Server]] for information on how to pick an initial admin password. | ||
=== Install BaseX as a service === | === Install BaseX as a service === | ||
Line 43: | Line 45: | ||
* Specify the location of java.exe | * Specify the location of java.exe | ||
− | * | + | * Change the amount of memory available to BaseX from 1024m (for example, 512m or 2048m) |
− | <pre> | + | <pre lang="ini"> |
# YAJSW configuration for BaseX | # YAJSW configuration for BaseX | ||
− | wrapper.java.command=C:/ | + | wrapper.java.command=C:/ProgramData/Oracle/Java/javapath/java.exe |
wrapper.working.dir=C:\\Programs\\BaseX\\basex | wrapper.working.dir=C:\\Programs\\BaseX\\basex | ||
Line 56: | Line 58: | ||
wrapper.java.classpath.1 = .\\BaseX.jar | wrapper.java.classpath.1 = .\\BaseX.jar | ||
wrapper.java.classpath.2 = .\\lib\\*.jar | wrapper.java.classpath.2 = .\\lib\\*.jar | ||
+ | wrapper.java.classpath.3 = .\\lib\\custom\\*.jar | ||
− | wrapper.java.additional.1 = - | + | wrapper.java.additional.1 = -Xmx1024m |
wrapper.java.additional.2 = -Dfile.encoding=utf-8 | wrapper.java.additional.2 = -Dfile.encoding=utf-8 | ||
Line 66: | Line 69: | ||
wrapper.console.loglevel=INFO | wrapper.console.loglevel=INFO | ||
− | wrapper.logfile=${wrapper.working.dir}\\data | + | wrapper.logfile=${wrapper.working.dir}\\data\\wrapper-basex.log |
wrapper.logfile.maxsize=10m | wrapper.logfile.maxsize=10m | ||
wrapper.logfile.maxfiles=10 | wrapper.logfile.maxfiles=10 | ||
Line 81: | Line 84: | ||
# Start the service: <code>java -jar wrapper.jar --start conf\wrapper.basex.conf</code> | # Start the service: <code>java -jar wrapper.jar --start conf\wrapper.basex.conf</code> | ||
− | BaseX server is now running as a service, and will start automatically when Windows starts | + | BaseX server is now running as a service, and will start automatically when Windows starts. |
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 18:38, 1 December 2023
This page is part of the Developer Section.
BaseX server can be configured to run as an always-on service in Windows (or daemon in Linux) using YAJSW.
Contents
Some basics of YAJSW[edit]
- Each service running with YAJSW has a configuration file which lives in the
conf
folder. - Installing and controlling services is done from the command line. Run a command prompt as administrator, then navigate to the folder where you placed YAJSW, e.g.
cd C:\Programs\yajsw\yajsw-beta-12.05
- If you need to change configuration of a service follow this sequence:
- Stop the service
java -jar wrapper.jar --stop conf\wrapper.name.conf
- Remove the service
java -jar wrapper.jar --remove conf\wrapper.name.conf
- Make your changes to the wrapper or application configuration.
- Install the service
java -jar wrapper.jar --install conf\wrapper.name.conf
- Start the service
java -jar wrapper.jar --start conf\wrapper.name.conf
- Stop the service
YAJSW comes with some helpful convenience scripts in the 'bat' and 'bin' folders. This set of instructions does not use these convenience scripts.
Gather the files[edit]
- Download the latest version of BaseX. Select the Zip Archive.
- Download the latest version of YAJSW.
- Download the latest version of Java.
Install BaseX as a Windows Service[edit]
The instructions on this page are known to work using Windows Server 2012R2, BaseX 8.4.2, YAJSW 12.05 beta, Java 1.8.0_77 64-bit from Oracle.
Install Java[edit]
Install Java using the Java installer for your operating system. Use a 64-bit version if you can.
Put files into position[edit]
These instructions assume you will be placing BaseX and YAJSW in C:\Programs, but you can choose a different location.
- Create folder
C:\Programs
- Extract YAJSW to
C:\Programs\yajsw\yajsw-beta-12.05
- Extract BaseX to
C:\Programs\BaseX\basex
See Database Server for information on how to pick an initial admin password.
Install BaseX as a service[edit]
Create wrapper config file wrapper.basex.conf
and place it in YAJSW's conf
folder. You can use the example below. You may need to modify this example to:
- Specify the location of java.exe
- Change the amount of memory available to BaseX from 1024m (for example, 512m or 2048m)
# YAJSW configuration for BaseX
wrapper.java.command=C:/ProgramData/Oracle/Java/javapath/java.exe
wrapper.working.dir=C:\\Programs\\BaseX\\basex
wrapper.java.app.mainclass=org.basex.BaseXHTTP
wrapper.java.classpath.1 = .\\BaseX.jar
wrapper.java.classpath.2 = .\\lib\\*.jar
wrapper.java.classpath.3 = .\\lib\\custom\\*.jar
wrapper.java.additional.1 = -Xmx1024m
wrapper.java.additional.2 = -Dfile.encoding=utf-8
wrapper.ntservice.name=BaseX
wrapper.ntservice.displayname=BaseX
wrapper.ntservice.description=BaseX XQuery database
wrapper.ntservice.starttype=DELAYED_AUTO_START
wrapper.console.loglevel=INFO
wrapper.logfile=${wrapper.working.dir}\\data\\wrapper-basex.log
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=10
wrapper.on_exit.0=SHUTDOWN
wrapper.on_exit.default=RESTART
After you have created the wrapper configuration file:
- Open a command prompt as administrator
- Navigate to the YAJSW folder:
cd C:\Programs\yajsw\yajsw-beta-12.05
- Install the service:
java -jar wrapper.jar --install conf\wrapper.basex.conf
- Start the service:
java -jar wrapper.jar --start conf\wrapper.basex.conf
BaseX server is now running as a service, and will start automatically when Windows starts.