ShapefileDataStore has Error attempting to close a mapped byte buffer

Description

I'm new to GeoTools. I downloaded the ShapeReaderWriter.java example from the tutorial and changed it as follows. The getFeatureSource() causes an exception. I could never get it to work. I have included gt2-main.jar, gt2-shapefile.jar and jts-1.4.jar in my classpath. The source code and the error are in the attachment as well as in the body of this description. Please help.

********************************

import java.io.File;
import java.net.URL;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.FeatureSource;
import org.geotools.data.FeatureResults;

public class ShapeReaderWriter {

public static void main(String[] args) {
try
{
URL inUrl = null;
File inFile = new File("c:/TestData/PointInput.shp");
inUrl = inFile.toURL();

ShapefileDataStore inStore = new ShapefileDataStore(inUrl);
String inName = inStore.getTypeNames()[0];
FeatureSource source = inStore.getFeatureSource(inName);
FeatureResults fsShape = source.getFeatures();
}
catch (Exception e)
{
System.out.println("Oops! Something went wrong ");
e.printStackTrace();
}
System.exit(0);
}
}

********************************************************

May 24, 2005 3:19:37 PM org.geotools.resources.NIOUtilities log
SEVERE: Error attempting to close a mapped byte buffer : java.nio.DirectByteBufferR
JVM : 1.4.1 Sun Microsystems Inc.
java.lang.NoSuchMethodException: java.nio.DirectByteBufferR.cleaner()
at java.lang.Class.getMethod0(Class.java:1756)
at java.lang.Class.getMethod(Class.java:963)
at org.geotools.resources.NIOUtilities$1.run(NIOUtilities.java:68)
at java.security.AccessController.doPrivileged(Native Method)
at org.geotools.resources.NIOUtilities.clean(NIOUtilities.java:64)
at org.geotools.data.shapefile.shp.ShapefileReader.close(ShapefileReader.java:221)
at org.geotools.data.shapefile.ShapefileDataStore.readAttributes(ShapefileDataStore.java:360)
at org.geotools.data.shapefile.ShapefileDataStore.getSchema(ShapefileDataStore.java:317)
at org.geotools.data.shapefile.ShapefileDataStore.getFeatureSource(ShapefileDataStore.java:852)
at ShapeRW.main(ShapeRW.java:19)
Exception in thread "main" java.lang.NoClassDefFoundError: org/opengis/referencing/crs/CoordinateReferenceSystem
at org.geotools.feature.DefaultAttributeTypeFactory.createAttributeType(DefaultAttributeTypeFactory.java:78)
at org.geotools.feature.DefaultAttributeTypeFactory.createAttributeType(DefaultAttributeTypeFactory.java:46)
at org.geotools.feature.AttributeTypeFactory.newAttributeType(AttributeTypeFactory.java:119)

at org.geotools.feature.AttributeTypeFactory.newAttributeType(AttributeTypeFactory.java:132)

at org.geotools.data.shapefile.ShapefileDataStore.readAttributes(ShapefileDataStore.java:336)
at org.geotools.data.shapefile.ShapefileDataStore.getSchema(ShapefileDataStore.java:317)
at org.geotools.data.shapefile.ShapefileDataStore.getFeatureSource(ShapefileDataStore.java:852)
at ShapeRW.main(ShapeRW.java:19)

********************************************************************

Thanks
Satya.

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: jgarnett - Time: Fri, 6 Jul 2007 14:14:10 -0500
---------------------
Any luck understanding this one Jesse?

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: jeichar@refractions.net - Time: Tue, 10 Jul 2007 14:55:21 -0500
---------------------
No idea I'll add this to my list of todos

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: jgarnett - Time: Mon, 3 Dec 2007 14:25:24 -0600
---------------------
This is an old old bug; can anyone reproduce it?

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: jdeolive - Time: Tue, 23 Sep 2008 18:19:55 -0500
---------------------
Changed the fix version as 2.5-M0 has been released.

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: aaime - Time: Mon, 8 Jun 2009 11:13:21 -0500
---------------------
This issue is very old and we miss a reproducable test case, so let's close it. If anybody can reproduce it with a recent GeoTools version let us know and we'll reopen the issue

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Priority

High
Configure