wiki:PetascopeEmbedded

Version 10 (modified by bphamhuu, 22 months ago) (diff)

Update about how to use jetty correctly

Embedded petascope with Jetty

How to Use

Purpose: Run petascope, secore without any further installation and configuration of a servlet container like tomcat. jetty is a Web server and javax.servlet container which can be bundled with an application. To this end, petascope, secore can be deployed with the jetty container bundled, alternatively to utilizing a standard servlet container like tomcat.

Start: Following successful installation of rasdaman with jetty enabled,

./configure --with-java-server=embedded        [and some configurations that you want to install, like --prefix=$RMANHOME]

the petascope Web service gets automatically started by the general rasdaman launch script start_rasdaman.sh.

Service URLs: After successful start, petascope accepts requests according to OGC W*S standards at http://localhost:8080/rasdaman/ows. Further, the SECORE Coordinate Reference System Resolver (CRS) service is available at http://localhost:8080/def.

Stop: The petascope/jetty service gets stopped by stop_rasdaman.sh if it has been started through start_rasdaman.sh. When started independently before executing start_rasdaman.sh, an error will notice that jetty is running and need to kill manually.

How to Change the Port

By default, jetty uses port 8080. This can be changed by editing the petascope configuration file, $RMANHOME/etc/petascope.properties. Open the file in a text editor and find the line

jetty_port=8080

Change this to the desired port, save the file, and run stop_rasdaman.sh and start_rasdaman.sh to make it work with new port.

How to Change the Extraction Folder

By default, jetty extracts files from rasdaman.war and def.war (~100 MB) into $RMANHOME/share/rasdaman/war/jetty_tmp. This directory can be changed as follows. Edit the petascope configuration file, $RMANHOME/etc/petascope.properties. Open the file in a text editor and find the line

jetty_extracted_path=

By default, this setting is empty making jetty use the default folder $RMANHOME/share/rasdaman/war/jetty_tmp. Add an absolute path, such as:

jetty_extracted_path=/tmp/petascope-jetty'

and run stop_rasdaman.sh and start_rasdaman.sh to make it work with new extracted directory.

NOTE:You should let the extracted directory by default in $RMANHOME/share/rasdaman/war/jetty_tmp as move to /tmp which can be deleted without warning from system.

Manually configure to start/stop jetty =

  1. If you do not want to start it with start_rasdaman.sh temporary, you can add this argument to stop using jetty for only this session.
start_rasdaman.sh --stop-embedded-petascope
  1. If you do not want to start it with start_rasdaman.sh permanently, you have to change in $RMANHOME/etc/petascope.properties
    start_embedded_petascope=false
    
  1. If you already disable start jetty when run start_rasdaman.sh in $RMANHOME/etc/petascope.properties by setting
    start_embedded_petascope=false
    

You can still run jetty in only this session with

start_rasdaman.sh --start-embedded-petascope

NOTE: If java_server was set to external then all these configurations do not work.

Troubleshooting

Q: Cannot start petascope/jetty to listen for Web requests.

  • A: Most likely, the petascope port is in use by another web service application program. See above for changing the petascope port. Also, make sure that petascope is not running simultaneously in tomcat.

Q: In some case, jetty has started before start_rasdaman.sh

  • A: You have to terminate this jetty or when you run start_rasdaman.sh, an error will notice old jetty is running (it does not work) and it will not start working jetty.
# Check if jetty is running
ps -ef | grep 'jetty'
rasdaman   407     1  0 Dec17 ?        00:01:39 java -cp /home/rasdaman/install//share/rasdaman/war/jetty.jar:/home/rasdaman/install//share/rasdaman/war/ start_petascope /home/rasdaman/install/
rasdaman 26955  4148  0 16:58 pts/1    00:00:00 grep --color=auto jetty

# It is old jetty and need to kill
kill -9 407

Q: My port number and/or extraction directory settings are not recognized, petascope still uses the defaults.

  • A: Assignments in the petascope configuration file, petascope.properties, must not contain any white space before or after the '='; for example, jetty_port =8080 and jetty_port = 8080 are both invalid. Further, no comment after the end of the assignment is allowed.

Q: How can I check whether jetty is up and running?

  • A: You can check the process table, and contact the service endpoint to see whether it gives a response:
    ps -ef | grep asdaman/war/jetty.jar
    wget http://localhost:8080/rasdaman/ows 
    

For Developers

In the download directory, jetty is located in rasdaman folder /applications/petascope/jetty. This folder contains:

  • jetty.jar # jetty servlet container, this is made based on Jetty 7 embedded to support JSP (default Jetty 7 does not support). Using this version to allow to run with Java 1.6.
  • start_petascope.class # compiled Java code for starting jetty with petascope
  • start_petascope.java # corresponding Java source code

make install inside `/applications/petascope' will copy all these files to $RMANHOME/share/rasdaman/war/