Hi,

Best thing you can do is to catch the geometry which is returned by your query. 
For me the error says that the returning feature collection is something that 
FeatureCollectionDecorator cannot turn into a simple feature collection.  I 
would guess that for example feature collection containing both points and 
polygons could make such trouble.

If your data are in PostGIS you can set PostgreSQL to log all the incoming SQL. 
Perhaps by setting Geoserver logging level from the global settings into 
GEOTOOLS_DEVELOPER_LOGGING you can collect that information into Geoserver log. 
Once you can have captured the actual SQL resend it with PSQL command line and 
see what comes back.

-Jukka Rahkonen-

________________________________
 Gavin  wrote:

this is the error from the geoserver log

2012-06-20 15:39:52,386 ERROR [geoserver.ows] -
java.lang.ClassCastException: 
org.geoserver.wms.featureinfo.FeatureCollectionDecorator cannot be cast to 
org.geotools.data.simple.SimpleFeatureCollection
        at 
org.geoserver.wms.featureinfo.GML2FeatureInfoOutputFormat.write(GML2FeatureInfoOutputFormat.java:77)
        at 
org.geoserver.wms.featureinfo.GetFeatureInfoResponse.write(GetFeatureInfoResponse.java:108)
        at org.geoserver.ows.Dispatcher.response(Dispatcher.java:909)
        at 
org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:276)
        at 
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
        at 
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
        at 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
        at 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
        at 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
        at 
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
        at 
org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
        at 
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
        at 
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
        at 
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at 
org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
        at 
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
        at 
org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:82)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
        at 
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
        at 
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at 
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
        at 
org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:97)
        at 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)



On 20 June 2012 10:43, Gavin <ga...@gnomeit.com<mailto:ga...@gnomeit.com>> 
wrote:
Hi

  Sorry Thought I had included the  geoserver version information at the bottom 
of the original email

Gavin
  *
Build Information

  *   Version 2.2-SNAPSHOT
  *   Subversion Revision 17075
  *   Build Date 14-May-2012 19:13
  *   GeoTools Version 8-SNAPSHOT (rev 38723



The full request is
unitPicker = new OpenLayers.Control.WMSGetFeatureInfo({
        url: 'http://geology.data.vic.gov.au/services/mapping/ows',
        layerUrls: ["http://geology.data.vic.gov.au/services/mapping/ows";],
        title: 'Identify features by clicking',
        queryVisible: true,
        layers: [unitLayer],
        } );


        unitPicker.infoFormat = 'application/vnd.ogc.gml';
        unitPicker.events.register("getfeatureinfo", this, pickUnitid);


If I use infoFormat = "text/plain" it all works

If I use any xml based format for infoFormat it errors

This works fine on another instance

Version 2.1.1
Subversion Revision 16080
Build Date 23-Jun-2011 10:45
GeoTools Version 2.7.2 (rev 37473)

On 19 June 2012 15:56, Andrea Aime 
<andrea.a...@geo-solutions.it<mailto:andrea.a...@geo-solutions.it>> wrote:
On Tue, Jun 19, 2012 at 1:13 AM, Gavin 
<ga...@gnomeit.com<mailto:ga...@gnomeit.com>> wrote:
Hi

 When I do a WMSGetFeatureInfo  request from open layers to geoserver using
 unitPicker.infoFormat = 'application/vnd.ogc.gml';

  Geoserver returns a <ServiceException>
java.lang.ClassCastException: 
org.geoserver.wms.featureinfo.FeatureCollectionDecorator cannot be cast to 
org.geotools.data.simple.SimpleFeatureCollection


You should provide more information about your case. Just to get started:
* GeoServer version
* are you querying a app-schema layer?
* the GetFeatureInfo URL used (you should be able to grab it using firebug or 
other web dev tools)

Cheers
Andrea


--
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313<tel:%2B39%200584%20962313>
fax:      +39 0584 962313<tel:%2B39%200584%20962313>
mob:    +39 339 8844549<tel:%2B39%C2%A0339%208844549>

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to