Opened 14 years ago

Last modified 14 years ago

#3711 closed defect

EXCEPTION_ACCESS_VIOLATION, when using GDAL Java API — at Version 1

Reported by: jimmyzhao Owned by: Even Rouault
Priority: highest Milestone:
Component: JavaBindings Version: 1.7.1
Severity: critical Keywords: GDAL, GeoRaster
Cc: warmerdam

Description (last modified by jimmyzhao)

I use GDAL Java API to write raster data to Oracle Spatial GeoRaster Object, and encouter a strange problem:

" # # A fatal error has been detected by the Java Runtime Environment:

# # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0afa0770,pid=5904, tid=5548

# # JRE version: 6.0_15-b03

# Java VM: Java HotSpot(TM) Client VM (14.1-b02 mixed mode windows-x86 )

# Problematic frame:

# C [gdal17.dll+0x190770]

# # An error report file with more information is saved as: # D:\workspace\GDALTest\hs_err_pid5904.log

# # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp[[BR]]

# The crash happened outside the Java Virtual Machine in native code.

"

This is my Java codes:

import java.nio.ByteBuffer;

import org.gdal.gdal.Band;
import org.gdal.gdal.Dataset;
import org.gdal.gdal.Driver;
import org.gdal.gdal.gdal;
import org.gdal.gdalconst.gdalconstConstants;


public class GDALTest3 {

	public static void main(String[] args) {

		Dataset dataset1;
		Dataset dataset2;
		
		Band band1;
		Band band2;
		
		Driver driver;
		
		gdal.AllRegister();
		
		driver = gdal.GetDriverByName("georaster");
		
		dataset1 = gdal.Open("geor:georaster/georaster@orcl,rdt_01,1");
		band1 = dataset1.GetRasterBand(1);
		
		int xSize = dataset1.getRasterXSize();
		int ySize = dataset1.getRasterYSize();
		int bands = dataset1.getRasterCount();
		
		String options[] = new String[]{"INSERT=VALUES(103, 'new.tif', SDO_GEOR.INIT('rdt_01',3))", "BLOCKXSIZE=512", "BLOCKYSIZE=512"};
		dataset2 = driver.Create("georaster:georaster/georaster,,georaster_table,georaster",
				xSize, ySize, bands, band1.getDataType(), options);
		
		dataset2.SetGeoTransform(dataset1.GetGeoTransform());
		dataset2.SetProjection(dataset1.GetProjection());
		
		band2 = dataset2.GetRasterBand(1);
		
		ByteBuffer buffer = ByteBuffer.allocateDirect(xSize);
		
		for( int i =0; i < ySize; i++ ) {
			
			buffer = band1.ReadRaster_Direct(0,i,xSize,1);
			
			band2.WriteRaster_Direct(0,i,xSize,1,buffer);
		}
		
		dataset2.FlushCache();
		
		System.out.println("generate a new georaster : " + dataset2.GetDescription());
		
		dataset1.delete();
		dataset2.delete();		
	}

}

When executing the sentence "Dataset2.FlushCache();", the above problem rises.

By the way, I can use gdal_translate to load GTiff file to Oracle Georaster database successfully, and I can also export Oracle Spatial GeoRaster data to GTiff file with GDAL Java API. But why can't I use GDAL Java API to load GTiff file to Oracle GeoRaster database?

The version of GDAL is 1.7.1, and it is compiled with Visual Studio 2008. The GTiff image is 183MB with 3 bands. The log of exact error is attached.

Change History (3)

by jimmyzhao, 14 years ago

Attachment: hs_err_pid5904.log added

error report

by jimmyzhao, 14 years ago

Attachment: hs_err_pid1464.log added

comment:1 by jimmyzhao, 14 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.