Hello my name is Juan Manuel, i begin to work with geotools and i have
anything problems, i need help.


*My enviroment :*

 - Windows 2000
 - JDeveloper 10.1.3.3.0
 - Java 1.5
 - App server Oracle Containers for J2EE 10g (10.1.3.3.0)
 - Geoserver 1.7
 - Geotools 2.5.5

*My Problem:*
When I try insert a Geometry by WFS 1.0.0, Geotools thows this Exception:

*java.lang.NullPointerException*
* at
org.geotools.xml.wfs.WFSTransactionComplexTypes$InsertElementType.encode(WFSTransactionComplexTypes.java:922)
*
* at
org.geotools.xml.wfs.WFSTransactionComplexTypes$TransactionType.encode(WFSTransactionComplexTypes.java:306)
*
* at org.geotools.xml.DocumentWriter.writeFragment(DocumentWriter.java:316)*
* at org.geotools.xml.DocumentWriter.writeDocument(DocumentWriter.java:214)*
* at
org.geotools.data.wfs.v1_0_0.WFSTransactionState.commitPost(WFSTransactionState.java:278)
*
* at
org.geotools.data.wfs.v1_0_0.WFSTransactionState.commit(WFSTransactionState.java:149)
*
* at
org.geotools.data.DefaultTransaction.commit(DefaultTransaction.java:182)*
* at
es.dap.sig.web.request.MapRequestManager.addFeatures(MapRequestManager.java:423)
*
* at
es.dap.sig.web.commands.pg.RecursosCommand.insertTransaction(RecursosCommand.java:60)
*
* at
es.dap.sig.web.commands.pg.AbstractEditorCommand.execute(AbstractEditorCommand.java:44)
*
* at es.dap.sig.web.ControllerServlet.doPost(ControllerServlet.java:38)*
* at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)*
* at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)*
* at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
*
* at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
*
* at
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
*
* at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
*
* at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
*
* at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
*
* at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
*
* at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
*
* at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
*
* at
oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
*
* at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
*
* at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
*
* at java.lang.Thread.run(Thread.java:*595)
*
My Code**:

**public static void addFeatures(String layer, Listst<Map<String, Object>>
featAttribs) {   *
*        *
*        WFSDataStore wfsDataStore;*
*        FilterFactory filterFactory;*
*        FeatureSource<SimpleFeatureType, SimpleFeature> featSource;*
*        FeatureCollection<SimpleFeatureType, SimpleFeature> collection; *
*        FeatureStore<SimpleFeatureType, SimpleFeature> featStore;*
*        Map map;*
*        Transaction insert;*
*        SimpleFeatureBuilder featBuilder;*
*        SimpleFeature feat;*
*        String wfsUrl = null;*
*        String nameSpace = null;*
*        String epsg = null;*
*        *
*        try {*
*            nameSpace = geoServerConfig.getNameSpace();*
*            wfsUrl = geoServerConfig.getWFSServerUrl() + getCapRequestStr;*
*            epsg = geoServerConfig.getEpsg().toString();*
*        *
*            insert = new DefaultTransaction("insert");***
*            *
*            //Parámatros de conexión al servicio WFS*
*            map = new HashMap();            *
*            *
*            map.put(WFSDataStoreFactory.URL.key, wfsUrl);*
*            //map.put(WFSDataStoreFactory.ENCODING.key, "ISO-8859-1");*
*            //map.put(WFSDataStoreFactory.ENCODING.CRS, epsg);*
*            map.put(WFSDataStoreFactory.TIMEOUT.key, new Integer(10000));*
*            *
*            wfsDataStore = (new
WFSDataStoreFactory()).createDataStore(map);            *
*            featSource = wfsDataStore.getFeatureSource( nameSpace + layer
);*
*            *
*            featStore = (FeatureStore<SimpleFeatureType, SimpleFeature>)
featSource; *
*            featStore.setTransaction(insert);*

*            featBuilder = new
SimpleFeatureBuilder(featSource.getSchema());            *
*            collection = FeatureCollections.newCollection();*

*            for(Map<String, Object> featAttribsMap : featAttribs){*
*                for(String key : featAttribsMap.keySet()){*
*                    featBuilder.set(key,
featAttribsMap.get(key));                    *
*                }*
*                //null para que genere un id por defecto*
*                feat = featBuilder.buildFeature(null);*
*                collection.add(feat);*
*            }*
*            *
*            featStore.addFeatures( collection );*
*            insert.commit(); *
*        } *
*        catch (MalformedURLException e) {*
*            e.printStackTrace();*
*        } *
*        catch (IOException e) {*
*            e.printStackTrace();*
*        }*
*    }*

Excuse my English, any idea I would be very useful.
*Thank you very much*
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to