Announcement

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

    ClassCastException during DataSource loading

    I'm getting the following:

    === 2009-06-03 20:20:38,364 [l6-1] ERROR LoadDSTag - Exception while attempting to process a loadDS tag.
    java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
    at com.isomorphic.datasource.BasicDataSource.buildFieldData(BasicDataSource.java:250)
    at com.isomorphic.datasource.BasicDataSource.init(BasicDataSource.java:134)
    at com.isomorphic.datasource.BasicDataSource.fromConfig(BasicDataSource.java:114)
    at com.isomorphic.datasource.DataSource.fromConfig(DataSource.java:204)
    at com.isomorphic.datasource.DataSource.forName(DataSource.java:178)
    at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject(PoolableDataSourceFactory.java:84)
    at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject(PoolableDataSourceFactory.java:91)
    at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:792)
    at com.isomorphic.pool.PoolManager.borrowObject(PoolManager.java:70)
    at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:56)
    at com.isomorphic.taglib.LoadDSTag.doStartTag(LoadDSTag.java:58)
    at org.apache.jsp.RCR_jsp._jspx_meth_isomorphic_loadDS_0(RCR_jsp.java:121)
    at org.apache.jsp.RCR_jsp._jspService(RCR_jsp.java:67)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    at com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
    at com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:59)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
    at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:235)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    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:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:306)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at org.mortbay.jetty.Server.handle(Server.java:313)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)



    My DataSource looks like this:
    <DataSource ID="UserDS" serverType="generic">
    <fields>
    <field name="userName" type="text" title="userName" primaryKey="true"/>
    <field name="firstName" type="text" title="firstName" />
    <field name="lastName" type="text" title="lastName" />
    <field name="phone" type="text" title="phone" />
    <field name="password" type="text" title="password" />
    <field name="company" type="text" title="company" />
    <field name="email" type="text" title="email" />
    <field name="active" type="text" title="active" />
    </fields>

    <serverObject lookupStyle="spring" bean="userDao"/>

    </DataSource>


    Any idea why this is happening? Is there a patch for BasicDataSource?

    #2
    You could get this if you had deleted the public/sc/system/schema area in smartgwtee.jar.

    Comment


      #3
      where is smartgwtee.jar? I can't find it anywhere?

      Comment


        #4
        Are you using SmartGWT or SmartClient?

        Comment


          #5
          I was able to resolve ClassCastException and JSP tag loaded datasource.
          But when I try to get a handle to datasource, it returns null. Any idea?

          DataSource dataSource = DataSource.get("UserDS");

          Comment


            #6
            Then the DataSource is still not loading. Look for other errors, and try matching the samples as closely as possible.

            You still haven't clarified if you're using SmartClient or SmartGWT EE.

            Comment


              #7
              I'm using SmartGWT EE
              I'm looking at the examples and seems that I'm doing exactly same thing.
              When jsp page that contains JSP tag is loaded, the following is printed on the page:

              isc.DataSource.create({ ID:"UserDS", serverType:"generic", fields:[ {type:"text", title:"userName", primaryKey:true, name:"userName"}, {type:"text", title:"firstName", name:"firstName"}, {type:"text", title:"lastName", name:"lastName"}, {type:"text", title:"phone", name:"phone"}, {type:"text", title:"password", name:"password"}, {type:"text", title:"company", name:"company"}, {type:"text", title:"email", name:"email"}, {type:"text", title:"active", name:"active"} ] })

              so, I assume that DataSource is being loaded.
              Last edited by sergeyb; 4 Jun 2009, 09:53.

              Comment


                #8
                The samples do not use a loadDS tag.

                Look for this part of index.html:

                Code:
                <script src="sc/DataSourceLoader?dataSource= supplyItemHB"></script>
                That's how DataSources are loaded. Be sure you are using the latest version (1.1).

                Comment


                  #9
                  WARNING: No file found for: /sc/DataSourceLoader

                  where this url sc/DataSourceLoader maps to a servlet?
                  I don't see it in examples web.xml

                  Comment


                    #10
                    Again, get the latest version (1.1).

                    Comment


                      #11
                      Same issue

                      Hi, I have exactly the same problem.
                      I am using smartGWT EE 1.2 .

                      I think my problem is related to the following part in the web.xml of the sample (Basic Connector):

                      Code:
                          <!-- The DataSourceLoader servlet returns Javascript representations of the dataSources whose  
                               ID's are passed to it - it is an alternative to using the <loadDS> JSP tag -->  
                          <servlet>  
                              <servlet-name>DataSourceLoader</servlet-name>  
                              <servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>  
                          </servlet>
                      In my code, the line DataSource.get("worldDS") returns null, and I have the following warning [WARN] 404 - GET /MY_MODULE/sc/DataSourceLoader?dataSource=worldDS (127.0.0.1) 1432 bytes.

                      I looked in the javadoc of the server and I could not find the class com.isomorphic.servlet.DataSourceLoader. (But the others Servlet are present in com.isomorphic.servlet in the javadoc). Is the javadoc incomplete ?

                      Given the warning this class is surely missing from my project...is this class supposed to be in the smartgwtee.jar ? Is it missing from my JAR ?

                      Comment


                        #12
                        Find the solution

                        Hello,

                        I found the solution in this documentation:

                        http://www.smartclient.com/docs/6.5.1/a/b/c/go.html#group..iscInstall

                        That was in fact exactly what I was looking for, how to deploy Smart Client in your Java environment.

                        Comment


                          #13
                          michael0101,
                          Can you brief what you did to resolve the problem? I am having the same problem, The URL you mentioned is not working.

                          thanks

                          Comment


                            #14
                            I got the solution,
                            I copied all libraries for time being from smartgwtee1.2/showcase/web-inf/lib to my project/web-inf/lib and that's all. It worked.

                            Comment


                              #15
                              Originally posted by sergeyb
                              I was able to resolve ClassCastException and JSP tag loaded datasource.
                              But when I try to get a handle to datasource, it returns null. Any idea?

                              DataSource dataSource = DataSource.get("UserDS");
                              Do you recall how exactly you solved this initial problem with the ClassCastException being thrown? I'm running into the same thing
                              and I'm stumped.

                              Comment

                              Working...
                              X