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

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

Related

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.

PDE headless build not building while IDE does (3rd parties uses directives unresolved)

We have a large OSGi project with some own bundles and hundreds of third parties bundles.
After some tweaking of dependencies, we were able to produce a valid Launch Configuration that runs correctly and a product/feature configuration that builds correctly (via IDE of Eclipse Luna) and generates a valid executable.
So far so good with IDE PDE build.
Now we want to run the build in the headless way. We have followed the tutorial for Eclipse Luna (http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Ftasks%2Fpde_feature_build.htm) and set-up a headless build environment. We use the same product/feature files as before but now we got unresolved uses directives and the build fails.
The environment looks sane, since we can build headless other (smaller) applications with no problems.
Digging in some of the problems, we have seen that some of them refers to OPTIONAL imports not resolved... To my understanding they should not complain.
Example:
[java] C:\Program Files\eclipse_Luna\plugins\org.eclipse.pde.build_3.9.0.v20140415-2029\scripts\genericTargets.xml:
111: Processing inclusion from feature snapp.feature: Bundle org.apache.servicemix.bundles.jaxb-impl_2.2.1.1_2 failed to
resolve.:
[java] Package uses conflict: Import-Package: javax.xml.bind; version="[2.2.0,3.0.0)"
[java] Package uses conflict: Import-Package: javax.xml.bind.attachment; version="[2.2.0,3.0.0)"
[java] Package uses conflict: Import-Package: javax.xml.bind.helpers; version="[2.2.0,3.0.0)"
[java] Unsatisfied import package org.jvnet.staxex_0.0.0.
Since we have thousands of third parties uses directives, of course we are not going to hack the manifest of all the involved bundles...
Why does the headless build is so picky about the uses directives? Is there any way to instruct headless PDE to skip this kind of checks?
Thank you in advance!

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.

GWT Development Mode with Eclipse/Maven

I am just starting with GWT. I use Eclipse and have installed the GWT plugin.
I have followed the directions here Maven GWT 2.0 and Eclipse to set up a GWT project using the gwt-maven-plugin. When I run the Maven goals gwt:compile gwt:run, GWT Development Mode is launched and I can copy the url from it to my browser and view the label.
However, the project has this problem:
Description: The web.xml file does not exist
Resource: WEB-INF
Path: /GWTExample/war
Location: Unknown
Type: Google Web App Problem
If I try to run the project as a Google Web Application, I get this warning:
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
I can get rid of the problem by copying the web.xml to the war directory, but I still get the URL issue when running as a Google Web App.
If I'm using Maven and GWT in Eclipse, should I just ignore the web.xml problem and always run applications in development mode via the Maven goals? Or is there a way to set things so I can run as a Google Web App?
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run? I have added breakpoints to my application but it doesn't stop on them. I'm not sure if it is something I've configured wrong or if it's just not possible.
Update:
In response to Prem's answer...
When I run a compile gwt:run, the web.xml file isn't copied. When I run the install gwt:run, I get this error:
[INFO] --- gwt-maven-plugin:1.2:test (default) # SampleGWT ---
[INFO] using GWT jars from project dependencies : 2.0.4
[INFO] establishing classpath list (scope = test)
[ERROR] java.lang.NoClassDefFoundError: org/codehaus/mojo/gwt/test/MavenTestRunner
[ERROR] Caused by: java.lang.ClassNotFoundException: org.codehaus.mojo.gwt.test.MavenTestRunner
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[ERROR] Could not find the main class: org.codehaus.mojo.gwt.test.MavenTestRunner. Program will exit.
[ERROR] Exception in thread "main"
I’m guessing that bug http://jira.codehaus.org/browse/MGWT-24 is included in version 1.2 of the gwt-maven-plugin. Normally I wouldn’t run install on a project that builds a war file, but I would expect to at least get past the test phase of the build cycle.
Does anybody have any idea why I would get this error on the install but not the compile goals? Also, should I be expecting either goal to copy the web.xml file from src/main/webapp/WEB-INF/web.xml to the /war directory?
Description: The web.xml file does not exist
gwt-maven-plugin creates a project with 'war' packaging format (it's a web app so no surpirse here). Web.xml for this project will be under 'src/main/webapp' folder which will be copied to the 'war' directory (which is set as the output directory) as part of the 'resources' phase in the maven build life-cycle. You should always use
mvn compile gwt:run
or
mvn install gwt:run
so that resources are copied, all java files are compiled and gwt:compile is also invoked (since it is bound to the 'compile' phase automatically)
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
As per the stackoverflow link you used as reference, only your maven build file is setup with startupUrl. In order for it to work in Eclipse, you must edit the Run Configuration of your project and add the '-statupUrl' command line arguments to the existing arguments in the "Arguments" panel.
However, this is just a warning and it should not stop you from running your GWT application from eclipse. If you are facing the same "web.xml" problem here as well, it could be because you did not compile your project in your IDE before invoking "Run as Web Application". I suggest you to disable "Build Automatically" option for this project and always build it manually and invoke "GWT Compile" and then try "Run as web application"
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run?
In general you must use "Remote Application" debug configuration for remote debugging a process. However I am not sure if it will work for GWT projects.
I got me too this warning:
No startup URLs supplied and no plausible ones found
when I have followed this gwt tutorial
In that screenshot there is no checkbox with "Generate sample code" . In my IDE ( sdk 2.5) it is, so I have unchecked...
It wasn't created any of the server and client packages, I have created the client manually, as the tutorial required. The tutorial until that step doesn't say I must have a server package too. That and his configuration is missing from project.
If you right-click on your project and go to Properties -> Google -> Web Application, your WAR directory might be something like either war or src/main/webapp/WEB-INF/classes.
Change that to src/main/webapp.
Also un-check the box next to "Launch and delploy from this directory..."
That's what fixed this problem for me. It also fixed the "can't find gwt-servlet.jar" problem at the same time.

Error loading the grails gwt module xml

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?