Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I fix CNFE "org.eclipse.jface.text.BadLocationException" in build when using custom build toolkit plugin?

Using RTC 4.0.6 I am running a custom plugin in my build toolkit. It makes use of java to query work items. While the java class can be called from ANT via <exec> task and works just fine, as part of the custom plugin in the build it will break the build with:

BUILD FAILED
java.lang.NoClassDefFoundError: org.eclipse.jface.text.BadLocationException
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:73)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:71)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:71)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:135)
    at com.ibm.team.process.internal.client.ThinClientProcess.createConfigurationData(ThinClientProcess.java:329)
    at com.ibm.team.process.internal.client.ThinClientProcess.getProjectConfigurationData(ThinClientProcess.java:280)
    at com.ibm.team.workitem.client.internal.AuditableClientProcess.findProcessConfiguration(AuditableClientProcess.java:72)
    at com.ibm.team.workitem.common.internal.ConfigurationItemManager.resolveProcessConfiguration(ConfigurationItemManager.java:124)
    at com.ibm.team.workitem.common.internal.ConfigurationItemManager.readConfigurationItems(ConfigurationItemManager.java:107)
    at com.ibm.team.workitem.common.internal.WorkItemTypeManager.readConfigurationItems(WorkItemTypeManager.java:370)
    at com.ibm.team.workitem.common.internal.ConfigurationItemManager.updateCache(ConfigurationItemManager.java:99)
    at com.ibm.team.workitem.common.internal.util.CacheHelper.internalCheckCache(CacheHelper.java:107)
    at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:73)
    at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:65)
    at com.ibm.team.workitem.common.internal.ConfigurationItemManager.findConfigurationItems(ConfigurationItemManager.java:48)
    at com.ibm.team.workitem.common.internal.WorkItemCommon.findWorkItemTypes(WorkItemCommon.java:410)
    at com.ibm.team.workitem.common.internal.expression.WorkItemQueryAttributeFactory.cacheCustomAttributesFromWorkitemTypes(WorkItemQueryAttributeFactory.java:452)
    at com.ibm.team.workitem.common.internal.expression.WorkItemQueryAttributeFactory.updateCache(WorkItemQueryAttributeFactory.java:137)
    at com.ibm.team.workitem.common.internal.util.CacheHelper.internalCheckCache(CacheHelper.java:107)
    at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:73)
    at com.ibm.team.workitem.common.internal.expression.WorkItemQueryAttributeFactory.findAttribute(WorkItemQueryAttributeFactory.java:102)
    at net.jazz.ant.samples.arne.CheckSnapWorkItem.checkSnapWorkItem(CheckSnapWorkItem.java:93)
    at net.jazz.ant.samples.arne.ReviewChangeSetHistory.doExecute(ReviewChangeSetHistory.java:288)
    at com.ibm.team.build.ant.task.AbstractTeamBuildTask.execute(AbstractTeamBuildTask.java:666)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.Main.runBuild(Main.java:758)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jface.text.BadLocationException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:677)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
    ... 42 more

How to fix this?

0 votes


Accepted answer

Permanent link
Hi Arne, I'm confused by your comment saying it works OK in Ant when the stack shows it failing in Ant.  Did you mean it works OK when running Ant from within RTC/Eclipse, but not when run in the build?

What's happening here is you're using an API method not previously used by JBE or our Ant tasks, and it's hitting an exception for which the jar is missing.  We don't include all prereq jars under the buildtoolkit directory, just the ones needed by our Ant tasks (since Ant tasks run as plain Java, not OSGi, it doesn't mind the missing prereqs).

For now, I suggest adding the jar for org.eclipse.text to the buildtoolkit directory.  If you think this should be included in the Build System Toolkit by default, please file an enhancement request against RTC/Build.
Arne Bister selected this answer as the correct answer

2 votes

Comments

I also suspect that the missing jar is masking another issue, that's causing BadLocationException to be thrown in the first place. 

Nick, no. There is no BadLocationException thrown but one of the SDK interfaces actually does an import org.eclipse.jface.text.BadLocationException;
One can google the fact that this Exception really lives in the org.eclipse.text.jar rather than org.eclipse.jface.text. What I meant with the comment about "it works when called by <exec> task in ANT", this is when I called plain java classes by <exec java ...>. Obviously this worked because the class was called with the RTC Client Eclipse plugins in its classpath.
Your suggestion to copy org.eclipse.text to build toolkit is what I did and yes, I think an RFE is in order for org.eclipse.text to be included in build toolkit.


One other answer

Permanent link
Reusing the answer in https://jazz.net/forum/questions/92009/badlocationexception-when-querying-for-work-items-using-java-api I copied the org.eclipse.text_3.5.0.v20100601-1300.jar from my RTC Eclipse client plugin directory to <Build_Install_Path>\buildsystem\buildtoolkit
The build then works without breaking.

I tried various other ways of referencing that org.eclipse.text. Is there a more graceful way of solving this issue?

1 vote

Comments

RTC and the build tool kit are two different Java environments, so necessary .jar files have to be distributed to both environments for certain Java applications to run properly. I don't know how you distribute the custom plugin, but you need to make sure the org.eclipse.text.###.jar file is included in the distribution (as being copied in your case). I can't think of anything "more graceful".

1 vote

Donald, thanks for the answer. I guess by "more graceful" I am asking for the minor RFE to include the org.eclipse.text in the standard build toolkit distribution.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,940
× 562
× 369

Question asked: May 04 '14, 7:50 a.m.

Question was seen: 8,462 times

Last updated: May 05 '14, 9:35 a.m.

Confirmation Cancel Confirm