Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've built a couple of apps that consume WFS 1.1.0 from GeoServer 2.2.2. I organise my layers in different workspaces, and they have a range of sources including shapefile, oracle, postgres etc.

I've noticed that wfs services only work in one application at a time. If i bounce tomcat then whichever app I go to first will be able to consume wfs. If i hit a second app, no luck. I can see the request for the second app being made in the logs:

14 May 16:06:24 INFO [geoserver.wfs] -
Request: getFeature
service = WFS
version = 1.1.0
baseUrl = http://localhost:8080/geoserver/
query[0]:
    srsName = EPSG:3857
    typeName[0] = {http://www.openplans.org/usaid}jamoats_geom
outputFormat = text/xml; subtype=gml/3.1.1
resultType = results

Puzzled. Am i missing some config or security setting?

Thanks!

<---Update after iant's request for more info-->

I inherited this stack from another developer... I'm running nginx/0.7.65 & Tomcat 6 on Ubuntu 10.04.4 LTS. geoserver.war is deployed at /var/lib/tomcat6/webapps. I build a simple web-app (js/css/html) and package as a .war. I psftp this over to my server next to geoserver. I add sites to nginx for each web-app by editing /etc/nginx/sites-available/default.

I interrogated the XHR responses for a successful and an unsuccessful WFS request. I'm using two projects here to debug; 1.climvar and 2.usaid. If I load up climvar after restarting Tomcat my wfs features display. If I load up climvar after restarting Tomcat, BUT visit usaid first, no wfs features display. I looked at the responses in more detail. In both responses 82 features came back:

In the successful response:

xmlns:climvar=”http://www.fasga.com/climvar"...

In the unsuccessful response:

xmlns:usaid=”http://www.fasga.com/usaid”. 

So it seems the wrong namespace is being 'remembered' across my WFS. There is no difference between the request payloads. In the unsuccessful response, all the prefixes are null. Instead of:

<climvar:id>0</climvar:id> 

I get:

<null:id>0</null:id>

Here's my js layer definition for climvar:

    var layerOpg = new OpenLayers.Layer.Vector(nsClimVar.Constants.OPG_LAYER_NAME, {
        //id : "layerOpg",
        styleMap : nsClimVar.Styles.StyleMaps.styleMapOpg,
        strategies : [new OpenLayers.Strategy.Fixed()],
        protocol : new OpenLayers.Protocol.WFS({
            version : "1.1.0",
            url : "http://" + nsClimVar.Constants.SERVER_IP + "/geoserver/climvar/wfs", // geoserver wfs endpoint
            featurePrefix : "climvar", // geoserver worspace name
            featureType : "opg_new", // geoserver Layer Name
            featureNS : "http://www.fasga.com/climvar",
            srsName : "EPSG:900913" // default
        })
    });

Layers in usaid are declared in the same way. In GeoServer, both workspaces have the namespaces set correctly, both are enabled, both have WFS enabled. I've tried removing the featureNS and featurePrefix params but this makes no difference.

The only workaround I can think of is having all my layers in one workspace which I don't want to do.

Any ideas?

share|improve this question
    
can you give us some more information about what happens? does geoserver hang? what sort of apps? etc –  iant May 15 '13 at 13:13
    
It's nothing to do with your data source, is it, i.e. postgres? –  alexgleith Jun 12 '13 at 6:27
    
Have you looked into GeoServer log? Do you find any Exceptions? Which ones? –  EPSG31468 Jun 12 '13 at 21:58
    
No complaints in the log. See my top code snippet. And my data is from various sources. The issue is uniform across all sources –  geo_james Jun 18 '13 at 16:18
add comment

2 Answers

up vote 0 down vote accepted
+50

I had similar problems a while ago. In my case it were cache problems. Try deleting the tomcat cache (/catalina/work) and the browser cache. You could also try and let geoserver handle the workspaces.

url : "http://" + nsClimVar.Constants.SERVER_IP + "/geoserver/wfs", 
share|improve this answer
    
Simple. Don't include the namespace in the url. All my apps are now working simultaneously with WFS –  geo_james Jun 18 '13 at 16:17
add comment

I suspect an out of memory error: the first application to be accessed will issue a large (how many features are fetched with every layer?) WFS request which completes, but prevents further requests from being carried out successfully.

This explains the works-after-restart behaviour as with a restart all JVM memory would be released and then reallocated again.

To check if this is your case please report the JVM startup parameters used by tomcat:

/bin/ps auxwww | /bin/grep java

is usually enough to find out which parameters have been set.

For a reference consider that you should find values like those suggested in the Geoserver guide in the 'JVM Tuning' para of the 'Running in production' section. In case you don't then you are probably hitting a memory wall.

Apply the values suggested in the guide (your server should have at least 3GB of RAM for those values. In the case of x64 architecture double all of them, including the memory requirement that I just mentioned) and then let us know how it goes.

While not strictly necessary to sort this issue out, please report the vendor and jdk version which can be obtained with the following command:

java -version
share|improve this answer
    
This wasn't the cause of my problem but I've now tuned my geoserver as per your link –  geo_james Jun 18 '13 at 16:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.