GWT app using UIBinder won't load properly - java

My GWT app, using UiBinder, won't load in Internet Explorer. However, it loads just fine in Firefox, Safari, and on the iPhone.
In trying to isolate the problem, I've been stripping out parts trying to find the root cause. I'm down to basically a Label and it still works in FF but not IE.
Here's the EntryPoint:
public class Core implements EntryPoint {
private static Core instance;
public static Core instance() {
return instance;
}
#Override
public void onModuleLoad() {
instance = this;
RootPanel container = RootPanel.get("container");
container.add(new Label("hi"));
}
}
Here's my index.jsp:
<!doctype html>
<html>
<head>
<script type="text/javascript" src="core/core.nocache.js"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
Here's my appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>realAppNameHere</application>
<version>andrew</version>
<static-files>
<include path="**" />
<!-- The following line requires App Engine 1.3.2 SDK -->
<include path="**.nocache.*" expiration="0s" />
<include path="**.cache.*" expiration="365d" />
<exclude path="**.gwt.rpc" />
</static-files>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
And here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Even with this stripped-down version of everything, it still works in Firefox but not IE. Now there aren't even any bugs thrown, not even in Firebug... it just doesn't show the label in IE, but it will show the label in FF. I have no idea why this isn't running.
Anyone have any idea?
Edit 3:
Forgot the module.gwt.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='core'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.ajaxloader.AjaxLoader'/>
<inherits name="com.google.gwt.logging.Logging"/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<entry-point class='com.company.core.client.Core'/>
<source path='client'/>
<source path='shared'/>
<set-property name="gwt.logging.logLevel" value="SEVERE"/>
<set-property name="gwt.logging.enabled" value="FALSE"/>
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
<set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />
</module>

Some of the things won't come up in IE6 but it will definitely get loaded. The first thing you need to see is whether you have added an User agent for IE6 as
<set-property name="user.agent" value="ie6"/>
in your .gwt.xml file.
Next thing you need to check that whether you added an exception for localhost in your browser security settings.
If all this is done and still not working try to cleanup your project and recompile it.

From testing on an actual copy of IE (not the IE plugin for Firefox) we were able to see an error "console is not defined".
Turns out, this was throwing an exception in IE, preventing the page from loading:
public native static void log(String inString)
/*-{
console.log(inString);
}-*/;
So to solve this, we'll take out that reference to console and replace with a cross-browser logging library, such as GWT-Log

Related

*.nocache.js is not reloading the latest code changes (using Restlet and GWT)

I have created a sample GWT+AppEngine project with Eclipse and added one contact.gwt.xml file as a client. It's corresponding *.contact.nocache.js created from contact.html is not being updated with code changes. I am running it on localhost on internal Jetty server.
Here are my files.
contact.html
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>contact</title>
<script type="text/javascript" laguage="javascript"
src="contact/org.restlet.example.firstapplication.contact.nocache.js?dummyTimeParam=<%=System.currentTimeMillis() %>"></script>
</head>
<body>
<h1>About a contact</h1>
<table>
<tr>
<th>Contact 102</th>
<th>Home address</th>
</tr>
<tr>
<td id="contactContainer" style="vertical-align: top"></td>
<td id="homeAddressContainer"></td>
</tr>
<tr>
<td id="buttonContainer" colspan="2"></td>
</tr>
</table>
</body>
</html>
contact.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.google.gwt.user.User" />
<inherits name="org.restlet.Restlet" />
<source path="client" />
<source path="shared" />
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<entry-point class='org.restlet.example.firstapplication.client.ContactModule' />
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe"/>
</module>
Relevant part of appengine.web.xml
<static-files>
<include path="**" />
<!-- The following line requires App Engine 1.3.2 SDK -->
<include path="**.nocache.*" expiration="0s" />
<include path="**.cache.*" expiration="365d" />
<exclude path="**.gwt.rpc" />
</static-files>
Restlet Application module
public class TestServerApplication extends Application {
#Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
Directory dir = new Directory(getContext(), "war:///");
router.attachDefault(dir);
router.attach("/contacts/123", ContactServerResource.class);
return router;
}
}
Whatever changes I make in contact.html file, it's updated but its corresponding Java file's onModule() is never called. It always gets 304 response code for .nocache.js file which gets the same .cache.html file from "/war/contact/" location.
I think, I need to add Filter as told here (how to clear cache in gwt?) but I am not sure what's going on and how to add this filter without using Java servlets here. Any help would be appreciated.
I don't know if I can delete this question now. But it was one stupid error from my end. I had copied the code from another project and changed the package name to "org.example.contact". /war/<oldPackageName>/*.nocache.js created for previous package was still there and was being linked in the HTML file. When I recompiled the code with new package, it created a new /war/<newPackageName>/*.nocache.js file but HTML was still referring to the old one. Once I figured out the compilation process, it got fixed.

GWT (Eclipse): 2 modules (2 entry points) + 2 HTML pages => LoginService possible for both HTML pages?

I am a newbie to GWT and at the moment I have the problem that I created two modules (see appendix 1/2) with two entry point classes in my project. So I made two run configurations (see appendix 5/6) in Eclipse to either address the HTML page for module one (It_projekt.html) or the HTML page for module two (Reportgenerator.html). For authentication purposes, I added a LoginService class.
But now, when I start the HTML page for my second module (reportgenerator.gwt.xml) in the browser, there will be no login screen. On the other hand, when I start the HTML page for module one (It_projekt.gwt.xml) in the browser, there will appear a login screen.
So my question is: how can I make it possible (if it's possible) to have one LoginService and two HTML pages, where I as a user have to login at It_projekt.html and also Reportgenerator.html (condition: it has to be two modules with two entry point classes)? Is it maybe only possible with two different LoginService classes?
For test purposes, I added a variant of the LoginService class (as you can see in the web.xml). But the second LoginService idea didn't work either. And there is definitely some code in "onModuleLoad()" in the entry point class of the second module (reportgenerator.gwt.xml).
Maybe it might depend on a small detail, but I am unable to see it at the moment. I appended all necessary resources that I could think of. Please help me!
Appendixes:
1) It_projekt.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='it_projekt'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.logging.Logging'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='de.hdm.team7.client.It_projekt'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe"/>
</module>
2) reportgenerator.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='reportgenerator'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.gwt.logging.Logging' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<entry-point class="de.hdm.team7.client.Reportgenerator"></entry-point>
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe" />
</module>
3) web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<!-- Servlets -->
<servlet>
<servlet-name>Stuecklistenverwaltung</servlet-name>
<servlet-class>de.hdm.team7.server.StuecklistenVerwaltungImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Stuecklistenverwaltung</servlet-name>
<url-pattern>/it_projekt/stuecklistenverwaltung</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Reportgenerator</servlet-name>
<servlet-class>de.hdm.team7.server.ReportGeneratorImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Reportgenerator</servlet-name>
<url-pattern>/it_projekt/reportgenerator</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>LoginService</servlet-name>
<servlet-class>de.hdm.team7.server.LoginServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginService</servlet-name>
<url-pattern>/it_projekt/login</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>LoginServiceReports</servlet-name>
<servlet-class>de.hdm.team7.server.LoginServiceReportsImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServiceReports</servlet-name>
<url-pattern>/reportgenerator/loginreports</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>It_projekt.html</welcome-file>
</welcome-file-list>
</web-app>
4) LoginService.java:
package de.hdm.team7.client;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
#RemoteServiceRelativePath("login")
public interface LoginService extends RemoteService {
// String login(User user);
public LoginInfo login(String requestUri);
}// end interface
5) Run configuration:
It_projekt.html
-superDevMode -server com.google.appengine.tools.development.gwt.AppEngineLauncher -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -startupUrl It_projekt.html -logLevel INFO -codeServerPort auto -port auto -war C:\Users\dev\git\it-projekt\it-projekt\war de.hdm.team7.It_projekt de.hdm.team7.reportgenerator
6) Run configuration:
Reportgenerator.html
-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -startupUrl Reportgenerator.html -logLevel INFO -codeServerPort 9997 -port 8888 -server com.google.appengine.tools.development.gwt.AppEngineLauncher -superDevMode -war C:\Users\dev\git\it-projekt\it-projekt\war de.hdm.team7.reportgenerator de.hdm.team7.It_projekt

GWT do not detects my browser corectly

When I run my APP under IE9 it fails with a lot of JS errors and I receive attached message even that I run my APP with IE9. This confuses my code, because elements in js do not accept addEventListener under IE6.
This is my GWT.xml file
<module rename-to="MyModuleName">
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.http.HTTP"/>
<inherits name="com.google.gwt.xml.XML"/>
<inherits name="com.google.gwt.i18n.I18N"/>
<inherits name="com.googlecode.gwt.charts.Charts"/>
<set-property name="user.agent" value="ie9"/>
<entry-point class="com.test.MyModuleName"/>
</module>
Thanks for the help in advance!
IE8+ will use the ie6 permutation if they switch to quirks mode. Make you you have a doctype that triggers standards mode (simplest is <!doctype HTML>) and/or include a <meta http-equiv="X-UA-Compatible" content="IE=Edge">

How to connect vaadin 7 with Google map

I used com.vaadin.tapio.googlemaps.GoogleMap component to connect with Google map from vaadin.
I tried the below code.(Vaadin 7.0.2)
public class StoresMainView extends VerticalLayout implements View {
#Override
public void enter(ViewChangeEvent event) {
setSizeFull();
GoogleMap googleMap = new GoogleMap(new LatLon(-27.47101, 153.02429), 10.0, "");
googleMap.setSizeFull();
googleMap.setImmediate(true);
googleMap.setMinZoom(4.0);
addComponent(googleMap);
}
But it gives the below error when running.I added the dependency in my pom.
Widgetset does not contain implementation for com.vaadin.tapio.googlemaps.GoogleMap. Check its component connector's #Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.
In my web.xml I have define the Widget set as below
<init-param>
<param-name>widgetset</param-name>
<param-value>com.client.DashboardWidgetSet</param-value>
</init-param>
And my DashboardWidgetSet as below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="org.vaadin.cssinject.Cssinject_addonWidgetset" />
<!-- -->
<set-configuration-property name="devModeRedirectEnabled"
value="true" />
<!-- Uncomment the following to compile the widgetset for one browser only.
This can reduce the GWT compilation time significantly when debugging. The
line should be commented out before deployment to production environments.
Multiple browsers can be specified for GWT 1.7 as a comma separated list.
The supported user agents at the moment of writing were: ie6,ie8,gecko,gecko1_8,safari,opera
The value gecko1_8 is used for Firefox 3 and later and safari is used for
webkit based browsers including Google Chrome. -->
<!-- <set-property name="user.agent" value="safari"/> -->
<!-- WidgetSetOptimizer -->
<inherits name="org.vaadin.easyuploads.Widgetset" />
<inherits name="com.vaadin.tapio.googlemaps.WidgetSet" />
</module>
Any help is really appreciated.
You need to make sure that the widgetset init-param in your web.xml points to the right widgetset. The default one does not contain any information about the Google Map component's widgets.

JRebel rebel.xml configuration problems using web and link elements

I have the following rebel.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<dir name="${project.dir}/src/main/resources"/>
<!-- Useful for classes when IDE auto compile on save is enabled, classes will be redeployed -->
<dir name="${project.dir}/target/classes"/>
<dir name="${project.dir}/target/digital-entitlement/WEB-INF/classes"/>
</classpath>
<!-- <web> -->
<!-- <link target="/"> -->
<!-- <dir name="${project.dir}/src/main/webapp"/> -->
<!-- </link> -->
<!-- </web> -->
</application>
with it class reloading is working fine.
But when I uncomment the <web> fragment above, to enable web assets reloading, then the web app hangs on a login form test case:
w/o the <web> config the web page is loaded correctly and then submitting the un/pwd is ok triggering the reload of server side classes by jrebel when modified.
Adding the <web> config hangs the browser and the initial login page is never loaded (selenium tests go in timeout after 30 secs).
NOTE: not all the web pages hang when the <web> config is enabled.
Thanks

Categories