-
1. Re: Errors in 3.0.4-SNAPSHOT after upgrading to GWT 2.7.0
hr.stoyanov Dec 5, 2014 5:44 AM (in response to hr.stoyanov)The exception seems to be coming from Cast.java:59 in GWT 2.7.0 and is related to my entry point class.
...
static Object dynamicCast(Object src, JavaScriptObject dstId) {
if (src != null && !canCast(src, dstId)) {
throw new ClassCastException();
}
return src;
}
-
2. Re: Errors in 3.0.4-SNAPSHOT after upgrading to GWT 2.7.0
hr.stoyanov Dec 5, 2014 1:19 PM (in response to hr.stoyanov)This may actually be a GWT 2.7.0 bug, not Errai:
https://plus.google.com/118379921162257118612/posts/9tp45FJe7QR
-
3. Re: Errors in 3.0.4-SNAPSHOT after upgrading to GWT 2.7.0
hr.stoyanov Dec 12, 2017 2:39 AM (in response to hr.stoyanov)Well, better late than never ... finally discovered the source of this nasty exception thanks to this discussion: https://groups.google.com/forum/#!topic/google-web-toolkit/jOlA7S2CwF0
This is still present in Errai 4.1.3-SNAPSHOT and GWT 2.8.2. The issue is that one needs to implement EntryPoint interface in addition to the @EntryPoint annotation like so:
@EntryPoint
public class Main implements com.google.gwt.core.client.EntryPoint{@Override
public void onModuleLoad() {//Nothing to do hee since Errai uses CDI for iitialization.
}
}
So why did I get it wrong? Because the Errai tutorial demo sets the this really bad example - see this:
/**
* <p>
* This bean attaches the {@link NavBar} and {@link NavigationPanel} when the application starts.
* <p>
* <p>
* The {@link EntryPoint} scope is like {@link ApplicationScoped} except that entry points are eagerly initilialized
* when the IoC container starts. Consequently, the {@link PostConstruct} of this bean will be invoked when the
* container is initialized.
*/
@EntryPoint
public class AppSetup {@Inject
private NavigationPanel navPanel;
@Inject
private NavBar navbar;
@Inject
private JQuery $;
@Inject
private HTMLDocument document;
@PostConstruct
public void init() {RootPanel.get("rootPanel").add(navPanel);
$.wrap($.wrap(document.body).children().first()).before(navbar.getElement());
}}
So how should this be fixed? Either fix the errai tutorial or make sure the @EntryPoint annotation takes care of implementing the requisite interface.
-
4. Re: Errors in 3.0.4-SNAPSHOT after upgrading to GWT 2.7.0
hr.stoyanov Dec 12, 2017 2:42 AM (in response to hr.stoyanov) -
5. Re: Errors in 3.0.4-SNAPSHOT after upgrading to GWT 2.7.0
mbarkley Dec 12, 2017 10:51 AM (in response to hr.stoyanov)The issue is that one needs to implement EntryPoint interface in addition to the @EntryPoint annotation like so:
I'm not sure where you're getting this idea from. I've never seen this casting error in Errai Tutorial. The only way I can imagine this would happen is if you made you `@EntryPoint` bean a GWT entrypoint in your *.gwt.xml, but you shouldn't do that.
-
6. Re: Errors in 3.0.4-SNAPSHOT after upgrading to GWT 2.7.0
hr.stoyanov Dec 12, 2017 3:12 PM (in response to mbarkley)Thanks Max,
You guessed it right - I did have an entry in the xml module definition, which was causing the issue. If section '1.3.6.3.EntryPoints' is the main place where @EntryPoint is documented, maybe it is a good idea to explicitly warn about this. Also in the examples of sections 2.2.1,2.2.4 the code does implement the EntryPoint interface.