Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ClassCastException: java.util.ArrayList cannot be cast to java.util.Map

    I get a a class cast exception when I go to:
    http://127.0.0.1:8888/Gwtshop/iso/Da...=KgSalesImages

    As discussed previsouly in thread:
    http://forums.smartclient.com/showthread.php?t=6038

    sergeyb mentions that he fixed the problem but he doesn't say how.

    I am using smartgwtee. I've modelled my example from the spring-hibernate-dmi example, which I have running in a separate project.
    I have not:
    Originally posted by Isomorphic
    You could get this if you had deleted the public/sc/system/schema area in smartgwtee.jar.
    as stated in thread above.

    My smartgwt jars are set up correctly. Could it be something do with other dependencies. apache-commons perhaps?

    the data source
    Code:
    <!-- **************************************************************************** -->
    <!-- FILE: /examples/shared/ds/supplyItemSpringDMI.ds.xml -->
    <!-- **************************************************************************** -->
    
    <DataSource
            ID="KgSalesDMI"
            serverType="generic"
            >
    
    
        <fields>
            <field name="uid" type="text" primaryKey="true"></field>
            <field name="priceTotal" type="float"></field>
            <field name="pickingZone" type="enum" title="Type" >
                <valueMap>
                    <value>TRADING_ARTICLES</value>
                    <value>Trading Articles</value>
                    <value>Bearings</value>
                </valueMap>
            </field>
            <field name="title" type="text"></field>
            <field name="description" type="text"></field>
            <field name="images" title="Images" multiple="true" type="KgSalesImages"/>
            <field name="lotNr" type="integer"></field>
            <field name="weight" type="float"></field>
            <field name="location" type="text"></field>
            <field name="shortItemNumber" type="integer"></field>
            <field name="preferredImage" title="Thumbnail" type="image" imageURLPrefix="/mvc/thumbnail/"
                   imageURLSuffix=".JPG"/>
        </fields>
    
        <serverObject lookupStyle="spring" bean="kgSalesController"/>
    
        <!-- You can define an operationBindings section to bind operation names to server method               
             (potentially additionally discriminated by the operationId).
             In the absense of this section, the server will look for a server method named after
             the operationType.
        -->
        <operationBindings>
            <binding operationType="fetch" serverMethod="fetch">
                <serverObject lookupStyle="spring" bean="kgSalesController"/>
            </binding>
        </operationBindings>
    </DataSource>
    The stacktrace:.
    Code:
    
    
    javax.servlet.ServletException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
    	at com.isomorphic.datasource.BasicDataSource.buildFieldData(BasicDataSource.java:304)
    	at com.isomorphic.datasource.BasicDataSource.init(BasicDataSource.java:159)
    	at com.isomorphic.datasource.BasicDataSource.fromConfig(BasicDataSource.java:126)
    	at com.isomorphic.datasource.DataSource.fromConfig(DataSource.java:164)
    	at com.isomorphic.datasource.FileSystemDSRepo.loadDS(FileSystemDSRepo.java:110)
    	at com.isomorphic.datasource.DataSource.forName(DataSource.java:147)
    	at com.isomorphic.datasource.DataSource.forName(DataSource.java:144)
    	at com.isomorphic.datasource.DataSource.forName(DataSource.java:141)
    	at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject(PoolableDataSourceFactory.java:89)
    	at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject(PoolableDataSourceFactory.java:96)
    	at com.isomorphic.pool.PoolManager.borrowObject(PoolManager.java:76)
    	at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:56)
    	at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:80)
    	at com.isomorphic.servlet.DataSourceLoader.doGet(DataSourceLoader.java:64)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	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$CachedChain.doFilter(ServletHandler.java:1097)
    	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at com.asm.security.BiztrackConcurrentSessionFilter.doFilter(BiztrackConcurrentSessionFilter.java:59)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    	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.headerComplete(HttpConnection.java:829)
    	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
    	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)
    
    	at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:88)
    	at com.isomorphic.servlet.DataSourceLoader.doGet(DataSourceLoader.java:64)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	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$CachedChain.doFilter(ServletHandler.java:1097)
    	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at com.asm.security.BiztrackConcurrentSessionFilter.doFilter(BiztrackConcurrentSessionFilter.java:59)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    	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.headerComplete(HttpConnection.java:829)
    	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
    	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)
    Last edited by snacht; 27 Apr 2010, 04:43.

    #2
    Make sure your includes are correct in your moduleName.get.XML file. The correct includes are discussed in the FAQ.

    Comment


      #3
      Using SmartGWT Pro 2.3
      GWT 2.0.4
      Google Chrome 6.0.472.63
      Mozilla Firefox 3.6.10

      Server specs:
      Ubuntu 8.04.4 LTS
      JBoss Web 2.1.1.CR3

      I'm getting the same error while trying to deploy an app to our test server. The app throws a ServletException from DataSourceLoader as soon as it is loaded (Chrome says DataSourceLoader line 1). I used chrome dev tools and looked in the resources tab and the DataSourceLoader has the following output.

      Code:
      <BR>BaseServlet Global Exception<BR>
      
      <PRE>
      
      javax.servlet.ServletException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
          at com.isomorphic.datasource.BasicDataSource.buildFieldData(BasicDataSource.java:315)
          at com.isomorphic.datasource.BasicDataSource.init(BasicDataSource.java:167)
          at com.isomorphic.sql.SQLDataSource.init(SQLDataSource.java:145)
          at com.isomorphic.datasource.BasicDataSource.fromConfig(BasicDataSource.java:134)
          at com.isomorphic.datasource.DataSource.fromConfig(DataSource.java:164)
          at com.isomorphic.datasource.FileSystemDSRepo.loadDS(FileSystemDSRepo.java:110)
          at com.isomorphic.datasource.DataSource.forName(DataSource.java:147)
          at com.isomorphic.datasource.DataSource.forName(DataSource.java:144)
          at com.isomorphic.datasource.DataSource.forName(DataSource.java:141)
          at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject(PoolableDataSourceFactory.java:89)
          at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject(PoolableDataSourceFactory.java:96)
          at com.isomorphic.pool.PoolManager.borrowObject(PoolManager.java:76)
          at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:56)
          at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:80)
          at com.isomorphic.servlet.DataSourceLoader.doGet(DataSourceLoader.java:64)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
          at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
          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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:183)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:451)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:325)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:619)
      
      
          at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:88)
      
          at com.isomorphic.servlet.DataSourceLoader.doGet(DataSourceLoader.java:64)
      
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      
          at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
      
          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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
      
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:183)
      
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      
          at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:451)
      
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:325)
      
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
      
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
      
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      
          at java.lang.Thread.run(Thread.java:619)
      
      </PRE>
      Firefox gives me the same error. I have gone through the FAQ and followed all instructions here http://forums.smartclient.com/showth...t=8159#aDSLoad and I still get the error. I don't have any sample code to post since I'm not actually trying to load a datasource. This error occurs as soon as the page is loaded... before I try to access any data.

      My inherits
      Code:
        <inherits name="com.smartgwt.tools.SmartGwtTools"/>
        <inherits name="com.smartgwtpro.SmartGwtPro"/>
        <inherits name="com.smartgwtpro.tools.Tools"/>
      Last edited by cliff.newton; 7 Oct 2010, 06:57.

      Comment


        #4
        See previous response - your <inherits> tags are wrong in your .gwt.xml file. You need to be importing com.smartgwtpro.* modules not com.smartgwt.* modules. Correct imports are in the FAQ (and QuickStart Guide, and installation instructions).

        Comment


          #5
          My inherits are just as the FAQ describes.

          Comment


            #6
            if it helps, here is my full gwt.xml file

            Code:
            <?xml version="1.0" encoding="UTF-8"?>
            <module rename-to='certwebportal'>
              <!-- Inherit the core Web Toolkit stuff.                        -->
              <inherits name='com.google.gwt.user.User'/>
            
              <!-- Inherit the default GWT style sheet.  You can change       -->
              <!-- the theme of your GWT application by uncommenting          -->
              <!-- any one of the following lines.                            -->
              <inherits name='com.google.gwt.user.theme.standard.Standard'/>
              <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
              <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->
            
              <!-- Other module inherits                                      -->
              <inherits name="com.smartgwt.tools.SmartGwtTools"/>
              <inherits name="com.smartgwtpro.SmartGwtPro"/>
              <inherits name="com.smartgwtpro.tools.Tools"/>
            
              <!-- Specify the app entry point class.                         -->
              <entry-point class='com.co.cert.client.certwebportal'/>
            
              <!-- Specify the paths for translatable code                    -->
              <source path='client'/>
              <source path='shared'/>
            
            </module>
            Last edited by cliff.newton; 7 Oct 2010, 07:07.

            Comment


              #7
              Then you have an Eclipse staleness issue - your import of smartgwtpro should be causing system/schema/*.ds.xml files to be deployed as part of your application, but they're missing.

              You can typically fix Eclipse by doing an explicit GWT compile, or, if all else fails, switching to a different JDK and switching back (yes really. This is a reliably way of getting Eclipse to clean up corrupt internal state).

              Unrelated, but get rid of the GWT Standard theme import.

              Comment


                #8
                I realise this is an old thread, but I've just had this exact problem, and discovered that I had an incorrect value for gwtModuleName in server.properties.

                So that might help someone else out in future.

                Perhaps there could be an error message somewhere if the specified gwt module does not exist?

                Comment

                Working...
                X