Announcement

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

    DataSource.get() returns null

    I am evaluating SmartClient 7.0RC2 (Developer Console shows "SmartClient Version: 7.1-Evaluation (built 2009-08-23)" and SmartGwtEE 1.2.1 in eclipse. I want to see DataSource binding at work using ListGrid, but the DataSource.get() statement returns null instead of the DataSource that appears to have loaded via xml, so I get a NullPointerException at the listGrid.setDataSource(dataSource) statement. I'm wondering whether I have a configuration problem that prevents me from finding the DataSource properly.

    I've attached configuration and source files.

    I think the DataSource xml files were loaded properly because I see "Parsed XML from C:\eclipse_workspace\ExploreGwt\war\ds\sample01.ds.xml: 15ms" in my eclipse console. But when I attempt to retrieve that DataSource, the developer console shows "DEBUG:DataSource:isc.DataSource 'sample01' not present".
    Attached Files

    #2
    Basics to check:
    1. Make sure the DataSource ID used in the .ds.xml file agrees with the filename (excluding the .ds.xml suffix) and the ID you pass to DataSource.getID(). It is *case sensitive*

    2. Are there any server-side logs of exceptions as the page loads

    3. What do you see in Firebug's "Net" console as the contents of what the DataSourceLoader servlet is returning (or just paste the URL directly into the URL bar).

    Comment


      #3
      Thank you. I wasn't using Firefox at all. Even without using Firebug, the developer console in Firefox 3.5.5 (FF) gave more detail than the GWT hosted browser (GHB) inside eclipse or Internet Explorer 7 (IE7).

      Problem 1:
      The developer console in GHB & IE7 simply showed "DEBUG:DataSource:isc.DataSource 'sample01' not present". FF showed an HTTP 404 error on the IDACall request.

      I resolved the problem by adding
      Code:
      <servlet-mapping>
          <servlet-name>IDACall</servlet-name>
          <url-pattern>/exploregwt/sc/IDACall/*</url-pattern>
      </servlet-mapping>
      to the existing mapping
      Code:
      <servlet-mapping>
          <servlet-name>IDACall</servlet-name>
          <url-pattern>/isomorphic/IDACall/*</url-pattern>
      </servlet-mapping>
      in web.xml.

      I hadn't known that I needed that because of how I interpreted
      Code:
      <!-- IMPORTANT : You must set the variable isomorphicDir to [MODULE_NAME]/sc/ so that the SmartGWT resource are correctly resolved -->   
      <script> var isomorphicDir = "exploregwt/sc/"; </script>
      in ExploreGwt.html.

      Once this problem was fixed, the logic to access the DB ran, revealing the next problem.

      Problem 2:
      "java.lang.NoClassDefFoundError: org/apache/commons/dbcp/PoolableConnection" was thrown when accessing the DB. The commons-dbcp-1.2.2.jar was missing from C:\SmartClient_70rc2_Evaluation\smartclientRuntime\WEB-INF\lib, but I found it in C:\SmartClient_70rc2_Evaluation\smartclientSDK\WEB-INF\lib. After adding the missing jar to war/WEB-INF/lib both FF and Google Chrome showed the page successfully!

      Problem 3:
      Unfortunately GHB & IE7 still fail to show the page, simply logging:
      Code:
      18:34:06.218:INFO:Log:isc.Page is loaded
      18:34:06.218:DEBUG:Page:handleEvent(load): firing action => isc.ApplyAutoTestMethods()
      18:34:13.687:DEBUG:Page:setEvent(idle): action => if(isc.Log.logViewer){var _3=isc.Log.logViewer._logWindow;if(_3&&!_3.closed)_3.focus()}
      18:34:13.734:DEBUG:DataSource:isc.DataSource 'sample01' not present
      18:34:14.171:TMR2:DEBUG:Page:handleEvent(idle): firing action => if(isc.Log.logViewer){var _3=isc.Log.logViewer._logWindow;if(_3&&!_3.closed)_3.focus()}
      So I am getting different behavior for different browsers.

      When I check my eclipse console after the GHB (GWT hosted browser) runs, I see a client/server mismatch warning and an exception:
      Code:
      === 2009-11-20 18:42:13,218 [l0-0] WARN  RPCManager - client/server version mismatch.  Client is version: 7.0RC3, server is version: 7.0rc2 - mixing different client/server versions is generally not supported.  If you've installed a more recent client version, try clearing the browser cache and reloading the page.
      === 2009-11-20 18:42:13,218 [l0-0] DEBUG XML - Parsed XML from (in memory stream): 0ms
      === 2009-11-20 18:42:13,218 [l0-0] DEBUG XML - Parsed XML from C:\eclipse_workspace\ExploreGwt\war\isomorphic\system\schema\List.ds.xml: 0ms
      === 2009-11-20 18:42:13,234 [l0-0] DEBUG RPCManager - Processing 1 requests.
      === 2009-11-20 18:42:13,234 [l0-0] DEBUG RPCManager - Request #1 (RPCRequest) data: {
          appID:"isc_builtin",
          className:"builtin",
          methodName:"getAvailableScriptEngines",
          arguments:[],
          is_ISC_RPC_DMI:true
      }
      === 2009-11-20 18:42:13,234 [l0-0] INFO  IDACall - Performing 1 operation(s)
      === 2009-11-20 18:42:13,250 [l0-0] DEBUG XML - Parsed XML from jar:file:/C:/eclipse_workspace/ExploreGwt/war/WEB-INF/lib/isomorphic_core_rpc.jar!/isc_builtin.app.xml: 0ms
      === 2009-11-20 18:42:13,265 [l0-0] DEBUG XML - Parsed XML from C:\eclipse_workspace\ExploreGwt\war\isomorphic\system\schema\ServerObject.ds.xml: 0ms
      === 2009-11-20 18:42:13,265 [l0-0] DEBUG XML - Parsed XML from C:\eclipse_workspace\ExploreGwt\war\isomorphic\system\schema\Method.ds.xml: 0ms
      === 2009-11-20 18:42:13,281 [l0-0] DEBUG RPCDMI - appConfig: isc.Application.create({
          rpcBindings:[
              {
                  visibleMethods:[
                      {name:"downloadWSDL"},
                      {name:"xmlToJS"},
                      {name:"uploadProgressCheck"},
                      {name:"saveFile"},
                      {name:"appendToFile"},
                      {name:"loadFile"},
                      {name:"deleteFile"},
                      {name:"loadSharedXML"},
                      {name:"saveSharedXML"},
                      {name:"getAvailableScriptEngines"},
                      {name:"evalServerScript"},
                      {name:"evalJava"},
                      {name:"getLogNames"},
                      {name:"getLogEntries"}
                  ],
                  ID:"builtin",
                  className:"com.isomorphic.rpc.BuiltinRPC"
              },
              {
                  visibleMethods:[
                      {name:"getDataSourceFromTable"},
                      {name:"getDataSourceJSONFromTable"},
                      {name:"getDataSourceFromHibernateMapping"},
                      {name:"getDataSourceJSONFromHibernateMapping"},
                      {name:"getTables"},
                      {name:"getFieldsFromTable"},
                      {name:"getBeanFields"},
                      {name:"getHibernateBeans"},
                      {name:"getDatabaseProductNameAndVersion"},
                      {name:"getDatabaseTableTypes"},
                      {name:"setAttributes"},
                      {name:"clearAttributes"},
                      {name:"getAttributes"},
                      {name:"getAttribute"}
                  ],
                  ID:"builtin_tools",
                  className:"com.isomorphic.tools.BuiltinRPC"
              }
          ]
      })
      
      === 2009-11-20 18:42:13,281 [l0-0] DEBUG Reflection - adaptArgsAndInvoke:
      
       public static java.util.Map com.isomorphic.rpc.BuiltinRPC.getAvailableScriptEngines() throws java.lang.Exception
      
      requiredArgs: [] optionalArgs: [com.isomorphic.servlet.RequestContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext, javax.servlet.http.HttpSession, com.isomorphic.rpc.RPCManager, com.isomorphic.rpc.RPCRequest]
      === 2009-11-20 18:42:13,281 [l0-0] DEBUG Reflection - method takes: 0 args.  I've assembled: 0 args
      === 2009-11-20 18:42:13,281 [l0-0] DEBUG Reflection - invoking method:
      java.util.Map com.isomorphic.rpc.BuiltinRPC.getAvailableScriptEngines() throws java.lang.Exception
      
      with arg types: (empty parameter list)
      === 2009-11-20 18:42:13,281 [l0-0] DEBUG RPCDMI - rpc returned data
      === 2009-11-20 18:42:13,281 [l0-0] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
      When I check my eclipse console after the FF browser runs, I see the identical warning and exception, but FF shows the page as expected anyway.

      As far as client/server versions go, I only saw SmartClient_70rc2_Evaluation, smartgwtee-1.2.1, and smartgwt-1.3 as available to download for evaluation.

      Thanks in advance for your help!

      Comment


        #4
        Just realized you're mixing SmartGWT EE and SmartClient builds. Don't do this; that's been the cause of all of your troubles so far. The SmartGWT EE package is self-contained and has starter projects within it that you can simply import into Eclipse to have a complete working starter application with databinding.

        Comment


          #5
          Thanks! Everything was working within minutes after creating a clean Eclipse project and using only the SmartGwtEE package.

          Comment


            #6
            Originally posted by Isomorphic
            Basics to check:
            1. Make sure the DataSource ID used in the .ds.xml file agrees with the filename (excluding the .ds.xml suffix) and the ID you pass to DataSource.getID(). It is *case sensitive*

            2. Are there any server-side logs of exceptions as the page loads

            3. What do you see in Firebug's "Net" console as the contents of what the DataSourceLoader servlet is returning (or just paste the URL directly into the URL bar).
            Isomorphic - I am currently evaluating SmartGWTEE and experiencing the same problem. DataSource.get("dsID") returns null.

            I have checked the basics above and all seem okay. Filenames, datasource ids are fine. No server-side logs showing exceptions. And http://127.0.0.1:8888/sc/DataSourceLoader?dataSource=dsID does return with valid info.

            I have taken a sample project (built-in-ds) but changed database configuration to point to my Oracle database.

            Comment


              #7
              So you checked that calling the DataSourceLoader servlet returns good results, but did you check that your <script src=> tag is actually hitting the DataSourceLoader? If there's a 404, it shows up in Firebug's NET tab.

              If that's not it, please post the response from the DataSourceLoader servlet that you see in Firebug's NET tab as the page is loading, your call to DataSource.get(), the DataSource file and your host .html file.

              Comment


                #8
                I have attached the requested files.

                Firebug's NET tab shows good results for the DataSourceLoader.
                Attached Files

                Comment


                  #9
                  Script include is too soon. Put it after your application loads.

                  Comment


                    #10
                    Isomorphic - worked great. Thanks for your help.

                    Comment


                      #11
                      Originally posted by jkrottner
                      I have attached the requested files.

                      Firebug's NET tab shows good results for the DataSourceLoader.
                      Do we have to write our own DataSourceLoader.txt or just use com.isomorphic.servlet.DataSourceLoader??? I am tring to do a very similar program.

                      Comment

                      Working...
                      X