It still looks like you are in version hell; check out this line:
> Caused by: java.lang.ClassCastException: class 
> org.geotools.data.shapefile.ShapefileDataStoreFactory
> at java.lang.Class.asSubclass(Class.java:3018)
> at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:866)
> at 
> org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:773)
> at 
> org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:808)
> at 
> org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:195)
> at 
> org.geotools.data.DataAccessFinder.getAvailableDataStores(DataAccessFinder.java:206)
> at 
> org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:114)
> at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:85)
> at 
> uk.ac.glam.smartwps.server.OWSRequestServiceImpl.wfsGetCapabilities(OWSRequestServiceImpl.java:580)
> 
> 
> 


That is an error coming right out of a class loader check; as the 
factoryregistry is loading a class from a jar. Can you check your classpath 
again please?

Jody 
On Tuesday, 19 April 2011 at 11:32 PM, Jon Britton wrote:
Hi Jody, thanks for the reply.
> 
> I upgraded to 52n wps 2.0-RC7 which uses Geotools 2.6.1, and now use the same 
> version for the WFS module. However, I'm still getting a ClassCastException 
> (although it's slightly different). I assume this means it's not finding the 
> WFS plugin? 
> 
> Cheers,
> 
> Jon
> 
> com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public 
> abstract uk.ac.glam.smartwps.client.net.WFSGetCapabilitiesResponse 
> uk.ac.glam.smartwps.client.net.OWSRequestService.wfsGetCapabilities(java.lang.String)'
>  threw an unexpected exception: java.lang.ClassCastException: class 
> org.geotools.data.shapefile.ShapefileDataStoreFactory 
> at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
> at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
> at 
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
> at 
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
> at 
> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
> at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at 
> org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
> at 
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> at 
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
> at 
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
> Caused by: java.lang.ClassCastException: class 
> org.geotools.data.shapefile.ShapefileDataStoreFactory
> at java.lang.Class.asSubclass(Class.java:3018)
> at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:866)
> at 
> org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:773)
> at 
> org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:808)
> at 
> org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:195)
> at 
> org.geotools.data.DataAccessFinder.getAvailableDataStores(DataAccessFinder.java:206)
> at 
> org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:114)
> at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:85)
> at 
> uk.ac.glam.smartwps.server.OWSRequestServiceImpl.wfsGetCapabilities(OWSRequestServiceImpl.java:580)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
> ... 22 more
> 
> On 19 April 2011 12:43, Jody Garnett <[email protected]> wrote:
> >  The two will conflict; GeoTools tries to find its plugins on the 
> > CLASSPATH; so if GeoTools 2.4.2 is around it will serve to confuse things 
> > for 2.7.0.
> > 
> > There is a copy of 52N that uses a modern version of GeoTools; I recommend 
> > you upgrade!
> > 
> > Jody
> > 
> > On Tue, Apr 19, 2011 at 9:28 PM, Jon Britton <[email protected]> 
> > wrote:
> >  Hi,
> > > 
> > > I'm trying to use the Geotools WFS module in my Google Web Toolkit 
> > > project. Unfortunately, when I try and create my WFSDataStore I get a 
> > > ClassCastException. Any idea what might cause this? 
> > > 
> > > My project uses Maven and Geotools 2.7.0. However, another of my 
> > > dependencies (52 North WPS client) uses Geotools 2.4.2 so there are some 
> > > of those jars there too... could this cause problems?
> > > 
> > > My code and the exception are show below. Any help would be greatly 
> > > appreciated.
> > > 
> > > Thanks!
> > > 
> > > Jon
> > > 
> > > CODE:
> > > 
> > > String url1 = 
> > > "http://li199-25.members.linode.com:8080/geoserver/ows?service=wfs&version=1.1.0&request=GetCapabilities";;
> > >  
> > > Map<String, String> connectionParameters = new HashMap<String, String>();
> > > connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", 
> > > url1);
> > > 
> > > try {
> > > //WFSDataStoreFactory fact;
> > > WFSDataStore data = (WFSDataStore) 
> > > DataStoreFinder.getDataStore(connectionParameters);
> > > String[] typeNames = data.getTypeNames();
> > > ArrayList<WFSFeatureType> wfsLayers = new ArrayList<WFSFeatureType>();
> > > for (int i = 0; i < typeNames.length; i++) {
> > > String typeName = typeNames[i];
> > > 
> > > WFSFeatureType newLayer = new WFSFeatureType();
> > > newLayer.setName(typeName);
> > > newLayer.setTitle(data.getFeatureTypeTitle(typeName));
> > > newLayer.setAbstract(data.getFeatureTypeAbstract(typeName));
> > > 
> > > wfsLayers.add(newLayer);
> > > }
> > > response.setWFSLayers(wfsLayers);
> > > } catch (IOException e) {
> > > // TODO Auto-generated catch block
> > > e.printStackTrace();
> > > }
> > > 
> > > 
> > > 
> > > EXCEPTION:
> > > 
> > > [WARN] Exception while dispatching incoming RPC call 
> > > com.google.gwt.user.server.rpc.UnexpectedException: Service method 
> > > 'public abstract 
> > > uk.ac.glam.smartwps.client.net.WFSGetCapabilitiesResponse 
> > > uk.ac.glam.smartwps.client.net.OWSRequestService.wfsGetCapabilities(java.lang.String)'
> > >  threw an unexpected exception: java.lang.ClassCastException
> > > at 
> > > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
> > > at 
> > > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
> > > at 
> > > com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
> > > at 
> > > com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
> > > at 
> > > com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > > at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> > > at 
> > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
> > > at 
> > > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> > > at 
> > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> > > at 
> > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
> > > at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> > > at 
> > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> > > at 
> > > org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
> > > at 
> > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> > > at org.mortbay.jetty.Server.handle(Server.java:324)
> > > at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
> > > at 
> > > org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
> > > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
> > > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> > > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> > > at 
> > > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
> > > at 
> > > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
> > > Caused by: java.lang.ClassCastException
> > > at 
> > > javax.imageio.spi.ServiceRegistry.registerServiceProvider(ServiceRegistry.java:254)
> > > at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:876)
> > > at 
> > > org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:786)
> > > at 
> > > org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:196)
> > > at 
> > > org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:160)
> > > at 
> > > org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:115)
> > > at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:84)
> > > at 
> > > uk.ac.glam.smartwps.server.OWSRequestServiceImpl.wfsGetCapabilities(OWSRequestServiceImpl.java:581)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at 
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > at 
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at 
> > > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
> > > ... 22 more
> > > 
> > > 
> > > ------------------------------------------------------------------------------
> > >  Benefiting from Server Virtualization: Beyond Initial Workload
> > >  Consolidation -- Increasing the use of server virtualization is a top
> > >  priority.Virtualization can reduce costs, simplify management, and 
> > > improve
> > >  application availability and disaster protection. Learn more about 
> > > boosting
> > >  the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> > > _______________________________________________
> > >  Geotools-gt2-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > > 
> > 
> > 
> > ------------------------------------------------------------------------------
> >  Benefiting from Server Virtualization: Beyond Initial Workload
> >  Consolidation -- Increasing the use of server virtualization is a top
> >  priority.Virtualization can reduce costs, simplify management, and improve
> >  application availability and disaster protection. Learn more about boosting
> >  the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> > _______________________________________________
> >  Geotools-gt2-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > 
> 
> 
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to