Error loading the grails gwt module xml - gwt

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?

Related

sbt: How can I add a local filesystem jar to my project...but also a lot of .so libraries?

In this question, there is discussion of how to include jar file into an sbt project. I need both a .jar file and some .so library files.
Attempt 1:
I can move the jar file into my sbt lib/ directory, which is great, except that this application has a small jar which is just a wrapper around C++ software. The stuff I want to do is in the .so library files, and if I move the jar file to ./lib by itself, I get linking errors:
sbt:SimpleProject> run linearSalience
[info] Running linearSalience linearSalience
[error] (run-main-0) java.lang.UnsatisfiedLinkError: no java_salience in java.library.path
[error] java.lang.UnsatisfiedLinkError: no java_salience in java.library.path
[error] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
Attempt 2:
I have tried putting simlinks to the desired libraries into the lib/ folder, but that didn't work. I don't want to copy the entire library into the lib/ folder, even if that would work, since it is almost 2 GB; and it would be silly to copy it for each project.
Attempt 3:
I tried setting java.library.path through the javaOptions of sbt, by adding the following line to build.sbt
javaOptions in run += "-Djava.library.path=/opt/path/to/lib/:/opt/path/to/sdk/java/src/"
The first path contains the .so files, the second the .jar file. In this case, the compiler couldn't even find the packages (which was not a problem while the .jar file was in the lib/ folder of sbt):
[info] Compiling 1 Scala source to /opt/optests/sbttest/target/scala-2.10/classes ...
[error] /opt/optests/sbttest/src/main/scala/SimpleApp.scala:6:12: object lexalytics is not a member of package com
[error] import com.lexalytics.salience.{Salience, Section, Sentence, Word}
[error] ^
[error] /opt/optests/sbttest/src/main/scala/SimpleApp.scala:23:23: not found: type Salience
[error] val session = new Salience("/opt/path/to/license.v5", "/opt/path/to/data")
[error] ^
...etc
Attempt 4:
I try to set the LD_LIBRARY_PATH environment variable (as suggested here)
[user#server ~]$ echo $LD_LIBRARY_PATH
/opt/path/to/lib/:/opt/path/to/sdk/java/src/
The result is the same error as in 3
It seems like all the questions on this topic are resolved by either putting single jar files into lib/ or using managed dependencies (as here). But I have a local-only repository with no online support, that is more than a single .jar file.
Ultimately, I need to get the library directory into java.library.path, but how do I do that?
Note: This is not a duplicate of any question that deals with only .jar files and has no mention of .so files.
When you use a JNI wrapper over a native library on JVM (it doesn't matter on the language, it can be Java or Scala), the library jar file usually contains only the JNI glue code, defining how to map some java api calls to the native library calls. This jar is just a regular library, so it can be dropped to the /lib sbt folder as usual.
The native library itself should be present at runtime within the java.library.path, so you were quite close. As you suggested, you can add native SDK to the javaOptions in run (along with the jar in /lib folder) and it should work.

FOP hyphenation can't build spanish patterns

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.

GWT has never heard of java.io.BufferedReader?

When I build the war file for deployment (ant war), the GWT compiler acts as if it has never heard of java.io.Reader or java.io.BufferedReader. When I make the development build for devmode (ant javac), they build just fine. I'm using GWT 2.4.0. Does anyone know what is going on?
gwtc:
[java] Compiling module com.foo.Foo
[java] Validating newly compiled units
[java] [ERROR] Errors in 'file:[...]/Foo/src/com/foo/shared/ReaderLineIterator.java'
[java] [ERROR] Line 13: No source code is available for type java.io.BufferedReader; did you forget to inherit a required module?
[java] [ERROR] Line 21: No source code is available for type java.io.Reader; did you forget to inherit a required module?
[java] [ERROR] Aborting compile due to errors in some input files
BUILD FAILED
Not the complete package java.io is supported by GWT.
See the JRE Emulation Reference for details
The client-side of GWT does not have access to the whole Java API. java.io is one of them.
When you run or compile it will give you did you forget to inherit a required module? error. But you can definitely use it on the server-side of GWT. You can find the list of classes that can be used at client-side here.

Mysterious NoSuchMethodError & it can't be the classpath...can it?

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.

Why does our Eclipse 3.6 (Helios) PDE Build fail with a NullPointerException?

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.)