Hi again.
We're working with DATE type in MySQL
CREATE TABLE XXX
(
ID NUMERIC(11) NOT NULL,
GEOM GEOMETRY NOT NULL,
FH_FECHA DATE,
PRIMARY KEY (ID),
SPATIAL INDEX(GEOM)
);
An insert testing example (all our WFS requests are made through Geotools):
GeometryFactory factory = new GeometryFactory();
Geometry geom = factory.createPoint( new Coordinate(px,py));
geom.setUserData("EPSG:4326");
........
WFSDataStore wfsDataStore = (new
WFSDataStoreFactory()).createDataStore(map);
FeatureSource<SimpleFeatureType, SimpleFeature> featSource =
wfsDataStore.getFeatureSource(nameSpace + layer );
FeatureStore<SimpleFeatureType, SimpleFeature> featStore =
(FeatureStore<SimpleFeatureType, SimpleFeature>) featSource;
Transaction insert = new DefaultTransaction("insert");
featStore.setTransaction(insert);
SimpleFeatureBuilder featBuilder = new
SimpleFeatureBuilder(featSource.getSchema());
SimpleFeature feat = featBuilder.buildFeature(null);
featBuilder.set("ID", new Long(1));
featBuilder.set("FH_FECHA", new Date());
featBuilder.set("GEOM", geom);
FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
FeatureCollections.newCollection();
collection.add(feat);
featStore.addFeatures( collection );
insert.commit();
the full stack trace:
10-jun-2009 8:55:10 org.geotools.data.wfs.v1_0_0.WFSTransactionState
commit
ADVERTENCIA: org.geotools.ows.ServiceException:
java.lang.RuntimeException: Parsing failed for FH_FECHA:
java.lang.IllegalArgumentException: Failed to parse date at:
Parsing failed for FH_FECHA: java.lang.IllegalArgumentException:
Failed to parse date at:
Failed to parse date at:
09/06/10 08:55:10 java.io.IOException: An error occured while
committing.
09/06/10 08:55:10 at
org.geotools.data.wfs.v1_0_0.WFSTransactionState.commit(WFSTransactionState.java:174)
09/06/10 08:55:10 at
org.geotools.data.DefaultTransaction.commit(DefaultTransaction.java:182)
09/06/10 08:55:10 at
es.dap.sig.web.request.MapRequestManager.addFeatures(MapRequestManager.java:442)
09/06/10 08:55:10 at
es.dap.sig.web.commands.pg.RecursosCommand.insertTransaction(RecursosCommand.java:83)
09/06/10 08:55:10 at
es.dap.sig.web.commands.pg.AbstractEditorCommand.execute(AbstractEditorCommand.java:44)
09/06/10 08:55:10 at
es.dap.sig.web.ControllerServlet.doPost(ControllerServlet.java:38)
09/06/10 08:55:10 at
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
09/06/10 08:55:10 at
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
09/06/10 08:55:10 at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
09/06/10 08:55:10 at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
09/06/10 08:55:10 at
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
09/06/10 08:55:10 at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
09/06/10 08:55:10 at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
09/06/10 08:55:10 at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
09/06/10 08:55:10 at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
09/06/10 08:55:10 at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
09/06/10 08:55:10 at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
09/06/10 08:55:10 at
oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
09/06/10 08:55:10 at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
09/06/10 08:55:10 at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
09/06/10 08:55:10 at java.lang.Thread.run(Thread.java:595)
MySQL DataStore isn´t implemented for the WFS 1.1, is it?
Thanks!
Justin Deoliveira escribió:
I do not know of any open issues of this exact case, but it would not
surprise me. MySQL is unfortunately not one of our best maintained
datstores, and working with dates is always tricky.
Dates in postgis however (and Oracle NG) should work ok, they are
tested pretty thoroughly as part of the WFS 1.1 specification tests
(CITE).
As for your direct problem, can you supply the following:
1) the full stack trace
2) the schema of your data, in particular the exact type of the date
column
3) the request that is being made (if available), or what client you
are using.
Thanks,
-Justin
Antonio Redondo Lora wrote:
Hi,
do you know if there is any problems updating features with WFS and the
Geoserver MySQL data store?
I think I've read about similar errors working with java.util.Date and
PostGis or Oracle.
We have the same locale in client and server but after invoking a wfs
addFeatures commit, we have this error in the server log ( ... i think
is throwed on the FeatureType validating):
java.lang.RuntimeException: Parsing failed for FH_FECHA:
java.lang.IllegalArgumentException: Failed to parse date Tue Feb 03
01:00:00 CET 2009 at:Tue Feb 03 01:00:00 CET 2009
at
org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:158)
....
Any advice? Thanks in advance.
Best regardas, Antonio
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
--------------------------------
Antonio Redondo Lora
Subdirección de Sistemas Informáticos
E.P. Desarrollo Agrario y Pesquero
c/Bergantín, 39 - 41012 Sevilla (España)
Email: arlora@anonymised.com
Tlfno: 955059762
Corporativo: 359762
--------------------------------