Announcement

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

    Blank page when calling a class with anything in its constructor

    I am stumped.

    After a long evening of testing, I have determined that having ANY line of code in the constructor of my class causes the application to display only a blank page. If I comment all of the code in the constructor everything works as you'd expect. If I uncomment even a single line, it doesn't matter which, I get a blank page.

    In no case do Firebug or the logger report any kind of error. The application appears to load correctly but only a blank page is displayed.

    I've tried deleting the entire folder with the compiled code (WebContent/outmineclient in this case) and recompiling.
    I've cleared browser cache in both browsers.
    I've restarted the computer.
    I tried moving the external class into the main class as a subclass.
    I've copied over all of the Isomorphic .jar files with ones from the download file in case they were somehow corrupted.
    I'm out of ideas.

    Am I missing something obvious? What can I do to troubleshoot this?

    SmartGWT Pro 3.1p
    Both Chrome and Firefox (with Firebug), whatever the latest versions are
    Tomcat 7.0

    Main Class
    Code:
    package net.outmine.client.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.types.Alignment;
    import com.smartgwt.client.types.ImageStyle;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.Img;
    import com.smartgwt.client.widgets.Label;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    import com.smartgwt.client.widgets.tab.Tab;
    import com.smartgwt.client.widgets.tab.TabSet;
    import com.smartgwt.client.widgets.tree.TreeGrid;
    
    import net.outmine.client.client.MapViewer;
    
    public class OutmineClient implements EntryPoint {
    
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
        	VLayout mainLayout = new VLayout();
            mainLayout.setWidth100();
            mainLayout.setHeight100();
            
        	TabSet mainTabSet = new TabSet();
        	mainTabSet.setBackgroundColor("black");
            
        	mainTabSet.addTab(myEmpireTab());
        	mainTabSet.addTab(newsFeedTab());
        	mainTabSet.addTab(marketplaceTab());
        	mainTabSet.addTab(vehiclesTab());
        	mainTabSet.addTab(mapTab());
            
            mainLayout.addMember(header());
            mainLayout.addMember(mainTabSet);
            mainLayout.draw();
        }
        
        Tab mapTab() {
        	Tab t = new Tab("Map");
        	MapViewer c = new MapViewer();
        	//Canvas c = new Canvas();
        	t.setPane(c);
        	return t;
        }
        
        Tab myEmpireTab() {
        	Tab t = new Tab("My Empire");
        	Label l = new Label("Certum quod factum. -Giambattista Vico");
        	t.setPane(l);
        	return t;
        }
        
        Tab newsFeedTab() {
        	Tab t = new Tab("News");
        	Label l = new Label("I have a theory that the truth is never told during the nine-to-five hours.  -Hunter S. Thompson");
        	t.setPane(l);
        	return t;
        }
        
        Tab marketplaceTab() {
        	Tab t = new Tab("Marketplace");
        	Label l = new Label("I'm Kai Ryssdal.  -Kai Ryssdal");
        	t.setPane(l);
        	return t;
        }
        
        Tab vehiclesTab() {
        	Tab t = new Tab("Vehicles");
        	HLayout hl = new HLayout();
        	hl.setBackgroundColor("black");
        	
        	TreeGrid vtg = new TreeGrid();
        	vtg.setWidth(200);
        	vtg.setHeight100();
        	vtg.setTreeFieldTitle("My Vehicles");
        	
        	TabSet gridCodeTS = new TabSet();
        	gridCodeTS.setHeight100();
        	gridCodeTS.setBackgroundColor("black");
        	gridCodeTS.addTab(new Tab("Layout"));
        	gridCodeTS.addTab(new Tab("Program"));
        	
        	hl.addMember(vtg);
        	hl.addMember(gridCodeTS);
        	
        	t.setPane(hl);
        	return t;
        }
        
        
        
    
    ////////////////////////////////// PAGE HEADER ///////////////////////////////////////////
        Canvas header() {
        	Canvas h = new Canvas();
        	HLayout layout = new HLayout();
        	layout.setWidth100();
        	layout.setHeight100();
        	h.setWidth100();
        	h.setHeight(166);
    
        	h.setBackgroundColor("black");
        	
        	String image = "/outmineclient/images/outmine1.jpg";
        	Img img = new Img(image, 730, 166);
        	img.setImageType(ImageStyle.CENTER);
        	
        	layout.setAlign(Alignment.CENTER);
        	
        	layout.addMember(img);
        	h.addChild(layout);
        	return h;
        }
        
    
    }
    The class (MapViewer) is called like this:
    Code:
    Tab mapTab() {
        	Tab t = new Tab("Map");
        	MapViewer c = new MapViewer();
        	t.setPane(c);
        	return t;
        }
    If I comment out the line that calls MapViewer (and replace it with a plain canvas) it runs as expected.

    Here is the class itself
    Code:
    package net.outmine.client.client;
    
    import com.smartgwt.client.data.Criteria;
    import com.smartgwt.client.data.DSCallback;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.data.DSResponse;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.types.DragAppearance;
    import com.smartgwt.client.types.Overflow;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.Label;
    import com.smartgwt.client.widgets.events.DragMoveEvent;
    import com.smartgwt.client.widgets.events.DragMoveHandler;
    import com.smartgwt.client.widgets.events.DragStartEvent;
    import com.smartgwt.client.widgets.events.DragStartHandler;
    import com.smartgwt.client.widgets.layout.HLayout;
    
    public class MapViewer extends Canvas {
    
    	public HLayout hlayout;
    	public Canvas outerCanvas;
    	public Canvas innerCanvas;
    	public Canvas leftSide;
    	public Label info;
    	private Integer startScrollLeft;
    	private Integer startScrollTop;
    	private Integer startX;
    	private Integer startY;
    	
    	public MapViewer() {
    		
    		info.setContents("<font color='white'>INFO HERE</font>");
    		
    		leftSide.setHeight100();
    		leftSide.setWidth(220);
    		leftSide.addChild(info);
    		
    		outerCanvas.setShowEdges(true);
    		outerCanvas.setEdgeSize(3);
    		outerCanvas.setOverflow(Overflow.SCROLL);
    		outerCanvas.setCanDrag(true);
    		outerCanvas.setDragAppearance(DragAppearance.NONE);
    		outerCanvas.setHeight100();
    		
    		outerCanvas.addDragStartHandler(new DragStartHandler() {
    			public void onDragStart(DragStartEvent event) {
    				startScrollLeft = outerCanvas.getScrollLeft();
    				startScrollTop = outerCanvas.getScrollTop();
    				startX = event.getX();
    				startY = event.getY();
    			}
    		});
    		
    		outerCanvas.addDragMoveHandler(new DragMoveHandler() {
    			public void onDragMove(DragMoveEvent event) {
    				outerCanvas.scrollTo(
    					startScrollLeft - event.getX() + startX,
    					startScrollTop - event.getY() + startY
    					);
    			}
    		});
    		
    		innerCanvas.setWidth(2700);
    		innerCanvas.setHeight(2700);
    		innerCanvas.setBackgroundColor("black");
    		
    		outerCanvas.addChild(innerCanvas);
    		
    		hlayout.addMember(leftSide);
    		hlayout.addMember(outerCanvas);
    		addChild(hlayout);
    	}
    	
    	
    	
    	public void getData() {
    		Criteria c = new Criteria();
        	final DataSource ds = DataSource.get("allGeology");
        	DSCallback callback = new DSCallback() {
    
        		@Override
        		public void execute(DSResponse response, Object rawData,
        				DSRequest request) {
        			for (Record r : response.getData()) {
        				drawTile(r);
        			}
        		}
        	};
        	ds.fetchData(c, callback);
    	}
    	
    	
    	public void drawTile(Record r) {
    		mapTile m = new mapTile(r);
    		m.setTop(50 + 50 * r.getAttributeAsInt("y_coord"));
    		m.setLeft(50 + 50 * r.getAttributeAsInt("x_coord"));
    		innerCanvas.addChild(m);
    	}
    	
    	
    	public class mapTile extends Canvas {
    		
    		public Canvas tile = new Canvas();
    		private Record record;
    		
    		public mapTile(Record r) {
    			setRecord(r);
    			setBackgroundColor(record.getAttributeAsString("color"));
    			setWidth(48);
    			setHeight(48);		
    		}
    
    		public Record getRecord() {
    			return record;
    		}
    
    		public void setRecord(Record record) {
    			this.record = record;
    		}
    		
    	} 
    }
    None of the methods are currently called by the constructor. It runs if they are left uncommented just as long as everything in the constructor is commented.

    It always compiles fine with no errors. Firebug shows no 404 errors or anything like that, only solid 200 codes.

    Tomcat doesn't seem to be complaining about anything. Here is the console from a startup
    Code:
    Jan 23, 2013 10:12:09 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Python33\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files\Common Files\Lenovo;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Lenovo\Access Connections\;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files (x86)\Symantec\VIP Access Client\;C:\Program Files (x86)\Common Files\Lenovo;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Google\Google Apps Sync\;C:\Program Files (x86)\Google\Google Apps Migration\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Couchapp;.
    Jan 23, 2013 10:12:09 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:outmineclient' did not find a matching property.
    Jan 23, 2013 10:12:09 PM org.apache.coyote.AbstractProtocolHandler init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    Jan 23, 2013 10:12:09 PM org.apache.coyote.AbstractProtocolHandler init
    INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
    Jan 23, 2013 10:12:09 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 980 ms
    Jan 23, 2013 10:12:10 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Jan 23, 2013 10:12:10 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
    ISC: Configuring log4j from: file:/C:/Users/jleasure/Dropbox/Eclipse%20Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/outmineclient/WEB-INF/classes/log4j.isc.config.xml
    === 2013-01-23 22:12:11,372 [ad-2] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework initialization called from com.isomorphic.base.InitListener
    === 2013-01-23 22:12:11,373 [ad-2] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework - Initializing
    === 2013-01-23 22:12:11,382 [ad-2] INFO  ConfigLoader - Attempting to load framework.properties from CLASSPATH
    === 2013-01-23 22:12:11,507 [ad-2] INFO  ConfigLoader - Successfully loaded framework.properties from CLASSPATH at location: jar:file:/C:/Users/jleasure/Dropbox/Eclipse%20Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/outmineclient/WEB-INF/lib/isomorphic_core_rpc.jar!/framework.properties
    === 2013-01-23 22:12:11,507 [ad-2] INFO  ConfigLoader - Attempting to load project.properties from CLASSPATH
    === 2013-01-23 22:12:11,508 [ad-2] INFO  ConfigLoader - Unable to locate project.properties in CLASSPATH
    === 2013-01-23 22:12:11,515 [ad-2] INFO  ConfigLoader - Successfully loaded isc_interfaces.properties from CLASSPATH at location: jar:file:/C:/Users/jleasure/Dropbox/Eclipse%20Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/outmineclient/WEB-INF/lib/isomorphic_core_rpc.jar!/isc_interfaces.properties
    === 2013-01-23 22:12:11,515 [ad-2] INFO  ConfigLoader - Attempting to load server.properties from CLASSPATH
    === 2013-01-23 22:12:11,521 [ad-2] INFO  ConfigLoader - Successfully loaded server.properties from CLASSPATH at location: file:/C:/Users/jleasure/Dropbox/Eclipse%20Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/outmineclient/WEB-INF/classes/server.properties
    === 2013-01-23 22:12:11,532 [ad-2] INFO  Logger - Logging system started.
    === 2013-01-23 22:12:11,532 [ad-2] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework (v8.3p_2013-01-16/Pro Deployment 2013-01-16) - Initialization Complete
    === 2013-01-23 22:12:11,536 [ad-2] INFO  ISCInit - Auto-detected webRoot - using: C:\Users\jleasure\Dropbox\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\outmineclient
    === 2013-01-23 22:12:11,538 [ad-2] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework initialization called from com.isomorphic.base.Init
    === 2013-01-23 22:12:11,538 [ad-2] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework is already initialized
    Jan 23, 2013 10:12:11 PM org.apache.coyote.AbstractProtocolHandler start
    INFO: Starting ProtocolHandler ["http-bio-8080"]
    Jan 23, 2013 10:12:11 PM org.apache.coyote.AbstractProtocolHandler start
    INFO: Starting ProtocolHandler ["ajp-bio-8009"]
    Jan 23, 2013 10:12:11 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 1581 ms
    And here's what the console tells me when the page loads
    Code:
    === 2013-01-23 22:38:15,959 [ec-5] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework initialization called from com.isomorphic.base.Base
    === 2013-01-23 22:38:15,960 [ec-5] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework is already initialized
    === 2013-01-23 22:38:16,035 [ec-5] INFO  PoolManager - SmartClient pooling disabled for 'allGeology' objects
    === 2013-01-23 22:38:16,076 [ec-7] INFO  RequestContext - URL: '/outmineclient/outmineclient/sc/skins/Graphite/load_skin.js', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1': Moz (Gecko) with Accept-Encoding header
    === 2013-01-23 22:38:16,088 [ec-7] INFO  Download - done streaming: C:/Users/jleasure/Dropbox/Eclipse Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/outmineclient/outmineclient/sc/skins/Graphite/load_skin.js
    === 2013-01-23 22:38:16,108 [ec-5] DEBUG XML - Parsed XML from C:\Users\jleasure\Dropbox\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\outmineclient\outmineclient\sc\system\schema\builtinTypes.xml: 6ms
    === 2013-01-23 22:38:16,184 [ec-5] DEBUG XML - Parsed XML from C:\Users\jleasure\Dropbox\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\outmineclient\ds\allGeology.ds.xml: 2ms
    === 2013-01-23 22:38:16,191 [ec-5] DEBUG XML - Parsed XML from C:\Users\jleasure\Dropbox\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\outmineclient\outmineclient\sc\system\schema\DataSource.ds.xml: 6ms
    === 2013-01-23 22:38:16,289 [ec-5] DEBUG XML - Parsed XML from C:\Users\jleasure\Dropbox\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\outmineclient\outmineclient\sc\system\schema\DataSourceField.ds.xml: 14ms
    === 2013-01-23 22:38:16,333 [ec-5] DEBUG XML - Parsed XML from C:\Users\jleasure\Dropbox\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\outmineclient\outmineclient\sc\system\schema\OperationBinding.ds.xml: 4ms
    === 2013-01-23 22:38:16,557 [ec-1] INFO  RequestContext - URL: '/outmineclient/outmineclient/sc/skins/Graphite/skin_styles.css', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1': Moz (Gecko) with Accept-Encoding header
    === 2013-01-23 22:38:16,559 [ec-1] INFO  Download - done streaming: C:/Users/jleasure/Dropbox/Eclipse Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/outmineclient/outmineclient/sc/skins/Graphite/skin_styles.css
    Last edited by RevMen; 23 Jan 2013, 20:42.

    #2
    I am able to get the application to draw if I instantiate everything that's not an integer in the declarations.

    However, if I try to run any code after the initial draw, such as a fetch operation with an empty callback, I get a blank page. I can register event handlers, and they will work, I just can't create any additional widgets after the application is on the screen.

    I realize no one is going to know a solution to this right away but any advice on how I might trouble shoot this would be very appreciated.
    Last edited by RevMen; 24 Jan 2013, 08:16.

    Comment


      #3
      I've got back to a version of code that I know was working previously (there is a copy of it running successfully on my webserver right now) and it is having the same issues. I haven't changed anything in this project other than the java code so there must be some kind of file corruption. Ignore this thread for now and I will start copying in fresh copies of everything, I guess.

      Comment

      Working...
      X