I don't know that part of the code well enough to answer your question; however 
now your email has enough information that hopefully someone can help you.

-- 
Jody Garnett


On Monday, 30 May 2011 at 1:34 AM, robert benjamin shimirwa wrote:

> 
> thanks jody, in fact i think it can be caused by a postgresql exception 
> primary key value duplicated... but the key is specified to be a serial type 
> in the database and it does not appear in the feature schema. does it auto 
> increment or some like that?? i'm still confused a bit...  here is the stack:
> 
> 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:177)
>  at pfeserver.RmiImpl.ajoutPoste(RmiImpl.java:150)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
>  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>  at sun.rmi.transport.Transport$1.run(Transport.java:159)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>  at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>  at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>  at java.lang.Thread.run(Thread.java:619)
>  at 
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
>  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
>  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
>  at 
> java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
>  at 
> java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
>  at $Proxy4.ajoutPoste(Unknown Source)
>  at poste_lig.jButton1ActionPerformed(poste_lig.java:1092)
>  at poste_lig.access$3100(poste_lig.java:20)
>  at poste_lig$29.actionPerformed(poste_lig.java:547)
>  at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
>  at 
> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
>  at 
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
>  at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
>  at 
> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
>  at com.jtattoo.plaf.BaseButtonListener.mouseReleased(Unknown Source)
>  at java.awt.Component.processMouseEvent(Component.java:6038)
>  at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
>  at java.awt.Component.processEvent(Component.java:5803)
>  at java.awt.Container.processEvent(Container.java:2058)
>  at java.awt.Component.dispatchEventImpl(Component.java:4410)
>  at java.awt.Container.dispatchEventImpl(Container.java:2116)
>  at java.awt.Component.dispatchEvent(Component.java:4240)
>  at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
>  at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
>  at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
>  at java.awt.Container.dispatchEventImpl(Container.java:2102)
>  at java.awt.Window.dispatchEventImpl(Window.java:2429)
>  at java.awt.Component.dispatchEvent(Component.java:4240)
>  at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
>  at 
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
>  at 
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
>  at 
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
>  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
>  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
>  at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
> Caused by: java.io.IOException: Error inserting features
>  at org.geotools.jdbc.JDBCDataStore.insert(JDBCDataStore.java:1428)
>  at org.geotools.jdbc.JDBCDataStore.insert(JDBCDataStore.java:1364)
>  at 
> org.geotools.jdbc.JDBCInsertFeatureWriter.write(JDBCInsertFeatureWriter.java:71)
>  at 
> org.geotools.data.InProcessLockingManager$1.write(InProcessLockingManager.java:335)
>  at 
> org.geotools.data.store.ContentFeatureStore.addFeature(ContentFeatureStore.java:260)
>  at 
> org.geotools.data.store.ContentFeatureStore.addFeatures(ContentFeatureStore.java:202)
>  at 
> org.geotools.data.store.ContentFeatureCollection.addAll(ContentFeatureCollection.java:307)
>  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:177)
>  at pfeserver.RmiImpl.ajoutPoste(RmiImpl.java:150)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
>  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>  at sun.rmi.transport.Transport$1.run(Transport.java:159)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>  at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>  at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>  at java.lang.Thread.run(Thread.java:619)
> Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value 
> violates unique constraint "post_lig_key"
>  at 
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
>  at 
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
>  at 
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
>  at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
>  at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
>  at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:345)
>  at 
> org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
>  at 
> org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
>  at org.geotools.jdbc.JDBCDataStore.insert(JDBCDataStore.java:1412)
>  ... 24 more
> 
> Date: Sun, 29 May 2011 07:52:32 -0700
> From: [email protected] 
> (mailto:[email protected])
> To: [email protected] (mailto:[email protected])
> Subject: Re: having trouble with an IOException.
> 
> 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
> > [hidden email] (http:///user/SendEmail.jtp?type=node&node=6416644&i=0)
> > 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 
> [hidden email] (http:///user/SendEmail.jtp?type=node&node=6416644&i=1) 
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below: 
> http://osgeo-org.1803224.n2.nabble.com/having-trouble-with-an-IOException-tp6416531p6416644.html
>  
>  To start a new topic under geotools-gt2-users, email 
> [email protected] 
> (mailto:[email protected]) 
>  To unsubscribe from geotools-gt2-users, click here 
> (http://osgeo-org.1803224.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1936685&code=YmVuc2VtdUBob3RtYWlsLmNvbXwxOTM2Njg1fDkwMDg5NDk0NA==).
>  
> ------------------------------------------------------------------------------
> 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

Reply via email to