I've been battling with this bug for 3 hours.
I have checked the build path and classpath and they are the same, this is quite a large webapp, running on Tomcat & Geronimo, it has a build file for each component & then one main once that binds them all together, but I've gone over the ant build files & compared them to others in working components that rely on 3rd party libraries and I don't see an differences.
<fileset dir="${home.dir}/component/lib" includes="*.jar"/>
It all seems to be in order.
If I call this method from a JUnit test, run from within eclipse, is passes no problem, if I run the server I get this exception.
Also I have two other libraries that this component uses & I just added it as a user library in eclipse & in the components lib referenced in the build.xml and it works without a problem. I've tried moving jars around resorting to trial and error when logic seemed to fail me & no luck yet.
To make matters even stranger, I remember now, I had this issue with some code I wrote myself that wasn't even in a library. java.lang.NoSuchMethodError, since eclipse does occasionally do random things I just changed the method name and did a clean & it worked.
I've tried cleaning and rebuilding the whole web app several times with no change.
I'd like some advice about how to get closer to the problem so I can try find the bug, how does one debug classpath issues is there anywhere else the classpath is defened besides the build file?
Any suggestions on how to pin point the problem would be appreciated.
Exception: java.lang.NoSuchMethodError
[java] Message: com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
[java] ---- stack trace ---------------------------------------------------------------
[java] java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMultimap.of()Lcom/google/common/collect/ImmutableMultimap;
[java] com.google.gdata.util.common.net.UriParameterMap.<clinit>(UriParameterMap.java:78)
[java] com.google.gdata.client.Service.computeQueryMap(Service.java:2190)
[java] com.google.gdata.client.Service.access$000(Service.java:94)
[java] com.google.gdata.client.Service$ClientStreamProperties.<init>(Service.java:1839)
[java] com.google.gdata.client.Service$ClientOutputProperties.<init>(Service.java:1986)
[java] com.google.gdata.client.Service.writeRequestData(Service.java:2029)
[java] com.google.gdata.client.Service.insert(Service.java:1408)
[java] com.google.gdata.client.GoogleService.insert(GoogleService.java:599)
[java] com.google.gdata.client.appsforyourdomain.AppsForYourDomainService.insert(AppsForYourDomainService.java:100)
[java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:437)
[java] za.co.venturenet.api.googleapps.GoogleAppsServices.createUser(GoogleAppsServices.java:336)
[java] za.co.venturenet.api.googleapps.GoogleAppsFacade.createNewVenturenetUser(GoogleAppsFacade.java:158)
NoSuchMethodError means that the class was found, but a referenced method in that class is not found. The most typical cause of this is accessing a wrong version of class/library. Since your problem only manifests when running on the server, I would look at your server's configuration. Perhaps a different version this library is wired into server's system classloader (which would be ahead of whatever is bundled in your webapp).
>since eclipse does occasionally do random things I just changed the method name and did a clean & it worked.
I've had the same error, and have tried the same solution: change method name, or add an empty line to the java file, rebuild. It usually works one time. But upon second server start, the NoSuchMethodError returns for the same method identifier.
My eclipse environment builds a "target/classes" folder, which gets a copy of the web-inf classes.
Removal of that folder seems to have cured my problems with random NoSuchMethodError, which were probably caused by inability to resolve which instance to load.
Your mileage may vary.
Related
I am using FOP (version 2.3.0). When I try to compile the Spanish patterns I downloaded from OFFO running ant jar-hyphenation, I get next error:
compile-hyphenation:
[java] Processing /home/pf/MEGA/prg/java/fop/trunk/fop/hyph/es.xml
[java] Exception in thread "main" java.lang.StackOverflowError
[java] at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:180)
[java] at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:244)
And the last line of output is repeated a zillion of times.
Other patterns are compiled without problems, but when I include the Spanish ones, the build process crashes. Just to be sure the file was not corrupted, I downloaded a more recent version of es.xml but ant is still crashing.
On https://issues.apache.org/jira/browse/FOP-2569, I found the solution:
The recursion at
org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:244) is
correct, but it requires more stack size. Fix:
>diff build.xml~ build.xml
184c184
< <property name="hyph.stacksize" value="512k"/>
—
> <property name="hyph.stacksize" value="1M"/>
The build process just needed a bigger stack. The build.xml file to be modified resides in the parent directory of the hyph directory. I increased the stack and was just able to compile everything.
With three friends, I am developing an application with gwt (2.6). A few weeks ago, we started to use super dev mode. Everything works great, except that two of us cant use ImageBundles. It started when I wanted to include a SuggestBox, which apparently loads some images. GWT compile failed. I googled a lot, and I couldn't fix it, so I started to work on something else: Loading some images using an ImageResourceBundle. GWT compile failed. Same error. Workaround: loading images not using ImageResourceBundle. Whats really strange is: two of us are working with windows, one with ubuntu and I'm using a mac. The compile works fine with ubuntu and with one of the windows machines. On the other machines, the compilation error stays always the same no matter what we try:
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Computing all possible rebind results for 'com.google.gwt.user.client.ui.MenuBar.Resources'
Rebinding com.google.gwt.user.client.ui.MenuBar.Resources
Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator
[ERROR] No #com.google.gwt.resources.ext.ResourceGeneratorType was specifed for type com.google.gwt.resources.client.ImageResource or its supertypes
[ERROR] Errors in 'com/google/gwt/user/client/ui/MenuBar.java'
[ERROR] Line 212: Failed to resolve 'com.google.gwt.user.client.ui.MenuBar.Resources' via deferred binding
Computing all possible rebind results for 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template'
Rebinding com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template
Invoking generator com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator
Constructing interface com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template
Generating method body for image()
[ERROR] Required annotation #Template not present on interface method public abstract com.google.gwt.safehtml.shared.SafeHtml image(com.google.gwt.safehtml.shared.SafeUri clearImage, com.google.gwt.safecss.shared.SafeStyles style)
[ERROR] Errors in 'com/google/gwt/user/client/ui/impl/ClippedImageImpl.java'
[ERROR] Line 104: Failed to resolve 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template' via deferred binding
Computing all possible rebind results for 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate'
Rebinding com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate
Invoking generator com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator
Constructing interface com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate
Generating method body for image()
[ERROR] Required annotation #Template not present on interface method public abstract com.google.gwt.safehtml.shared.SafeHtml image(com.google.gwt.safehtml.shared.SafeUri clearImage, com.google.gwt.safecss.shared.SafeStyles style)
[ERROR] Errors in 'com/google/gwt/user/client/ui/impl/ClippedImageImpl.java'
[ERROR] Line 96: Failed to resolve 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate' via deferred binding
[ERROR] Compiler returned false
I really don't know what to do. We checked nearly every setting/config-file in eclipse and tomcat. Its all the same. Has anyone an idea where to look? Maybe I'm looking in the wrong places. I appreciate any help you can give me.
Additional information (update):
When building the application with ant the gwt-compile runs without errors.
We use eclipse WITHOUT google plugins.
In dev mode the web application is started via tomcat7.
The super-dev-mode is invoked WITHIN the web application (in Servlet.init()). Therefor we had to add the gwt-dev jars into the classpath of the tomcat launcher.
Including new SuggestBox() anywhere into our gwt source code causes the gwt-compile-error on some machines. Without new SuggestBox() everything compiles everywhere.
I think it is a classpath or gwt-compile-sourcepath problem. But we see no differences on the different machines we use.
When building the application with ant the gwt-compile runs without errors.
1) So if you compare the way you compile it and the way ant compiles it you will see the root cause.
2) In case you don't see any difference or you don't know how Eclipse (or whatever you use) compiles your application try to compile it in this way (we may call it true pure dzen way without any eclipse, ant, maven or other third-party "helpers"):
java -cp gwt-dev.jar;gwt-user.jar;validation-api-1.0.0.GA.jar;validation-api-1.0.0.GA-sources.jar;any/other/lib.jar;path/to/your/module/source/code com.google.gwt.dev.Compiler moduleName
In case your .gwt.xml descriptor is located under com/your/gwt/module/MyModule.gwt.xml you should use com.your.gwt.module.MyModule as a moduleName
As you have not included any code it is hard to guess what could have gone wrong, but here are some possible reasons:
Zero-parameter constructors
This is the one that was mentioned the most in the articles I read (references included below) and seems to create exactly the issue you are having, but I have to admit that I do not know why that would happen just to some of your teammates (maybe it is just needed under certain VMs or something like that).
It might be a deferred binding issue (according to the compiler log you posted) and therefore you should check if all your POJO (plain old java object) classes have a zero-parameter constructor for deferred loading.
Failed to resolve class via deferred binding
Conflicting annotations
Maybe you have some annotations placed wrong, as mentioned here:
Deferred binding failed GWT using uibinder
Some annotations such as #UiConstructor and #UiFactory don't go well together and (even though they are not actually conflicting in this case) can cause similar problems.
References & More
Failed to create an instance of Service via deferred binding
http://www.sencha.com/forum/archive/index.php/t-170786.html?s=fb45a32ac52270e43026da25ff956840
http://samuelcheng.wordpress.com/2011/01/02/deferred-binding-failure-in-gwt/
Deferred binding failed
https://groups.google.com/forum/#!topic/google-web-toolkit/iHajUf7sjtE
If you are using Maven, you can easily do a javac with mvn compile, then you can run mvn gwt:compile. These nasty errors will go away.
I'm trying to user super-source to emulate classes GWT has no access to the source code. This ran fine first. But when I use those classes in classes that get validated by Bean Validation (JSR 303), I get an error:
[java] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
...
...
[java] Caused by: java.lang.NoClassDefFoundError: somepath/myClass
IMHO this looks like I cannot use Emulations in 'shared' packages but only in the 'client'.
any experiences here?
TIA
ujbi
In GWT:
client package compiled to javascript.
Shared package compiles both to java byte code and javascript.
Most probably while compiling to java code no issues raise.But while compiling to java script you might thrown in to this issue.
IMHO This looks like I cannot use Emulations in
'shared' packages but only in the 'client'.
Yes unfortunately that's true.
The code in the shared package must friendly to Compiler. I.e It should emulate.
Our Eclipse RCP application has a headless PDE Build setup from Eclipse 3.2 that's been working for years. We recently updated both the instance of Eclipse we use to do the headless PDE Build and our target platform to 3.6 (principally to be able to create hyperlinks "into" our application), and the headless PDE Build now fails with:
...
[java] generateFeature:
[java]
[java] fetch:
[java]
[java] generateFeature:
[java]
[java] BUILD FAILED
[java] C:\Projects\[...]\PDE Build\plugins\org.eclipse.pde.build_3.6.2.R36x_20110203\scripts\productBuild\productBuild.xml:39: The following error occurred while executing this line:
[java] C:\Projects\[...]\PDE Build\plugins\org.eclipse.pde.build_3.6.2.R36x_20110203\scripts\productBuild\productBuild.xml:69: java.lang.NullPointerException
[java]
[java] Total time: 0 seconds
[java] An error has occurred. See the log file
[java] C:\Projects\[...a separate area dedicated to making builds...]\workspace\.metadata\.log.
The relevant part of the stack trace in the log file would seem to be:
java.lang.NullPointerException
at org.eclipse.pde.internal.build.BundleHelper.getProvisioningAgent(BundleHelper.java:104)
at org.eclipse.pde.internal.build.AbstractScriptGenerator.getAssociatedRepositories(AbstractScriptGenerator.java:625)
at org.eclipse.pde.internal.build.AbstractScriptGenerator.getSite(AbstractScriptGenerator.java:332)
at org.eclipse.pde.internal.build.FeatureGenerator.createFeature(FeatureGenerator.java:339)
at org.eclipse.pde.internal.build.FeatureGenerator.generate(FeatureGenerator.java:161)
at org.eclipse.pde.internal.build.tasks.FeatureGeneratorTask.run(FeatureGeneratorTask.java:54)
at org.eclipse.pde.internal.build.tasks.FeatureGeneratorTask.execute(FeatureGeneratorTask.java:36)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
...
The PDE Build Eclipse instance was created according to this process. We tried to produce as clean a target platform as we could, but (in the absence of clear instructions or early success) resorted to unzipping eclipse-rcp-helios-SR2-win32.zip into a directory then unzipping eclipse-3.6.2-delta-pack.zip on top of it.
How can we restore our PDE Build process to working order?
Perhaps our build.properties is too old (from 3.2's template, probably), or perhaps we constructed our target platform improperly, but thanks to a blog post by Kai Tödter, one of the many potential remedies we tried in desperation was (according to Kai's "Trick 1") deleting everything out of our target platform directory except the plugins and features directories. That at least stopped PDE Build mysteriously choking, and error messages then guided us to the rest of the fixups we had to do. (In our case, those fixups consisted almost entirely of updating a secondary (tests) product definition's list of required plugins by clicking "Add Required Plug-ins" and removing a reference to the org.eclipse.ant.optional.junit4 fragment.)
Indeed, it appears that merely deleting either one of the following lines from the target platform's configuration/config.ini is sufficient to unstick PDE Build:
eclipse.p2.profile=epp.package.rcp
(or)
eclipse.p2.data.area=#config.dir/../p2
...though we have preferred to just strip out everything but plugins and fragments lest there be other magical beings hiding in the target platform that could potentially trip us up.
(We don't understand why deleting one of those lines would placate PDE Build . . . but we're back in business.)
I've installed the plugin from this article by Peter
http://www.cacoethes.co.uk/blog/groovyandgrails/the-command-pattern-w....
While compile time its not able to find the module file which is
present in the plugin. Since there are no jar files for the module,
can you tell me what I'm missing here..
The stack trace is as follows:
[java] Loading inherited module 'grails.plugins.gwt.Grails'
[java] [ERROR] Unable to find 'grails/plugins/gwt/Grails.gwt.xml' on your classpath; could be a typo, or maybe you forgot to incl
ude a classpath entry for source?
[java] [ERROR] Line 12: Unexpected exception while processing element 'inherits'
[java] com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
Hey Satya, I've had similar problems with classpath errors working with other grails plugins.
I've found sometimes it's necessary to manually copy artifacts from (user-home directory)/.grails/(grails-version)/plugins/(plugin-name) into the lib/ directory inside my grails project.
In this case, you might try copying src/gwt (from the grails-gwt-0.5-SNAPSHOT.zip) into lib/gwt? or maybe try to copy it to match grails/plugins/gwt/Grails.gwt.xml?