Hey List,
i'm pretty new to geotools but think its a great tool to process
geodata with java.

I would like to access and process a postgis-database with geotools
but still got an error:

Exception in thread "main" java.lang.NoSuchMethodError:
com.vividsolutions.jts.io.ByteArrayInStream.setBytes([B)V
    at 
org.geotools.data.postgis.WKBAttributeIO.wkb2Geometry(WKBAttributeIO.java:81)
    at org.geotools.data.postgis.WKBAttributeIO.read(WKBAttributeIO.java:112)
    at 
org.geotools.data.postgis.PostGISDialect.decodeGeometryValue(PostGISDialect.java:195)
    at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:310)
    at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:70)
    at 
org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:145)
    at 
org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:125)
    at 
tools.postgisAccess.APostgisAccessTool.<init>(APostgisAccessTool.java:115)


This is the code in APostgisAccessTool:
HashMap<String, Object> params = new HashMap<String, Object>();
        params.put("dbtype", "postgis");
        params.put("host", "hostname");
        params.put("port", new Integer(5432));
        params.put("database", "database-name");
        params.put("user", "user");
        params.put("passwd", "pass");

        String table = "table";
        String column = "column";

        try {
            DataStore dataStore = DataStoreFinder.getDataStore(params);

            SimpleFeatureSource pgSource = dataStore.getFeatureSource(table);
            SimpleFeatureCollection featureColl =
pgSource.getFeatures(CQL.toFilter(column + " is not null"));

            int count = dataStore.getFeatureSource(table).getCount(Query.ALL);

            SimpleFeatureIterator featureIter = featureColl.features();
            while(featureIter.hasNext()) {

                /* #### LINE 115 #### */
                SimpleFeature feature = featureIter.next();
            }

        } catch (IOException | CQLException e) {
            e.printStackTrace();
        }


As you can see, the exception throws when getting the next feature
from the iterator (below comment).
I reduced my database, as there is only one row with one point
geometry which is in epsg 4326. Count gives me the correct result ( 1
).
I'm using a Postgres 9.1 database with 9.1-901.jdbc4 connector.
I first used geotools 8.0 (stable) and tried it with an upgraded
version 9.0. Neither of both worked.

I also tried to switch bytea_output set to "escape" instead of "hex".
Nothing changed.

Does anybody knows a solution or have an hint how to solve this
problem? - Thanks.

Greetings,
paul.

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to