[GIS] WMS Request not served to OpenLayers 2 by GeoWebCache off GeoServer

geoservergeowebcacheopenlayers-2wms

I'm developing a GIS app that makes use of GeoServer and GeoWebCache for serving requests, and OpenLayers for frontend. WMS requests to the GeoServer are served with no issues. But when I make a request through GeoWebCache, nothing is returned to the client. I've enabled Direct WMS Integration in GeoWebCache configuration. I'm using GeoWebCache integrated in GeoServer. My request is as shown below:

var wmslayer = new OpenLayers.Layer.WMS(
   "Kenya Administrative Boundaries",
   "http://localhost:8081/geoserver/gwc/service/wms?", 
   {layers: 'kenya_admin', format:'image/png', transparent: true},
   {opacity: 1.0, isBaseLayer: false, visibility: true}
);
map.addLayer(wmsLayer);

But the layer is not loaded.

What am I doing wrong?

Best Answer

i want to say some solutions come to my mind.

1.check out GeoWebCache endpoint URL as http://example.com/geoserver/gwc/service/wms for GeoWebCache WMS instead.

2.check out your geowebcache.xml and openlayers whether same projection or not.

3.check out GeoWebCache demo page from http://localhost:8080/geoserver/gwc/demo.

4.check out your GeoWebCache Configuration, you can look an GWC Example here.

5.check out your param-value from cached tiles directory in web.xml(in web-inf dir) <param-value>C:\temp</param-value>

6.try to add tilesize and tileorigin to your wms option as

{ tileSize: new OpenLayers.Size(256,256),
  tileOrigin: new OpenLayers.LonLat(-180.0, 90.0)});

These are some issues about gwc which i want you to check out that has come to my mind for now.

i hope it helps you...