Announcement

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

    com.google.gwt.core.client.JavaScriptException (null): null

    Hello,
    I am experiencing a problem with SmartGWT that I cannot figure out after hours of trying.

    I am running SmartGWT 2.2 and GWT 2.0.3.

    I've created a custom DataSource that uses ClientCustom protocol, and I've overriden the transformRequest() call.

    When I bind this datasource to a ListGrid and call grid.fetchData(), I am presented with the *com.google.gwt.core.client.JavaScriptException
    (null): null* exception in Firefox while running GWT development mode.

    Chrome and IE appear to work correctly. I wish I could let this go, but because GWT development mode and firefox is critical during our development efforts I thought I'd post a quick message here.

    Here is the stack trace:

    com.google.gwt.core.client.JavaScriptException: (null): null
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.widgets.grid.ListGrid.fetchData(ListGrid.java)
    at gov.state.wraps.web.orgs.client.OrgListViewImpl.fetchData(OrgListViewImpl.java:81)
    at gov.state.wraps.web.orgs.client.OrgListPresenter.go(OrgListPresenter.java:50)
    at gov.state.wraps.web.controller.gwt.BaseControllerImpl.performNavigation(BaseControllerImpl.java:109)
    at gov.state.wraps.web.controller.gwt.BaseControllerImpl.onAction(BaseControllerImpl.java:86)
    at gov.state.wraps.web.controller.gwt.ActionEvent.dispatch(ActionEvent.java:52)
    at gov.state.wraps.web.controller.gwt.ActionEvent.dispatch(ActionEvent.java:1)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$100(HandlerManager.java:41)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
    at gov.state.wraps.web.controller.gwt.BaseControllerImpl.performAction(BaseControllerImpl.java:52)
    at gov.state.wraps.web.core.client.CorePresenter$6.onClick(CorePresenter.java:71)
    at com.smartgwt.client.widgets.menu.events.MenuItemClickEvent.dispatch(MenuItemClickEvent.java:95)
    at com.smartgwt.client.widgets.menu.events.MenuItemClickEvent.dispatch(MenuItemClickEvent.java:57)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
    at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$100(HandlerManager.java:41)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
    at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:197)
    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.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1714)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
    at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1669)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
    at java.lang.Thread.run(Thread.java:619)

    And my data source:
    Code:
    public class OrganizationDataSource extends BaseDataSource<Organization> {
    
        private static DataSourceField id = new DataSourceField("id", FieldType.INTEGER);
        private static DataSourceField name = new DataSourceField("name", FieldType.TEXT);
        private static DataSourceField description = new DataSourceField("description", FieldType.TEXT);
        private static DataSourceField active = new DataSourceField("active", FieldType.BOOLEAN);
        
        public OrganizationDataSource() {
            super(Organization.class.getName());
            addField(id);
            addField(name);
            addField(description);
            addField(active);
        }
    
        private static ToRecord<Organization> converter = new ToRecord<Organization>() {
            @Override public ListGridRecord toRecord(Organization t) {
                ListGridRecord lgr = new ListGridRecord();
                lgr.setAttribute(id.getName(), t.getId());
                lgr.setAttribute(name.getName(), t.getName());
                lgr.setAttribute(description.getName(), t.getDescription());
                lgr.setAttribute(active.getName(), new Boolean(t.isActive()));
                return lgr;
            }
        };
        
        @Override protected ToRecord<Organization> getConverter() {
            return converter;
        }
    
    }
    and

    Code:
    public abstract class BaseDataSource<T> extends DataSource implements HasRequestDataHandler<T> {
    
        private HandlerManager handlerManager = new HandlerManager(this);
        
        protected String dataSourceId;
        
        public BaseDataSource(String dataSourceId) {
            setDataProtocol(DSProtocol.CLIENTCUSTOM);
            setDataFormat(DSDataFormat.CUSTOM);
            setTitle("Testing");
            
            if (dataSourceId.indexOf('.') >= 0) {
                this.dataSourceId = fixDataSource(dataSourceId); 
            } else {
                this.dataSourceId = dataSourceId;
            }
            //setID(this.dataSourceId);
        }
        
        private String fixDataSource(String dataSourceId) {
            return dataSourceId.substring(dataSourceId.lastIndexOf('.')+1);
        }
    
        public ListGridRecord[] getListGridRecords(List<T> objects) {
            return ListToRecord.listToRecord(objects, getConverter());
        }
        
        protected abstract ToRecord<T> getConverter();
        
        @Override
        protected Object transformRequest(DSRequest r) {
            
            RequestDataEvent<T> rde = new RequestDataEvent<T>();
            rde.setDataSourceId(dataSourceId);
            rde.setLength(r.getEndRow().intValue() - r.getStartRow().intValue());
            rde.setRequestId(r.getRequestId());
            rde.setStartRow(r.getStartRow().intValue());
            handlerManager.fireEvent(rde);
            
            return r;
        }
        
        public void appendData(RequestDataEvent<T> response) {
            
            DSResponse r = new DSResponse();
            r.setData(getListGridRecords(response.getData()));
            r.setStartRow(response.getStartRow());
            r.setEndRow(new Integer((response.getStartRow() + response.getLength())));
            r.setTotalRows(response.getTotalRecords());
            
            processResponse(response.getRequestId(),r);
        }
        
        @Override public HandlerRegistration addLiveDataHandler(RequestDataHandler handler) {
            return handlerManager.addHandler(RequestDataEvent.TYPE, handler);
        }
    }
    Thanks

    #2
    I do also receive this error. My configuration is nearly the same with a custom DataSource. The only difference is, that i'm using the gwt nightly build.

    Comment


      #3
      After MUCH trial and error debugging I've discovered that this is a result of a me passing in a Long object value for a DataSourceField with the type FieldType.INTEGER.

      Funny thing about this problem is that it wasn't a problem when compiled and deployed to an application server. Everything worked for all browsers. Oh well. Moving on.

      Does SmartGWT have any plans to support LONG and DOUBLE types for the DataSourceField field types?

      Thanks

      Comment


        #4
        It already does, use Pro or better and there is a great deal of intelligent auto-conversion. With clientCustom, there is no access to Java Reflection because core GWT does not support it, so the code is necessarily pickier about types.

        Comment

        Working...
        X