Announcement

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

    DataSource/ResultSet exceptions in Google App Engine (GAE)

    Under GWT Power 2.5 I've run into an odd problem.

    When the application is deployed to GAE the client is throwing exceptions each time I populate a ResultSet from a DataSource.

    The line that throws the exception is resultSet.getRange(0,1), however if I manually handle that exception it's DataArrivedHandler is still fired.

    Under the Eclipse debugger it works fine.

    Some code :

    Code:
     final ResultSet rs=new ResultSet();
    		 rs.setDataSource(DataSource.get("thedatasource"));
    		
    		 rs.addDataArrivedHandler(new DataArrivedHandler(){
    
    			@Override
    			public void onDataArrived(DataArrivedEvent event) {
    
    			}
    			 
    		 });
    		 rs.getRange(0, 1);
    and, the exceptions culled from the developer console :

    Code:
    java.lang.ArrayStoreException--Unknown.ArrayStoreException_0(Unknown Source)
    Unknown.setCheck(Unknown Source)
    Unknown.toArray(Unknown Source)
    Unknown.convertToRecordArray(Unknown Source)
    Unknown.$getRange(Unknown Source)
    Unknown.$loadData(Unknown Source)
    Unknown.$onEvent_21(Unknown Source)
    Is there a workaround or a bug fix for this?

    #2
    Way too little information - for starters, is that a client side or server-side exception? Is valid data actually making it the grid? (check RPC tab)

    Comment


      #3
      Client Side.

      And the DataArrivedHandler from the result set is being called and the data appears to be valid in it.

      Comment


        #4
        With only this to go on (no way to reproduce a problem), we can only speculate.

        Because you're saying the server response is the same and is valid, this looks like GWT core code is crashing, incorrectly, in developer mode. If so, then it must be the case that you've someone deployed different browser-side code to GAE than to your local Eclipse (Jetty) test environment. We don't know how you're deploying this to GAE, but you may somehow be using different versions of GWT in the two environments.

        However this seems unlikely, so really, we suspect the data is not actually the same, and is invalid in some subtle way in your GAE deployment.

        Comment


          #5
          Ok, I broke the problem down further and have steps to reproduce it.

          GAE is no longer involved.

          I created a test case using the BuiltInDS sample. I've included the code below, but I basically added a button that when clicked attempts to load an XML file into a datasource/resultset.

          The getRange call throws the following exception, although without the try/catch it doesn't appear in any logs, the only way I found that it was throwing something is that the lines of code following it were not executing.

          Code:
          13:02:47.854:INFO:Log:initialized
          13:02:48.487:INFO:Log:isc.Page is loaded
          13:03:10.296:MUP0:WARN:Log:pre get range
          13:03:10.342:MUP0:WARN:Log:java.lang.ArrayStoreException
          13:03:10.343:MUP0:WARN:Log:Unknown.ArrayStoreException_0(Unknown Source)<br/>Unknown.setCheck(Unknown Source)<br/>Unknown.toArray(Unknown Source)<br/>Unknown.convertToRecordArray(Unknown Source)<br/>Unknown.onClick_4(Unknown Source)<br/>Unknown.dispatch_0(Unknown Source)<br/>Unknown.$doFire(Unknown Source)<br/>
          13:03:10.343:MUP0:WARN:Log:post get range
          And, the code to create the button/fire the event :

          Code:
             IButton testGet=new IButton("Test getRange");
                  testGet.addClickHandler(new ClickHandler(){
          
          			@Override
          			public void onClick(ClickEvent event) {
          				
          					//SC.logWarn("loadXML");
          					
          					DataSource ds=new DataSource();
          					ds.setDataFormat(DSDataFormat.XML);
          					ds.setDataURL("[ISOMORPHIC]/skins/skin_data.xml");
          					//SC.logWarn(getSkinDirectory());
          					
          					ds.setRecordXPath("//skindata");
          					final ResultSet rs=new ResultSet(ds);
          					rs.addDataArrivedHandler(new DataArrivedHandler(){
          
          						@Override
          						public void onDataArrived(DataArrivedEvent event) {
          						//	SC.logWarn("onDataArrived");
          							// TODO Auto-generated method stub
          							//Record r=rs.get(0);
          							SC.say("Data Arrived");
          						}
          						
          					});
          					SC.logWarn("pre get range");
          					try{
          					rs.getRange(0,1);
          					}catch (Throwable thrown){
          						
          						SC.logWarn(thrown.toString());
          						SC.logWarn(printStackTrace(thrown.getStackTrace()));
          						
          					}
          					SC.logWarn("post get range");
          					
          				}
          			
                  	
                  });
                  hLayout.addMember(testGet);
          
          ...
          
            
          	private static String printStackTrace(Object[] stackTrace) {
          		  String output = "";
          		  for (Object line : stackTrace) {
          		    output += line + "<br/>";
          		  }
          		  return output;
          		}
          One note is that you'll have to supply a datasource compatible XML in the location specified or it'll fail with a 404.

          Please let me know if you need anything else to replicate this bug.

          Comment


            #6
            You previously reported it worked in one place but not another - so in reality it was a data difference all along?

            If so then turn on the "xmlBinding" and "xmlSelect" log categories to troubleshoot parsing of your XML file. *After* you've done this (that is, done the expected troubleshooting on your own, since nothing suggests a bug here), if you need further help, post the data file.

            Comment


              #7
              Originally posted by Isomorphic
              You previously reported it worked in one place but not another - so in reality it was a data difference all along?

              If so then turn on the "xmlBinding" and "xmlSelect" log categories to troubleshoot parsing of your XML file. *After* you've done this (that is, done the expected troubleshooting on your own, since nothing suggests a bug here), if you need further help, post the data file.
              Ok, I used the XML as a simple to reproduce sample, the same problem occurs if I use normal datasources.

              rs.getRange() throws an exception. However, while it throws an exception it's associated addDataArrivedHandler still gets fired with valid returned data.

              So in the supplied sample it will execute the SC.say("Data Arrived") statement in the DataArrivedHandler, but it also catches and logs the exception that rs.getRange is throwing.

              Comment


                #8
                You realize you're calling getRange() before DataArrived fires, when no data is available?

                Comment


                  #9
                  I read the getRange description to mean that it would make an async call to load the records if they haven't been loaded yet. And since it worked (apart from the exception) thought it was legitimate.

                  What would be the correct method to load the resultset?

                  Comment


                    #10
                    If you're trying to manually trigger data fetch, getRange(0,1) is a legitimate way to do it, and works (as you've noted). What you seem to be seeing here is a bug in core GWT (not SmartGWT) where a spurious error is reported in development mode only. get(0) would also trigger a fetch and may not trigger this GWT bug.

                    Comment


                      #11
                      Also, it doesn't look like you mentioned your GWT version - upgrading GWT might fix this.

                      Comment


                        #12
                        Originally posted by Isomorphic
                        Also, it doesn't look like you mentioned your GWT version - upgrading GWT might fix this.
                        GWT version is 2.4.0

                        And actually the problem is only in production code (ie compiled and uploaded to a webserver). Running in development mode has no problems.

                        Also, it appears that rs.get(0) does not throw the exception.

                        Comment


                          #13
                          And actually the problem is only in production code (ie compiled and uploaded to a webserver). Running in development mode has no problems.
                          This doesn't make sense, it's a Java stack trace and Java is not involved on the client side in production code.

                          Comment


                            #14
                            Originally posted by Isomorphic
                            This doesn't make sense, it's a Java stack trace and Java is not involved on the client side in production code.
                            I recognize that I'm still new to developing with GWT/SmartGWT but I know that it has always worked fine locally, but shows the problems previously discussed when uploaded to either GAE or a normal web server.

                            I don't have the expertise to decipher what the problem is or where precisely it's occurring - just identifying was a pain.

                            Editted : Would the java stack trace be due to the GWT compiler being set to 'Pretty' mode?

                            If you have anything else you'd like me to do to make a better test case/provide more information I'd be happy to do it.
                            Last edited by hipgnosis74; 10 Nov 2011, 15:26.

                            Comment


                              #15
                              If by "uploaded" you mean you've configured Eclipse to "deploy" to a remote server (such as GAE), this doesn't mean you're in compiled mode. GWT development mode supports deployment to remote servers.

                              You can tell you're in compiled mode when there's no gwt.codesvr parameter in the URL you use to access the application.

                              Comment

                              Working...
                              X