1

I am developing a project using Eclipse Java EE, Maven and Geotools. This is the part of the code that I am going to talk about:

Map connectionParameters = new HashMap();
// Connection parameters
connectionParameters.put(WFSDataStoreFactory.URL.key, getCapabilities );
connectionParameters.put(WFSDataStoreFactory.PROTOCOL.key, false );
connectionParameters.put(WFSDataStoreFactory.LENIENT.key, true );
connectionParameters.put(WFSDataStoreFactory.MAXFEATURES.key, 30);
connectionParameters.put(WFSDataStoreFactory.TIMEOUT.key, 600000);
try { // The WFSDataStoreFactory dsf is already created before
    WFSDataStore dataStore = dsf.createDataStore(connectionParameters);
    // We get the source and then the features from it
    SimpleFeatureSource source = dataStore.getFeatureSource("gmgml_AREAOBRA");
    FeatureCollection<SimpleFeatureType, SimpleFeature> fc = source.getFeatures();
    // We try to go one by one and print to see if it really exists
    while(fc.features().hasNext()){
        SimpleFeature sf = fc.features().next();
        System.out.println(sf.getAttribute("IDOBRA")); } // It crashes

The thing is that I read every post about the next error that gives me after crashing:

> SEVERE: Failed to execute request http://mapa20.ewise.es/WFS_EGIOS_SITUATIONROOM/
service.svc/get?TYPENAME=gmgml%3AAREAOBRA&REQUEST=GetFeature&OUTPUTFORMAT=text%2
Fxml%3B+subtype%3Dgml%2F3.1.1&VERSION=1.1.0&SERVICE=WFS
java.lang.RuntimeException: java.net.SocketTimeoutException: Read timed out
    at org.geotools.data.store.ContentFeatureCollection.features(ContentFeatureColl
ection.java:176)
    at org.geotools.data.store.ContentFeatureCollection.features(ContentFeatureColl
ection.java:58)
    at com.sitep.imi.acefat.server.daemon.InsertarBBDDDaemon.dataAccess(InsertarBBD
DDaemon.java:229)
    at com.sitep.imi.acefat.server.daemon.InsertarBBDDDaemon.insertData(InsertarBBD
DDaemon.java:98)
    at com.sitep.imi.acefat.App.main(App.java:17)
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:170)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnectio
n.java:1535)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java:1440)
    at org.geotools.data.ows.SimpleHttpClient$SimpleHTTPResponse.<init>(SimpleHttpC
lient.java:171)
    at org.geotools.data.ows.SimpleHttpClient.get(SimpleHttpClient.java:102)
    at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOp
enWebService.java:426)
    at org.geotools.data.wfs.internal.WFSClient.internalIssueRequest(WFSClient.java
:286)
    at org.geotools.data.wfs.internal.WFSClient.issueRequest(WFSClient.java:326)
    at org.geotools.data.wfs.WFSFeatureSource.getReaderInternal(WFSFeatureSource.ja
va:256)
    at org.geotools.data.store.ContentFeatureSource.getReader(ContentFeatureSource.
java:634)
    at org.geotools.data.store.ContentFeatureCollection.features(ContentFeatureColl
ection.java:173)

But I cannot find a specific answer for my problem.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Friedrich
  • 11
  • 2
  • Can you access `http://mapa20.ewise.es/WFS_EGIOS_SITUATIONROOM/ service.svc/get?TYPENAME=gmgml%3AAREAOBRA&REQUEST=GetFeature&OUTPUTFORMAT=text%2 Fxml%3B+subtype%3Dgml%2F3.1.1&VERSION=1.1.0&SERVICE=WFS` via browser on the same machine ? – Damien O'Reilly Sep 15 '15 at 09:45
  • @DamienO'Reilly Yes, I can. – Friedrich Sep 15 '15 at 09:46
  • what kind of response are you expecting from the request? – L. Young Sep 15 '15 at 10:09
  • @L.Young I am expecting the information of AREAOBRA from the XML that I can find in the http://mapa20.ewise.es/WFS_EGIOS_SITUATIONROOM/service.svc/get?TYPENAME=gmgml%3AAREAOBRA&REQUEST=GetFeature&OUTPUTFORMAT=text%2Fxml%3B+subtype%3Dgml%2F3.1.1&VERSION=1.1.0&SERVICE=WFS link. – Friedrich Sep 15 '15 at 10:18
  • if this is a particularly large xml and you are keeping the connection open while you parse it it may be the cause of your problem. Try to read the entire file into a variable, close the connection and then parse it. – L. Young Sep 15 '15 at 10:22
  • @L.Young If it helps, http://pastebin.com/4mv6g67a this is a part of the XML of the website. – Friedrich Sep 15 '15 at 10:28
  • @L.Young This is what I was trying to do, but when I enter the while loop it stops 'till appears the error of "timed out". – Friedrich Sep 15 '15 at 10:34
  • Are you using any firewalls or proxies with your browser / network ? – Marged Sep 15 '15 at 10:46
  • @Marged Yes, I was using the Windows Firewall, but after deactivating it, it gives the same error. – Friedrich Sep 15 '15 at 11:06
  • Are you able to tell how long it takes until the timeout value is hit ? Is this anything near the TIMEOUT you set ? And: did you try to monitor your connection with either wireshark or something more lightweight as described here: http://stackoverflow.com/questions/18512522/log-all-network-interactions-of-java-application ? – Marged Sep 15 '15 at 11:37
  • @Marged I used HTTP Analyzer 7. + 27,756 (OffSet), 32,324 s (Duration), GET (Method), 200 (Result), 192 (Received), text/xml (Type), http://mapa20.ewise.es/WFS_EGIOS_SITUATIONROOM/service.svc/get?TYPENAME=gmgml%3AAREAOBRA&REQUEST=GetFeature&OUTPUTFORMAT=text%2Fxml%3B+subtype%3Dgml%2F3.1.1&VERSION=1.1.0&SERVICE=WFS (URL) – Friedrich Sep 17 '15 at 11:36
  • @Marged The thing is in the Response content there is nothing and there is no error too (visible in the Httpanalyzer7). But there is information if I go to the link... It's so crazy. – Friedrich Sep 17 '15 at 11:36

0 Answers0