Java SP server: start, stop, configuration and logs
The Java SP server (cora_javasp) runs Java stored functions and procedures for one database. It is controlled with coradb javasp.
Starting CoraDB Java SP server
Section titled “Starting CoraDB Java SP server”The following example shows how to start CoraDB Java SP server for e-commerce.
To start the Java SP server, the java_stored_procedure parameter in the CoraDB configuration file (coradb.conf) must set to yes.
% coradb javasp start e-commerce
@ coradb javasp start: e-commerce++ coradb javasp start: successThe following message is returned if CoraDB Java SP server is already running.
% coradb javasp start e-commerce
@ coradb javasp start: e-commerce++ coradb javasp 'e-commerce' is running.For details on other types of errors that may occur when starting the server, see CoraDB Java SP server errors.
Stopping CoraDB Java SP server
Section titled “Stopping CoraDB Java SP server”The following example shows how to stop CoraDB Java SP server for e-commerce.
% coradb javasp stop e-commerce
@ coradb javasp stop: e-commerce++ coradb javasp stop: successThe following message is returned when CoraDB Java SP server has been stopped already.
% coradb javasp stop e-commerce
@ coradb javasp stop: e-commerce++ coradb javasp 'e-commerce' is not running.++ coradb javasp stop: failRestarting CoraDB Java SP server
Section titled “Restarting CoraDB Java SP server”The following example shows how to restart CoraDB Java SP server for e-commerce. the server that has already run stops and the server restarts.
% coradb javasp restart e-commerce
@ coradb javasp stop: e-commerce++ coradb javasp stop: success@ coradb javasp start: e-commerce++ coradb javasp start: successChecking CoraDB Java SP server status
Section titled “Checking CoraDB Java SP server status”The following example shows how to check the status of a CoraDB Java SP server for e-commerce. The database name of Java SP server, which currently running, e-commerce is displayed. Additionally, The server's PID, port number, and the applied JVM option are shown together.
% coradb javasp status e-commerce
@ coradb javasp status: e-commerceJava Stored Procedure Server (e-commerce, pid 9220, port 38408)Java VM arguments--------------------------------------------------Djava.util.logging.config.file=/path/to/CoraDB/java/logging.properties-Xrs-------------------------------------------------Configuring for CoraDB Java SP server
Section titled “Configuring for CoraDB Java SP server”Environment configuration for Java stored function/procedure
Section titled “Environment configuration for Java stored function/procedure”To use Java-stored functions/procedures in CoraDB, you must have JRE (Java Runtime Environment) 1.6 or later installed in the environment where the CoraDB server is installed. You can download JRE from the Developer Resources for Java Technology (https://www.oracle.com/java/technologies).
CoraDB 64-bit needs a 64-bit Java Runtime Environment, and CoraDB 32-bit needs a 32-bit Java Runtime Environment. For example, when you run CoraDB 64-bit in the system in which a 32-bit JAVA Runtime Environment is installed, the following error may occur.
% coradb javasp start e-commerce
Java VM library is not found: Failed to get 'JVM_PATH' environment variable. Failed to load libjvm from 'JAVA_HOME' environment variable: /usr/java/jdk1.6.0_15/jre/lib/amd64/server/libjvm.so: cannot open shared object file: No such file or directory.Execute the following command to check the JRE version if you have it already installed in the system.
% java -version Java(TM) SE Runtime Environment (build 1.6.0_05-b13)Java HotSpot(TM) 64-Bit Server VM (build 10.0-b19, mixed mode)Windows environment
For Windows, CoraDB loads the jvm.dll file to run the Java Virtual Machine. CoraDB first locates the jvm.dll file from the PATH environment variable and then loads it. If it cannot find the file, it uses the Java runtime information registered in the system registry.
You can configure the JAVA_HOME environment variable and add the directory in which the Java executable file is located to Path, by executing the command as follows: For information on configuring environment variables using GUI, see Installing and Configuring JDBC.
-
An example of installing 64 Bit JDK 1.6 and configuring the environment variables
% set JAVA_HOME=C:\jdk1.6.0% set PATH=%PATH%;%JAVA_HOME%\jre\bin\server -
An example of installing 32 Bit JDK 1.6 and configuring the environment variables
% set JAVA_HOME=C:\jdk1.6.0% set PATH=%PATH%;%JAVA_HOME%\jre\bin\client
If you want to specify the path of Java Virtual Machine (JVM) explicitly including cases to use other vendor's implementation instead of Sun's JVM, add the path of the jvm.dll file to the JVM_PATH variable during the installation. CoraDB first looks for the jvm.dll file in the JVM_PATH variable. if JVM_PATH is not set or if the file cannot be loaded, it looks for the file in the JAVA_HOME variable as described above.
-
An example of configuring the JVM_PATH environment variable
% set JVM_PATH=C:\jdk1.6.0\jre\bin\server\libjvm.dll
Linux/UNIX environment
For Linux/UNIX environment, CoraDB loads the libjvm.so file to run the Java Virtual Machine. CoraDB first locates the libjvm.so file from the LD_LIBRARY_PATH environment variable and then loads it. If it cannot find the file, it uses the JAVA_HOME environment variable. For Linux, glibc 2.3.4 or later versions are supported. The following example shows how to configure the Linux environment variable (e.g., .profile, .cshrc, .bashrc, .bash_profile, etc.).
-
An example of installing 64 Bit JDK 1.6 and configuring the environment variables in a bash shell
% JAVA_HOME=/usr/java/jdk1.6.0_10% LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server:$LD_LIBRARY_PATH% export JAVA_HOME% export LD_LIBRARY_PATH -
An example of installing 32 Bit JDK 1.6 and configuring the environment variables in a bash shell
% JAVA_HOME=/usr/java/jdk1.6.0_10% LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/i386/:$JAVA_HOME/jre/lib/i386/client:$LD_LIBRARY_PATH% export JAVA_HOME% export LD_LIBRARY_PATH -
An example of installing 64 Bit JDK 1.6 and configuring the environment variables in a csh shell
% setenv JAVA_HOME /usr/java/jdk1.6.0_10% setenv LD_LIBRARY_PATH $JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server:$LD_LIBRARY_PATH% set path=($path $JAVA_HOME/bin .) -
An example of installing 32 Bit JDK 1.6 and configuring the environment variables in a csh shell
% setenv JAVA_HOME /usr/java/jdk1.6.0_10% setenv LD_LIBRARY_PATH $JAVA_HOME/jre/lib/i386:$JAVA_HOME/jre/lib/i386/client:$LD_LIBRARY_PATH% set path=($path $JAVA_HOME/bin .)
If you want to specify the path of Java Virtual Machine (JVM) explicitly including cases to use other vendor's implementation instead of Sun's JVM, add the path of the libjvm.so file to the JVM_PATH variable during the installation. The path of the libjvm.so file can be different depending on the platform. For example, the path is the $JAVA_HOME/jre/lib/sparc directory in a SUN Sparc machine. CoraDB first looks for the libjvm.so file in the JVM_PATH variable. if JVM_PATH is not set or if the file cannot be loaded, it looks for the file in the JAVA_HOME variable as described above.
-
An example of configuring the JVM_PATH environment variable
% JVM_PATH=/usr/java/jdk1.6.0_10/jre/lib/amd64/server/libjvm.so% export JVM_PATH
Java SP server system parameters
Section titled “Java SP server system parameters”The following table shows the server parameters related to Java SP server available in the configuration file (coradb.conf)
| Parameter Name | Type | Default | Min | Max |
| java_stored_procedure | bool | no | ||
| java_stored_procedure_port | int | 0 | 0 | 65535 |
| java_stored_procedure_jvm_options | string |
For more details on these parameters, see coradb.conf configuration file and default parameters.
Registering CoraDB Java SP server to coradb service
Section titled “Registering CoraDB Java SP server to coradb service”If you register javasp to CoraDB service, you can use the utilities of coradb service to start, stop or check all the registered javasp processes at once.
- First, add javasp to the service parameter in the [service] section of the coradb.conf file.
- Second, To register the javasp server for a database, add the name of the database to the server parameter in the [service] section. Note that it shares the server parameter with the database server. a javasp server is dependent on the database server that has the same database name.
- Finally, set java_stored_procedure as yes to enable starting the javasp server for the database.
The following example shows how to register javasp server as service in the coradb.conf file. Both e-commerce and testdb are present in the server property, but only e-commerce with java_stored_procedure set to yes is started by the coradb service start command.
...
[service]
...
service=broker,server,javasp
# The list of database servers in all by 'coradb service start' command.# This property is effective only when the above 'service' property contains 'server' or 'javasp' keyword.server=e-commerce,testdb
...
[common]
...
[@e-commerce]java_stored_procedure=yes
[@testdb]java_stored_procedure=no% coradb service start
@ coradb master start++ coradb master start: success@ coradb server start: e-commerce
This may take a long time depending on the amount of restore works to do.CoraDB 1.0
++ coradb server start: success@ coradb server start: testdb
This may take a long time depending on the amount of recovery works to do.CoraDB 1.0
++ coradb server start: success@ coradb javasp start: e-commerce++ coradb javasp start: success@ coradb broker start++ coradb broker start: successCoraDB Java SP server log
Section titled “CoraDB Java SP server log”The logs of CoraDB Java SP server are stored in the log/ directory under the installation directory. The following log files are created for CoraDB Java Stored Procedure Server per database.
Error log
Section titled “Error log”An error log of the Java SP server for each database is saved into $CORADB/log directory, and and the format of the file name is <db_name>_java.err. The extension is .err.
e-commerce_java.errIf any error occurs during starting the Java SP server, the error message is saved into the error log file.
Time: 11/11/20 18:17:15.438 - ERROR *** file ../../src/jsp/jsp_sr.c, line 501 ERROR CODE = -900, Tran = -1, EID = 1Java VM library is not found: Failed to get 'JVM_PATH' environment variable. Failed to load libjvm from 'JAVA_HOME' environment variable: /jre/lib/amd64/server/libjvm.so: cannot open shared object file: No such file or directory /lib/server/libjvm.so: cannot open shared object file: No such file or directory.Java log
Section titled “Java log”An Java log of the JVM in the Java SP server is saved into $CORADB/log directory, and the format of the file name is <db_name>_java.log. The extension is .log.
e-commerce_java.logIf any exception during performing java stored procedure/function occurs from JVM, the exception string is saved into the java log.
SEVERE:java.lang.NullPointerExceptionat Test.testFunction(Test.java:50)...at com.coradb.jsp.StoredProcedure.invoke(StoredProcedure.java:263)at com.coradb.jsp.ExecuteThread.run(ExecuteThread.java:197)CoraDB Java SP server errors
Section titled “CoraDB Java SP server errors”The following are error messages about the errors which can be occurred in starting Java SP server. Error messages are written to $CORADB/log/<db_name>_java**.err**.
| Error code | Message | Cause | Solution |
|---|---|---|---|
| -900 | Java VM library is not found: ? | CoraDB cannot find the JVM library through JAVA_HOME or JVM_PATH. |
Set JAVA_HOME or JVM_PATH correctly; see Environment variables. |
| -901 | Java VM can not be started: ? | An internal error occurred in the JVM library; the JVM library or $CORADB/java/jspserver.jar may be broken. |
Reinstall the JRE, or try another JRE version. Replace $CORADB/java/jspserver.jar with the file of the same CoraDB version. |
The following are error messages about the errors which can be occurred when there is a problem with the connection to Java SP server including the case it is not started. Error messages are written to $CORADB/log/broker/error_log/<broker_name>_<app_server_num>.err.
| Error code | Message | Cause | Solution |
|---|---|---|---|
| -902 | Java VM is not running. | The Java SP server is not started. | Start it with coradb javasp start <db_name>. |
| -903 | Can't connect Java VM: ? | The CAS cannot connect to the Java SP server: the server is unstable, unreachable from the CAS, or was killed. | Restart the Java SP server; if that fails, kill the cora_javasp <db_name> process and start it again. Check with coradb javasp status <db_name> that its port is reachable from the CAS, open the port in the firewall, and if needed set java_stored_procedure_port and restart. |
| -905 | Networking with JVM failed: ? | The CAS received an invalid packet from the Java SP server. | Check the Java SP server log and restart the server. |