Your code looks fine; I am afraid you cut off the interesting bit of the stack
trace; somewhere in there it should say "caused by" which would give us a clue
about what actually occurred?
--
Jody Garnett
On Sunday, 29 May 2011 at 11:34 PM, robert benjamin shimirwa wrote:
> hello everyone,
> there's one java.io.IOException that is frustrating me soo much!! i have a
> postGIS table that contains features, and I'd like to add some more. i do get
> the featureType of that table and construct new features that i wish to add.
> when i do get some features from the table and set them in a
> featurecollection and try to add the newly created feature among others in
> the collection, i do get this IOException:
>
> Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
> java.io.IOException: Error inserting features
> at
> org.geotools.data.store.ContentFeatureCollection.addAll(ContentFeatureCollection.java:310)
> at
> org.geotools.data.store.ContentFeatureCollection.add(ContentFeatureCollection.java:293)
> at
> org.geotools.data.store.ContentFeatureCollection.add(ContentFeatureCollection.java:62)
> at pfeserver.ConnexionBDD.ajoutPoste(ConnexionBDD.java:179)
>
>
> at this point:
>
> SimpleFeatureStore fsr = (SimpleFeatureStore)fs;
> SimpleFeatureCollection feature_add = FeatureCollections.newCollection();
> feature_add = (SimpleFeatureCollection) fs.getFeatures();
> SimpleFeatureType ft = (SimpleFeatureType) fs.getSchema();
> GeometryFactory geomFactory = new GeometryFactory();
> SimpleFeatureBuilder build = new SimpleFeatureBuilder(ft);
> ....
>
> Coordinate crd = new Coordinate(x, y);
> build.add(geomFactory.createPoint(crd));
> SimpleFeature feature = build.buildFeature(null);
> IOExcept----> feature_add.add(feature);
> Transaction t_ad = new DefaultTransaction("Ajout poste");
>
> try{
> fsr.setTransaction(t_ad);
> System.out.println("Transaction set");
> fsr.addFeatures(feature_add);
> t_ad.commit();
> System.out.println("Transaction yakozwe.");
> rtn = "SUCESS";
> }
> ...
>
> if anybody can help opening my eyes on that, it'll be really cool.
> ------------------------------------------------------------------------------
> vRanger cuts backup time in half-while increasing security.
> With the market-leading solution for virtual backup and recovery,
> you get blazing-fast, flexible, and affordable data protection.
> Download your free trial now.
> http://p.sf.net/sfu/quest-d2dcopy1
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users