
google-web-toolkit - issue #7527
java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge
Found in GWT Release: 2.5.0 RC1
Detailed description: There seems to be a bug in the shared.UriUtils class The class still makes use of the GWT class in the client package (instead of the shared package) which in turn uses GWTBridge (Line 275 of client.GWT) which of course has been moved from client package to shared thus resulting in:
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge at com.google.gwt.safehtml.shared.UriUtils.<clinit>(UriUtils.java:39)
To Repeat this try calling any method in UriUtils class eg: UriUtils.sanitizeUri(str);
Comment #1
Posted on Jul 17, 2012 by Swift Rhino(No comment was entered for this change.)
Comment #2
Posted on Jul 17, 2012 by Happy RhinoOk, so client.GWTBridge still exists in requestfactory-server.jar so by including this in the server side libraries this does now work
Comment #3
Posted on Jul 17, 2012 by Swift RhinoThis is because ValueCodexHelper uses client.GWT instead of shared.GWT. We should fix that too (and more globally make sure "shared" or "server" code only uses shared.GWT)
Comment #4
Posted on Jul 23, 2012 by Happy KangarooHi there! I tried to make my GWT app work with GWT2.5RC1 and it works in development mode, but in production mode my servlet class cannot be created because of this error.
Where can I find this requestfactory-server.jar? best would if its already somewhere on a maven repo
Comment #5
Posted on Jul 23, 2012 by Happy KangarooOkey found it.
com.google.web.bindery requestfactory-server ${gwtVersion} runtime
Comment #6
Posted on Aug 28, 2012 by Swift BirdIs the plan to leave c.g.g.core.shared.GWT code in request-factory and gwt-dev?
Would it be wise to suggest creating some kind of gpanel-core.jar which contains nothing but core classes and interfaces, so it's possible to write gwt-friendly shared classes and deploy to the server with only one lightweight jar?
I know fragmentation can lead to classpath-order trouble, but if all the jars are built at once, it might be nice to have a flyweight dependency bundle; I currently keep a maven module of super-source, @GwtScript and common gwt classes so I don't have to take gwt-user.jar on server / android, but it would be nice to have a jar prebuilt with c.g.g...GWT and interfaces + annotations.
This bug is assigned to Thomas, and I know he's the man in charge of mavenizing, so I might as well ask, if there are good enough use-cases for it, would it be wise to maintain a wishlist of classes and interfaces that developers would want in a core library to make gwt-friendly classes portable.
My wishlist would be fairly short: GWTBridge / GWT, AsyncCallback / Callback IsSerializable i18n interfaces SafeHtml Parser and friends TreeLogger com.google.gwt.dev.About/GwtVersion (the reason GWTBridge is in gwt-dev, is it not?)
My main incentive for suggesting this is that it's better to have one lib with common dependencies, than sprinkling them in request factory and gwt-dev, plus I can keep my server classpath to the metal.
Comment #7
Posted on Aug 28, 2012 by Swift Rhinohttps://gwt-code-reviews.appspot.com/1818803/
And to answer comment #6: this hasn't been discussed in details but we want to modularize GWT (both gwt-dev and gwt-user). Not sure if there'll be separate artifacts for shared, server and client code for each GWT module, but at least a few things will be pulled out in smaller JARs (particularly things to be used in the server-side)
Comment #8
Posted on Sep 5, 2012 by Happy RabbitThis issue was closed by revision r11255.
Comment #9
Posted on Sep 5, 2012 by Swift Rhino(No comment was entered for this change.)
Comment #10
Posted on Sep 25, 2012 by Swift RhinoIssue 7692 has been merged into this issue.
Comment #11
Posted on Sep 25, 2012 by Swift RhinoIssue 7692 has been merged into this issue.
Comment #12
Posted on Oct 3, 2012 by Happy Elephant(No comment was entered for this change.)
Comment #13
Posted on Oct 4, 2012 by Happy BirdI still get this exception with rc2:
Caused by: java.lang.ClassNotFoundException: com.google.gwt.core.client.GWTBridge at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:207) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 59 more
Do I need to add any additional jars to the CP?
Comment #14
Posted on Oct 4, 2012 by Swift RhinoLooks like it wasn't cherry-picked in the releases/2.5 branch :-(
Comment #15
Posted on Oct 4, 2012 by Massive BirdHmm - we recut the 2.5 branch for RC2 at r11274, so r11255 should have been in there without cherrypicking?
Comment #16
Posted on Oct 4, 2012 by Massive BirdI did a quick sanity check and it looks like in r11255 ValueCodexHelper.java gets switched from importing client/GWT to shared/GWT
When I look at that file in the 2.5 branch, it seems to be including shared/GWT, so I think that revision is in the branch (?)
Comment #17
Posted on Oct 4, 2012 by Swift RhinoAh, you're right. I don't know where I looked at but I was sure this link showed the previous "cut 2.5.0 branch" a few hours ago: http://code.google.com/p/google-web-toolkit/source/browse/releases/2.5/user/src/com/google/gwt/safehtml/shared/SafeUriHostedModeUtils.java
Comment #18
Posted on Oct 4, 2012 by Massive BirdDefinitely let me know if something looks off - my experience with SVN (and the rest of the open-source part of GWT) is pretty limited, so I may have messed something up somewhere :-)
Comment #19
Posted on Oct 26, 2012 by Happy RabbitThe error still happens in 2.5.0.GA
Comment #20
Posted on Oct 26, 2012 by Swift RhinoCould you please paste the stacktrace so we know which code would still use the wrong class?
Comment #21
Posted on Oct 27, 2012 by Happy RabbitHey Thomas, Find attached the full stack trace bellow. Let me know if you need more info or want me to do further tests.
- GWTBridge_stacktrace.txt 4.26KB
Comment #22
Posted on Oct 27, 2012 by Swift RhinoAh you use the experimental and now-discouraged DeRPC! https://developers.google.com/web-toolkit/doc/latest/DevGuideServerCommunication#DevGuideDeRPC
Comment #23
Posted on Oct 28, 2012 by Happy Elephant(No comment was entered for this change.)
Comment #24
Posted on Oct 30, 2012 by Happy RabbitI'll promise to banish it from my code, but until those classes are in GWT, they should work ;-). And please add @deprecated to them.
Comment #25
Posted on Oct 31, 2012 by Swift RhinoLooks like the fix isn't complete: https://groups.google.com/d/topic/google-web-toolkit/H0Blv3C_fns/discussion (RPC code calls .client. classes from .server. classes, and those .client. classes haven't been updated to use shared.GWT)
Comment #26
Posted on Nov 1, 2012 by Quick HippoI've got this happening in 2.5.0 GA and had to add request factory lib.
Comment #27
Posted on Nov 7, 2012 by Massive CamelComment deleted
Comment #28
Posted on Nov 7, 2012 by Massive CamelFor the record, an occurrence of this bug.
- stacktrace.txt 8.25KB
Comment #29
Posted on Nov 14, 2012 by Happy LionSo what's the final word re: 2.5.0 release?
Is there a jar we can include to avoid this problem and allow us to switch to using GWT 2.5.0 release?
Comment #30
Posted on Nov 14, 2012 by Swift RhinoThe workaround is to copy com.google.gwt.core.client.GWTBridge into your source and/or extract the class from gwt-dev.jar.
Comment #31
Posted on Nov 20, 2012 by Grumpy RhinoThe workaround is to copy com.google.gwt.core.client.GWTBridge into your source
Thanks, this has worked for me too.
Comment #32
Posted on Nov 22, 2012 by Swift RhinoComment #33
Posted on Dec 1, 2012 by Happy RabbitAs a point of interest, we use Classcycle to statically analyze our code to avoid these types of dependency issues. Maybe useful for the GWT team, too?
Comment #34
Posted on Dec 2, 2012 by Happy Horsee had this kind of problem too with GWT 2.5 migration, not exactly with the stacktraces mentioned here. I don't remember what was the stacktrace but effectivly copying com.google.gwt.core.client.GWTBridge solved our problem.
Comment #35
Posted on Dec 2, 2012 by Quick KangarooWhat do you exactly mean by "copying com.google.gwt.core.client.GWTBridge"? -Create a package "com.google.gwt.core.client" in my project and put the code of the GWTBridge-class there? Or do I have to put it into my client or shared package?
Comment #36
Posted on Dec 2, 2012 by Happy KangarooPlease think BEFORE posting questions. You're getting a ClassNotFound exception, because some code is searching for a class com.google.gwt.core.client.GWTBridge
--> how could it possibly help to put classes into your.class.path.client oder your.class.path.shared to solve this problem?!
Comment #37
Posted on Dec 4, 2012 by Happy RabbitThis issue was closed by revision r11398.
Comment #38
Posted on Dec 4, 2012 by Swift Rhino(No comment was entered for this change.)
Comment #39
Posted on Jan 10, 2013 by Swift Pandasince we are running 2.5.1 from trunk all Fixed not released issues go into it
Comment #40
Posted on Jan 25, 2013 by Swift RhinoIssue 7692 has been merged into this issue.
Comment #41
Posted on Feb 11, 2013 by Grumpy OxDon't get it... I saw this while running the JUnit tests after upgrading to 2.5.0 (our code invokes GWT.isClient()). Then I did as advised, got http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/super/com/google/gwt/core/shared/GWTBridge.java and saved it under com/google/gwt/core/client in our own GWT project. Now I'm seeing "java.lang.VerifyError: (class: com/google/gwt/core/client/GWT, method: setBridge signature: (Lcom/google/gwt/core/client/GWTBridge;)V) Incompatible argument to function" instead.
Comment #42
Posted on Feb 11, 2013 by Swift RhinoUse the 2.5.0 version of the file [1], and pick the 'client' one; or upgrade to 2.5.1-rc1.
Comment #43
Posted on Feb 11, 2013 by Grumpy OxGrrr, how stupid is that...thanks Thomas.
Comment #44
Posted on Feb 19, 2013 by Helpful RhinoAre you finding a solution
Comment #45
Posted on Feb 19, 2013 by Grumpy RhinoI read it is fixed but not released. When this has been planned?
Comment #46
Posted on Feb 19, 2013 by Swift Rhino2.5.1-rc1 is already there, with the fix. 2.5.1 should come real soon.
Comment #47
Posted on Feb 26, 2013 by Happy Elephantafter a update to 2.5.1 RC 1
:(
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70) at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64) at com.extjs.gxt.ui.client.core.FastMap.(FastMap.java:139) at com.extjs.gxt.ui.client.data.RpcMap.(RpcMap.java:69) at com.extjs.gxt.ui.client.data.BaseModelData.set(BaseModelData.java:125) at ..........ProjectManagementServiceImpl._serviceToModel(ProjectManagementServiceImpl.java:191) at ..........ProjectManagementServiceImpl.getAllServices(ProjectManagementServiceImpl.java:423) 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.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561) ... 38 more Caused by: java.lang.ClassNotFoundException: com.google.gwt.core.client.GWTBridge at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:213) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 53 more
Comment #48
Posted on Feb 26, 2013 by Swift RhinoThis is an issue with GXT which still references com.google.gwt.core.client.GWT, rather than com.google.gwt.core.shared.GWT, in shared code.
Comment #49
Posted on Feb 26, 2013 by Massive LionIn #47, schoen's stack trace doesn't have FastMap referring directly to GWTBridge, but to GWT itself, and in gwt-servlet.jar, com.google.gwt.core.client.GWT.setBridge(GWTBridge) accepts only the com.google.gwt.core.client.GWTBridge type, which isn't present in this jar. Wasn't this the point of fixing this issue? To make gwt-servlet internally consistent?
Without a functional copy of GWT in the client package in gwt-servlet, a GWT library can either be compatible with GWT 2.4.0 and before (before there was a shared GWT class) or GWT 2.5.0 and later, at least if it ever needs to talk to the GWT class. Why do we have com.google.gwt.core.client.GWT at all in gwt-servlet it if cannot be used?
GXT 2 has tried hard to remain compatible with GWT 1.7 and beyond - up until now that has meant recompiling to deal with interface/class changes at 2.0 and at 2.2. Breaking the client GWT class prevents GXT or any other library from maintaining source compatibility with even 2.4.0-2.5.1. GXT 3.0 then only supports GWT 2.4 and beyond, but even that it too broad, since GWT 2.5.0/1 made this breaking change.
Or am I missing something? Is there a reasonable way that a project can remain compatible with GWT 2.4.0 and GWT 2.5.0, or have we deliberately thrown that out in favor of forcing the move to the shared GWT class?
Comment #50
Posted on Feb 26, 2013 by Swift RhinoWe made sure only client code called com.google.gwt.client.GWT, and all shared code called com.google.gwt.shared.GWT. In other words, this is not a packaging issue (with the client.GWTBridge missing in the gwt-servlet.jar) but a "coding" issue.
We might need to revise this decision though, as it indeed is a breaking change between 2.4 and 2.5. I suggest you bring that discussion up to the Steering Committee.
Comment #51
Posted on Mar 12, 2013 by Swift Pandabulk edit: setting fixed issues for GWT 2.5.1 to Fixed
Comment #52
Posted on Apr 12, 2013 by Happy PandaHello.
We downloaded GWT 2.5.1 yesterday, but we are still getting the error: java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge
In the gwt-serverlet.jar has /com/google/gwt/core/shared/GWTBride exists, so is whatever needs GWTBridge is still looking in the wrong place?
Please let me know if i'm missing something.
Thanks!
Comment #53
Posted on Apr 12, 2013 by Swift Rhino"whatever needs GWTBridge" should appear in the stacktrace.
Comment #54
Posted on Apr 26, 2013 by Swift HippoIt does not work for me in 2.5.1
BTW the explanation and workaround: http://alexluca.com/2013/01/17/gwt-25-and-extgwt-224-classnotfoundexception-comgooglegwtcoreclientgwtbridge/
BTW2: Caused by: java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge at com.extjs.gxt.ui.client.core.FastMap.(FastMap.java:139) ~[gxt-2.2.5-gwt22.jar:2.2.5] at com.extjs.gxt.ui.client.data.RpcMap.(RpcMap.java:69) ~[gxt-2.2.5-gwt22.jar:2.2.5] at com.extjs.gxt.ui.client.data.BaseModelData.set(BaseModelData.java:125) ~[gxt-2.2.5-gwt22.jar:2.2.5] at com.extjs.gxt.ui.client.data.BaseModel.set(BaseModel.java:143) ~[gxt-2.2.5-gwt22.jar:2.2.5] at org.jresearch.commons.gwt.client.model.about.AboutModel.setBuildDate(AboutModel.java:42) ~[org.jresearch.commons.gwt.utils-1.0.2-20130412.141627-3.jar:na] at org.jresearch.commons.gwt.server.service.about.AboutService.createModel(AboutService.java:66) ~[org.jresearch.commons.gwt.utils-1.0.2-20130412.141627-3.jar:na] at org.jresearch.commons.gwt.server.service.about.AboutService.init(AboutService.java:45) ~[org.jresearch.commons.gwt.utils-1.0.2-20130412.141627-3.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_11] at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_11] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1612) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1553) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483) ~[spring-beans-3.2.1.RELEASE.jar:3.2.1.RELEASE] ... 32 common frames omitted Caused by: java.lang.ClassNotFoundException: com.google.gwt.core.client.GWTBridge at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713) ~[catalina.jar:7.0.37] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558) ~[catalina.jar:7.0.37] ... 46 common frames omitted
Comment #55
Posted on May 11, 2013 by Massive HippoPlease re-open - still exists in 2.5.1
2013-05-11 15:07:04.323:WARN:rta:qtp1409519414-56: Exception while dispatching incoming RPC call java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge at com.google.gwt.rpc.client.impl.EscapeUtil.escape(EscapeUtil.java:27) at com.google.gwt.rpc.server.WebModePayloadSink$PayloadVisitor.endVisit(WebModePayloadSink.java:211) at com.google.gwt.rpc.client.ast.StringValueCommand.traverse(StringValueCommand.java:38) ...
Comment #56
Posted on May 11, 2013 by Swift RhinoYou're using deRPC, which never exited the "experimental" stage and is deprecated and discouraged since 2.4, so I'm afraid the "fix" in this case will be to simply nuke deRPC.
Comment #57
Posted on May 11, 2013 by Swift HippoAnd what do I wrong? Method GWT.isScript() is also "experimental" and is deprecated?
If no, please reopen it.
Comment #58
Posted on May 11, 2013 by Swift RhinoUse com.google.gwt.core.shared.GWT for shared code, not com.google.gwt.core.client.GWT.
Comment #59
Posted on May 12, 2013 by Swift HippoHmm... Good suggestion for the new code. But what about old? Do you suggest to patch all old 3rd party libraries? Or what?
Comment #60
Posted on Jul 24, 2013 by Massive KangarooI'm trying to make a simple web form and I get the same exception at runtime
java.lang.NoClassDefFoundError: com / google / gwt / core / client / GWTBridge] with root cause
I tried to put the workarround jar in the classpath but still gives me the error, perhaps not doing it correctly.
Plan to fix this bug soon? There are some out next version maybe?
Comment #61
Posted on Jul 24, 2013 by Swift Rhino@garfuer: are you using GWT 2.5.1? Which class makes use of client.GWT? Is it part of GWT proper or from a third-party library? (or from your own code?)
This bug is fixed in GWT 2.5.1 as far as I'm concerned. You might need to update some third-party libraries and/or your own code though.
Comment #62
Posted on Jul 24, 2013 by Happy Elephantwe create a GWTBridge.java in a new Path "com.google.gwt.core.client"
!!! Caution create the package path "com.google.gwt.core.client" in your Project
- GWTBridge.java 331
Comment #63
Posted on Sep 19, 2013 by Happy CamelComment deleted
Comment #64
Posted on Sep 19, 2013 by Happy CamelI'm moving to GWT 2.5.1, don't have the issue in dev mode (Eclipse), however when the webapp is deployed on Tomcat I still do
Comment #65
Posted on Sep 19, 2013 by Swift Rhino@m.assante: see comment #61: which class makes use of client.GWT? Is it part of GWT proper or from a third-party library? (or from your own code?)
Comment #66
Posted on Oct 14, 2013 by Grumpy BearAt least com.google.gwt.rpc.client.impl.EscapeUtil uses com.google.gwt.core.client.GWT. This class in turn is used by com.google.gwt.rpc.server.WebModePayloadSink.PayloadVisitor.
I know deRPC is deprecated, but currently it's outright broken because of these chagnes.
Comment #67
Posted on Jun 18, 2015 by Swift GiraffeWith GWt 2.6.0: ok in super dev mode bug present in tomcat deployment
Suggested workaround?
Status: Fixed
Labels:
Priority-High
Milestone-2_5_1