[Geoserver-devel] Recurring issue: "could not locate service mapping to: (wfs, null)"

Hi all,
this user question popped up quite often lately, always by people having
java code making requests to geoserver that used to work with 1.3.x and
do not work any more with 1.4.0 onwards.

The issue happens because we changed the behaviour to consider a POST
request a real post only if the mime type is not set to "application-x-www-form-urlencoded". Here is the code in Dispather.dispatch(...) (web module):

boolean isGet = "GET".equalsIgnoreCase(httpRequest.getMethod())
             || ((httpRequest.getContentType() != null)
             && httpRequest.getContentType().startsWith("application/x-www-form-urlencoded"));

Unfortunately when you do a POST with java that mime type is the default. We started considering that to allow people make big
WMS request (encoding the same GET parameters in a POST request).
Since the dispatcher does not know about the service, it treats every
request like this, not only WMS ones.

I do believe the change is doing more harm than good. Opinions?
Cheers
Andrea

StaceyRoos ha scritto:

I am having a similar problem to this one - posted on 16th January (i.e.
problems when querying geoserver from code, but not from the demo). I
followed this thread but it doesn't seem to have been resolved. I tried all
the solutions suggested to the original poster, including testing using a
standard query, that I cut and pasted from the demo, and adding GetFeature
to the end of the URL. (This resulted in a different error , and again -
worked in the demo)

When I use the same code, but post to a geoserver v1.3 - there is no
problem, the problem is only occurring with v. 1.4. Note that I do not get
back an error if I use the Geoserver demo, only when I try to post a query
from within code.

If anyone has any additional ideas I would really appreciate it - something
has obviously changed between the two versions - and I don't know where to
start looking to track it down. Details follow.

Thanks
Stacey Roos

Java Code used to do the request:
/********************/
URL url = new URL(wfsURL); // this is one of the URL's listed below
URLConnection connection = url.openConnection();
connection.setDoOutput(true);

OutputStreamWriter out = new OutputStreamWriter(
connection.getOutputStream());
out.write(wfsRequest); // this has been passed in to the method - I am
using the query listed below
out.close();
/*******************/
Response is simply read in on an input stream from the same connection.

URLs: working URL: http://ict4eo.meraka.csir.co.za:8080/geoserver_1.3/wfs not working( v1.4): http://ict4eo.meraka.csir.co.za:8080/geoserver/wfs

Query tested: <wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2'
xmlns:topp='http://www.openplans.org/topp’ xmlns:wfs='http://www.opengis.net/wfs
xmlns:ogc='http://www.opengis.net/ogc’ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’> <wfs:Query
typeName='topp:states'> <ogc:Filter> <ogc:FeatureId
fid='states.3'/> </ogc:Filter> </wfs:Query> </wfs:GetFeature>

Response received:
<?xml version="1.0" ?><ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/ogc
http://ict4eo.meraka.csir.co.za:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd&quot;&gt; <ServiceException> org.vfny.geoserver.ServiceException: Could not
locate service mapping to: (wfs,null) at
org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193) at
org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
at .... etc .....

</ServiceException></ServiceExceptionReport>

Original post:
-----------------

Lee Wai See wrote:

Hi,

I am trying to send a GetFeature request (with a ogc:DWithin filter) to GeoServer in my Java business code. However, I got the following

error:

25592 [WARNING] org.vfny.geoserver.ServiceException - encountered error: Could not locate service mapping to: (wfs,null)

StackTrace: org.vfny.geoserver.ServiceException: Could not locate service mapping to: (wfs,null)

            at org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193)

            at

org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)

            at

<snipped rest of stack trace>

I'd agree this is doing more harm than good. Posting with Java is going to be very common. Perhaps we can make a different way in for big WMS requests? Like a special servlet location? Or maybe just only doing this interpretation if it's a WMS request?

Chris

Andrea Aime wrote:

Hi all,
this user question popped up quite often lately, always by people having
java code making requests to geoserver that used to work with 1.3.x and
do not work any more with 1.4.0 onwards.

The issue happens because we changed the behaviour to consider a POST
request a real post only if the mime type is not set to "application-x-www-form-urlencoded". Here is the code in Dispather.dispatch(...) (web module):

boolean isGet = "GET".equalsIgnoreCase(httpRequest.getMethod())
             || ((httpRequest.getContentType() != null)
             && httpRequest.getContentType().startsWith("application/x-www-form-urlencoded"));

Unfortunately when you do a POST with java that mime type is the default. We started considering that to allow people make big
WMS request (encoding the same GET parameters in a POST request).
Since the dispatcher does not know about the service, it treats every
request like this, not only WMS ones.

I do believe the change is doing more harm than good. Opinions?
Cheers
Andrea

StaceyRoos ha scritto:

I am having a similar problem to this one - posted on 16th January (i.e.
problems when querying geoserver from code, but not from the demo). I
followed this thread but it doesn't seem to have been resolved. I tried all
the solutions suggested to the original poster, including testing using a
standard query, that I cut and pasted from the demo, and adding GetFeature
to the end of the URL. (This resulted in a different error , and again -
worked in the demo)

When I use the same code, but post to a geoserver v1.3 - there is no
problem, the problem is only occurring with v. 1.4. Note that I do not get
back an error if I use the Geoserver demo, only when I try to post a query
from within code.

If anyone has any additional ideas I would really appreciate it - something
has obviously changed between the two versions - and I don't know where to
start looking to track it down. Details follow.

Thanks
Stacey Roos

Java Code used to do the request:
/********************/
URL url = new URL(wfsURL); // this is one of the URL's listed below
URLConnection connection = url.openConnection();
connection.setDoOutput(true);

OutputStreamWriter out = new OutputStreamWriter(
connection.getOutputStream());
out.write(wfsRequest); // this has been passed in to the method - I am
using the query listed below
out.close();
/*******************/
Response is simply read in on an input stream from the same connection.

URLs: working URL: http://ict4eo.meraka.csir.co.za:8080/geoserver_1.3/wfs not working( v1.4): http://ict4eo.meraka.csir.co.za:8080/geoserver/wfs

Query tested: <wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2'
xmlns:topp='http://www.openplans.org/topp’ xmlns:wfs='http://www.opengis.net/wfs
xmlns:ogc='http://www.opengis.net/ogc’ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’> <wfs:Query
typeName='topp:states'> <ogc:Filter> <ogc:FeatureId
fid='states.3'/> </ogc:Filter> </wfs:Query> </wfs:GetFeature>

Response received:
<?xml version="1.0" ?><ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/ogc
http://ict4eo.meraka.csir.co.za:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd&quot;&gt; <ServiceException> org.vfny.geoserver.ServiceException: Could not
locate service mapping to: (wfs,null) at
org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193) at
org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
at .... etc .....

</ServiceException></ServiceExceptionReport>

Original post:
-----------------

Lee Wai See wrote:

Hi,

I am trying to send a GetFeature request (with a ogc:DWithin filter) to GeoServer in my Java business code. However, I got the following

error:

25592 [WARNING] org.vfny.geoserver.ServiceException - encountered error: Could not locate service mapping to: (wfs,null)

StackTrace: org.vfny.geoserver.ServiceException: Could not locate service mapping to: (wfs,null)

            at org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193)

            at

org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)

            at

<snipped rest of stack trace>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:1003,45daf675128381362196140!

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org

I ran into this problem on trunk as well. And yes, the logic is bad... I
havent fixed it yet because the fix is substantial.

I think the solution is to always process both the body and the header
when processing a request, instead of trying to figure out if the
request is post or get, and then processing one or the other.

I think this should be back portable to 1.5.x.

-Justin

Andrea Aime wrote:

Hi all,
this user question popped up quite often lately, always by people having
java code making requests to geoserver that used to work with 1.3.x and
do not work any more with 1.4.0 onwards.

The issue happens because we changed the behaviour to consider a POST
request a real post only if the mime type is not set to
"application-x-www-form-urlencoded". Here is the code in
Dispather.dispatch(...) (web module):

boolean isGet = "GET".equalsIgnoreCase(httpRequest.getMethod())
             || ((httpRequest.getContentType() != null)
             &&
httpRequest.getContentType().startsWith("application/x-www-form-urlencoded"));

Unfortunately when you do a POST with java that mime type is the
default. We started considering that to allow people make big
WMS request (encoding the same GET parameters in a POST request).
Since the dispatcher does not know about the service, it treats every
request like this, not only WMS ones.

I do believe the change is doing more harm than good. Opinions?
Cheers
Andrea

StaceyRoos ha scritto:

I am having a similar problem to this one - posted on 16th January (i.e.
problems when querying geoserver from code, but not from the demo). I
followed this thread but it doesn't seem to have been resolved. I tried all
the solutions suggested to the original poster, including testing using a
standard query, that I cut and pasted from the demo, and adding GetFeature
to the end of the URL. (This resulted in a different error , and again -
worked in the demo)

When I use the same code, but post to a geoserver v1.3 - there is no
problem, the problem is only occurring with v. 1.4. Note that I do not get
back an error if I use the Geoserver demo, only when I try to post a query
from within code.

If anyone has any additional ideas I would really appreciate it - something
has obviously changed between the two versions - and I don't know where to
start looking to track it down. Details follow.

Thanks
Stacey Roos

Java Code used to do the request:
/********************/
URL url = new URL(wfsURL); // this is one of the URL's listed below
URLConnection connection = url.openConnection();
connection.setDoOutput(true);

OutputStreamWriter out = new OutputStreamWriter(
connection.getOutputStream());
out.write(wfsRequest); // this has been passed in to the method - I am
using the query listed below
out.close();
/*******************/
Response is simply read in on an input stream from the same connection.

URLs: working URL: http://ict4eo.meraka.csir.co.za:8080/geoserver_1.3/wfs
            not working( v1.4):
http://ict4eo.meraka.csir.co.za:8080/geoserver/wfs

Query tested:
<wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2'
xmlns:topp='http://www.openplans.org/topp
xmlns:wfs='http://www.opengis.net/wfs
xmlns:ogc='http://www.opengis.net/ogc
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation='http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’> <wfs:Query
typeName='topp:states'> <ogc:Filter> <ogc:FeatureId
fid='states.3'/> </ogc:Filter> </wfs:Query> </wfs:GetFeature>

Response received:
<?xml version="1.0" ?><ServiceExceptionReport version="1.2.0"
xmlns="http://www.opengis.net/ogc&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.opengis.net/ogc
http://ict4eo.meraka.csir.co.za:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd&quot;&gt;
<ServiceException> org.vfny.geoserver.ServiceException: Could not
locate service mapping to: (wfs,null) at
org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193) at
org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
at
.... etc .....

</ServiceException></ServiceExceptionReport>

Original post:
-----------------

Lee Wai See wrote:

Hi,

I am trying to send a GetFeature request (with a ogc:DWithin filter)
to GeoServer in my Java business code. However, I got the following

error:

25592 [WARNING] org.vfny.geoserver.ServiceException - encountered
error: Could not locate service mapping to: (wfs,null)

StackTrace: org.vfny.geoserver.ServiceException: Could not locate
service mapping to: (wfs,null)

            at
org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193)

            at

org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)

            at

<snipped rest of stack trace>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:1004,45daf675128371194215290!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Justin Deoliveira ha scritto:

I ran into this problem on trunk as well. And yes, the logic is bad... I
havent fixed it yet because the fix is substantial.

I think the solution is to always process both the body and the header
when processing a request, instead of trying to figure out if the
request is post or get, and then processing one or the other.

I think this should be back portable to 1.5.x.

Can you open a Jira issue so that we don't release 1.5.0 without
the backport? And then, test, test, test :slight_smile:
Cheers
Andrea

Jira seems to be down for me, can anyone confirm? I cant create issues.
But as soon as its up i will file the issue against 1.5.0 as a blocker.

-Justin

Andrea Aime wrote:

Justin Deoliveira ha scritto:

I ran into this problem on trunk as well. And yes, the logic is bad... I
havent fixed it yet because the fix is substantial.

I think the solution is to always process both the body and the header
when processing a request, instead of trying to figure out if the
request is post or get, and then processing one or the other.

I think this should be back portable to 1.5.x.

Can you open a Jira issue so that we don't release 1.5.0 without
the backport? And then, test, test, test :slight_smile:
Cheers
Andrea

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:1004,45db33b6177501116498154!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Justin Deoliveira ha scritto:

Jira seems to be down for me, can anyone confirm? I cant create issues.
But as soon as its up i will file the issue against 1.5.0 as a blocker.

Yep, Jira has been having issues all day. On the codehaus irc channel they told me they're working on it (that happened some 6 hours ago thought).

Cheers
Andrea