Hello,

If you connect to the shapefile like this...

FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureSource source = store.getFeatureSource();

...do you still get the error ?

Michael


On 17 January 2013 13:23, Alireza Shamakhy <alireza.shama...@gmail.com> wrote:
> Hi,
>
> I have a simple program that loops through a SimpleFeatureCollection.
>
>  public SimpleFeatureSource source;
>
> public class myclass()
> {
>
>      public void execute()
>         {
>               try {
>
>                         SimpleFeatureCollection featuresIn =
> source.getFeatures();
>                          System.out.println(featuresIn.size());
>               } catch (Exception e) {
>                  e.printStackTrace();
>                }
>
>         }
>
> }
>
>
> I call execute function from other class like this:
>
> public class test()
> {
>
>      public static void main(String args[])
>         {
>               try {
>                              File file= new
> File("C:\\tt\\POA_2011_AUST.shp");
>                              Map map = new HashMap();
>                              map.put( "url", file.toURL() );
>                              DataStore dataStore =
> DataStoreFinder.getDataStore( map );
>                             SimpleFeatureSource source;
>                             String typeName = dataStore.getTypeNames()[0];
>                             source = dataStore.getFeatureSource(typeName);
>
>                             myclass testclass=new myclass();
>                             testclass.source = source;
>                             testclass.execute;
>
>                } catch (Exception e) {
>                  e.printStackTrace();
>                }
>
>         }
>
> }
>
>
> after running my program it shows:
>
> java.lang.UnsupportedOperationException: AutoCommit does not support the
> getState opperations
>
> Could you please have a look and see why it happens?
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to