Commit 3d64da17 authored by Andrea Aime's avatar Andrea Aime
Browse files

[GEOS-9106] Enable JAI-EXT by default

parent e09f74ce
......@@ -49,26 +49,21 @@ JAI-EXT
The `JAI-EXT <https://github.com/geosolutions-it/jai-ext>`_ library is open-source project which aims to replace closed source JAI project provided by Sun. The main difference between *JAI* and *JAI-EXT* operations is the support for external **Region of Interests** (ROI) and image **NoData** in *JAI-EXT*.
By default, **JAI-EXT** operations are disabled. Add the following java option to GeoServer startup script and restart GeoServer to have them enabled.
.. code-block:: xml
-Dorg.geotools.coverage.jaiext.enabled=true
Once done, the following panel will be available at the bottom of the JAI Settings page.
The following panel is be available at the bottom of the JAI Settings page
.. figure:: img/JAIEXT.png
JAI/JAIEXT Setup panel
This panel can be used to chose which operations should be registered as *JAI* or *JAI-EXT* ones. Users can select the operations and move them from JAI-EXT to JAI list or viceversa.
This panel can be used to selectively enable/disable JAI-EXT operations in favor of JAI ones.
By default, **JAI-EXT** operations are enabled. In case of misbehavior add the following java option to GeoServer startup script and restart GeoServer to disable them.
.. figure:: img/JAIEXTops.png
.. code-block:: xml
-Dorg.geotools.coverage.jaiext.enabled=false
JAI/JAIEXT Operations selection
.. warning:: Users should take care that *JAI* native libraries are not supported by *JAI-EXT*, since *JAI-EXT* is a pure Java API.
When clicking on *Save*, GeoServer internally will replace the *JAI/JAI-EXT* operations and the associated *GeoTools* ones.
.. warning:: Users should take care that *JAI* native libraries are not supported by *JAI-EXT*, since *JAI-EXT* is a pure Java API.
......@@ -39,16 +39,83 @@ Running GeoServer under Java 11 on other Application Servers may require some ad
* **WebLogic** do not yet support Java 11.
Install native JAI and ImageIO extensions
-----------------------------------------
GeoServer cleanup
`````````````````
Once the installation is complete, you may optionally remove the original JAI files from the GeoServer ``WEB-INF/lib`` folder::
jai_core-x.y.z.jar
jai_imageio-x.y.jar
jai_codec-x.y.z.jar
where ``x``, ``y``, and ``z`` refer to specific version numbers.
.. _java_policyfiles:
Installing Unlimited Strength Jurisdiction Policy Files
-------------------------------------------------------
These policy files are needed for unlimited cryptography. As an example, Java does not support AES
with a key length of 256 bit. Installing the policy files removes these restrictions.
Open JDK
````````
Since Open JDK is Open Source, the policy files are already installed.
Oracle Java
```````````
The policy files are available at
* `Java 8 JCE policy jars <http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html>`_
* `Java 7 JCE policy jars <http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html>`_
* `Java 6 JCE policy jars <http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html>`_
The download contains two files, **local_policy.jar** and **US_export_policy.jar**. The default
versions of these two files are stored in JRE_HOME/lib/security. Replace these two files with the
versions from the download.
Test if unlimited key length is available
"""""""""""""""""""""""""""""""""""""""""
Start or restart GeoServer and login as administrator. The annotated warning should have disappeared.
.. figure:: ../security/webadmin/images/unlimitedkey.png
Additionally, the GeoServer log file should contain the following line::
"Strong cryptography is available"
.. note::
The replacement has to be done for each update of the Java runtime.
IBM Java
````````
The policy files are available at
* `IBM JCE policy jars <https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=jcesdk>`_
An IBM ID is needed to log in. The installation is identical to Oracle.
Outdated: install native JAI and ImageIO extensions
---------------------------------------------------
The `Java Advanced Imaging API <http://www.oracle.com/technetwork/java/javase/tech/jai-142803.html>`_ (JAI) is an advanced image processing library built by Oracle. GeoServer uses JAI-EXT, a set
of replacement operations with bug fixes and NODATA support, for all image processing.
The `Java Advanced Imaging API <http://www.oracle.com/technetwork/java/javase/tech/jai-142803.html>`_ (JAI) is an advanced image processing library built by Oracle. GeoServer requires JAI to work with coverages and leverages it for WMS output generation. JAI performance is important for all raster processing, which is used heavily in both WMS and WCS to rescale, cut and reproject rasters.
In case there is no interest in NODATA support, one can disable JAI-EXT and install the native JAI extensions to improve raster processing performance.
The `Java Image I/O Technology <http://docs.oracle.com/javase/6/docs/technotes/guides/imageio/index.html>`__ (ImageIO) is used for raster reading and writing. ImageIO affects both WMS and WCS for reading raster data, and is very useful (even if there is no raster data involved) for WMS output as encoding is required when writing PNG/GIF/JPEG images.
.. warning:: Users should take care that *JAI* native libraries remove support for NODATA pixels, provided instead by the pure Java JAI-EXT libraries.
By default, GeoServer ships with the "pure java" version of JAI, but **for better performance JAI and ImageIO are available as "java extensions" to be installed into your JDK/JRE**.
Before installing native JAI, JAI-EXT can be disabled adding the following system variable to the JVM running GeoServer::
However, native JAI does not support the concept of "NoData" pixels. In case you have those in input better avoid installing native JAI, and instead go and enable JAI-EXT.
-Dorg.geotools.coverage.jaiext.enabled=false
Native JAI and ImageIO extensions are available for:
......@@ -125,69 +192,4 @@ Installing native JAI manually
You can install the native JAI manually if you encounter problems using the above installers, or if you wish to install the native JAI for more than one JDK/JRE.
Please refer to the `GeoTools page on JAI installation <http://docs.geotools.org/latest/userguide/build/install/jdk.html#java-extensions-optional>`_ for details.
GeoServer cleanup
`````````````````
Once the installation is complete, you may optionally remove the original JAI files from the GeoServer ``WEB-INF/lib`` folder::
jai_core-x.y.z.jar
jai_imageio-x.y.jar
jai_codec-x.y.z.jar
where ``x``, ``y``, and ``z`` refer to specific version numbers.
.. _java_policyfiles:
Installing Unlimited Strength Jurisdiction Policy Files
-------------------------------------------------------
These policy files are needed for unlimited cryptography. As an example, Java does not support AES
with a key length of 256 bit. Installing the policy files removes these restrictions.
Open JDK
````````
Since Open JDK is Open Source, the policy files are already installed.
Oracle Java
```````````
The policy files are available at
* `Java 8 JCE policy jars <http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html>`_
* `Java 7 JCE policy jars <http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html>`_
* `Java 6 JCE policy jars <http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html>`_
The download contains two files, **local_policy.jar** and **US_export_policy.jar**. The default
versions of these two files are stored in JRE_HOME/lib/security. Replace these two files with the
versions from the download.
Test if unlimited key length is available
"""""""""""""""""""""""""""""""""""""""""
Start or restart GeoServer and login as administrator. The annotated warning should have disappeared.
.. figure:: ../security/webadmin/images/unlimitedkey.png
Additionally, the GeoServer log file should contain the following line::
"Strong cryptography is available"
.. note::
The replacement has to be done for each update of the Java runtime.
IBM Java
````````
The policy files are available at
* `IBM JCE policy jars <https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=jcesdk>`_
An IBM ID is needed to log in. The installation is identical to Oracle.
Please refer to the `GeoTools page on JAI installation <http://docs.geotools.org/latest/userguide/build/install/jdk.html#java-extensions-optional>`_ for details.
\ No newline at end of file
......@@ -17,7 +17,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import it.geosolutions.jaiext.JAIExt;
import java.awt.image.RenderedImage;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
......@@ -69,8 +68,6 @@ import org.geotools.styling.StyledLayerDescriptor;
import org.geotools.styling.Symbolizer;
import org.geotools.xml.styling.SLDParser;
import org.hamcrest.Matchers;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opengis.filter.Filter;
import org.opengis.filter.PropertyIsLessThan;
......@@ -112,16 +109,6 @@ public class ClassifierTest extends SLDServiceBaseTest {
private static final double EPS = 1e-6;
public static final String MULTIBAND_VIEW = "multiband_select";
@BeforeClass
public static void setupJaiExt() {
JAIExt.initJAIEXT(true, true);
}
@AfterClass
public static void cleanupJaiExt() {
JAIExt.initJAIEXT(false, true);
}
@Override
protected void setUpTestData(SystemTestData testData) throws Exception {
// no need for built-in layers
......
......@@ -11,7 +11,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import it.geosolutions.jaiext.JAIExt;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.IOException;
......@@ -28,24 +27,12 @@ import org.geotools.image.util.ImageUtilities;
import org.geotools.styling.ColorMap;
import org.geotools.styling.ColorMapEntry;
import org.hamcrest.CoreMatchers;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opengis.filter.expression.Expression;
import org.opengis.filter.expression.Literal;
public class RasterSymbolizerBuilderTest {
@BeforeClass
public static void setupJaiExt() {
JAIExt.initJAIEXT(true, true);
}
@AfterClass
public static void cleanupJaiExt() {
JAIExt.initJAIEXT(false, true);
}
@Test
public void testUniqueBinary() throws IOException {
RasterSymbolizerBuilder builder = new RasterSymbolizerBuilder();
......
......@@ -8,7 +8,6 @@ package org.geoserver.wps;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists;
import static org.junit.Assert.fail;
import it.geosolutions.jaiext.JAIExt;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
......@@ -61,7 +60,6 @@ public abstract class WPSTestSupport extends GeoServerSystemTestSupport {
List<GridCoverage> coverages = new ArrayList<GridCoverage>();
static {
JAIExt.initJAIEXT(true, true);
Processors.addProcessFactory(MonkeyProcess.getFactory());
Processors.addProcessFactory(MultiRawProcess.getFactory());
Processors.addProcessFactory(MultiOutputEchoProcess.getFactory());
......
......@@ -10,7 +10,6 @@ import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import it.geosolutions.jaiext.JAIExt;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.util.ArrayList;
......@@ -47,9 +46,7 @@ import org.geotools.image.util.ImageUtilities;
import org.geotools.parameter.DefaultParameterDescriptor;
import org.geotools.referencing.CRS;
import org.geotools.referencing.operation.transform.AffineTransform2D;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opengis.coverage.grid.GridCoverage;
import org.opengis.coverage.grid.GridCoverageReader;
......@@ -75,16 +72,6 @@ public class CoverageViewTest extends GeoServerSystemTestSupport {
getGeoServer().reset();
}
@BeforeClass
public static void setupJaiExt() {
JAIExt.initJAIEXT(true, true);
}
@AfterClass
public static void tearDownJaiExt() {
JAIExt.initJAIEXT(false, false);
}
static CoordinateReferenceSystem UTM32N;
@Override
......
......@@ -1966,7 +1966,7 @@
<wicket.version>7.6.0</wicket.version>
<ant.version>1.8.4</ant.version>
<imageio-ext.version>1.2.1</imageio-ext.version>
<jaiext.version>1.1.6</jaiext.version>
<jaiext.version>1.1.7</jaiext.version>
<java.awt.headless>true</java.awt.headless>
<sun.java2d.d3d>true</sun.java2d.d3d>
<jvm.opts></jvm.opts>
......
......@@ -12,6 +12,7 @@ import java.awt.Color;
import java.awt.image.BufferedImage;
import java.util.Arrays;
import java.util.List;
import org.geoserver.catalog.CoverageInfo;
import org.geoserver.catalog.DimensionDefaultValueSetting;
import org.geoserver.catalog.DimensionDefaultValueSetting.Strategy;
import org.geoserver.catalog.DimensionPresentation;
......@@ -26,6 +27,7 @@ import org.geoserver.wms.WMS;
import org.geoserver.wms.WMSDimensionsTestSupport;
import org.geoserver.wms.WMSInfo;
import org.geoserver.wms.WMSMapContent;
import org.geotools.gce.imagemosaic.ImageMosaicFormat;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletResponse;
......@@ -123,15 +125,26 @@ public class DimensionsRasterGetMapTest extends WMSDimensionsTestSupport {
/** Same as above, but obtained via sorting instead of using dimensions */
@Test
public void testSortElevationDescending() throws Exception {
BufferedImage image =
getAsImage(
BASE_PNG_URL + "&bgcolor=0xFF0000&sortBy=elevation D,ingestion D",
"image/png");
// dataset has no data, avoid interference from lower layers
CoverageInfo ci = getCatalog().getCoverageByName(getLayerId(WATTEMP));
ci.getParameters().put(ImageMosaicFormat.MAX_ALLOWED_TILES.getName().getCode(), "1");
getCatalog().save(ci);
// at this elevation the pixel is black
assertPixel(image, 36, 31, new Color(255, 0, 0));
// and this one a light blue
assertPixel(image, 68, 72, new Color(246, 246, 255));
try {
BufferedImage image =
getAsImage(
BASE_PNG_URL + "&bgcolor=0xFF0000&sortBy=elevation D,ingestion D",
"image/png");
// at this elevation the pixel is black
assertPixel(image, 36, 31, new Color(255, 0, 0));
// and this one a light blue
assertPixel(image, 68, 72, new Color(246, 246, 255));
} finally {
ci = getCatalog().getCoverageByName(getLayerId(WATTEMP));
ci.getParameters().remove(ImageMosaicFormat.MAX_ALLOWED_TILES.getName().getCode());
getCatalog().save(ci);
}
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment