Use jaxp with jdk1.3.1 for plugin development [message #101409] |
Mon, 28 July 2003 09:17  |
Eclipse User |
|
|
|
Hi folks,
maybe someone can help us with this one:
We're trying to develop an eclipse plugin that uses Xerces 2.4.0 via the
jaxp api to parse an xml file. Due to restrictions from the environment
under which the final installation should run, we have to use jre 1.3.1
as runtime environment.
The following code works fine in a "normal" java project using jdk
1.3.1_08 :
// Get Document Builder Factory
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
// Turn on validation, and turn off namespaces
factory.setValidating(false);
factory.setNamespaceAware(true);
DocumentBuilder builder = null;
builder = factory.newDocumentBuilder();
if (builder != null) {
this.doc = builder.parse(stream);
}
When using the same code within a plugin, I can build the project
without problems. However, I get a NoClassDefFoundError when getting
the DocumentBuilderFactory instance (see end of document for complete
stacktrace). This only happens when I specify jre 1.3.1 in the run...
dialog. The Xerces jars are include in the source lookup path under
Run...->Source. When I use jre 1.4.1 with the vm argument
-Djava.endorsed.dirs pointing to the dir where I installed the Xerces
jars, everything works fine.
Can anyone provide an explanation or (even better :-)) a solution to use
the jaxp api in a plugin under jre 1.3.1?
kind regards and TIA
Jerry Preissler
--8<-- stacktrace of error message
java.lang.NoClassDefFoundError: org/xml/sax/SAXException
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:232)
at
org.eclipse.core.internal.plugins.PluginDescriptor.createExe cutableExtension(PluginDescriptor.java:138)
at
org.eclipse.core.internal.plugins.PluginDescriptor.createExe cutableExtension(PluginDescriptor.java:167)
at
org.eclipse.core.internal.plugins.ConfigurationElement.creat eExecutableExtension(ConfigurationElement.java:103)
at
org.eclipse.ui.internal.WorkbenchPlugin.createExtension(Work benchPlugin.java:151)
at org.eclipse.ui.internal.EditorManager$3.run(EditorManager.ja va:676)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:1006)
at org.eclipse.core.runtime.Platform.run(Platform.java:413)
at org.eclipse.ui.internal.EditorManager.createPart(EditorManag er.java:674)
at
org.eclipse.ui.internal.EditorManager.openInternalEditor(Edi torManager.java:661)
at
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:459)
at
org.eclipse.ui.internal.EditorManager.openEditorFromInput(Ed itorManager.java:333)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:424)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2056)
at org.eclipse.ui.internal.WorkbenchPage.access$6(WorkbenchPage .java:2004)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:1991)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:69)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:1986)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:1887)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:133)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:106)
at
org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:47)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:15 8)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:14 7)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:191)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:169)
at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:324)
at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 3.open(PackageExplorerPart.java:323)
at
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:397)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:1006)
at org.eclipse.core.runtime.Platform.run(Platform.java:413)
at
org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:395)
at
org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:605)
at
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:694)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:209)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:204)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:233)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1838)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1545)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1402)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.java:858)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
at java.lang.reflect.Method.invoke(Native Method)
at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
at org.eclipse.core.launcher.Main.run(Main.java:747)
at org.eclipse.core.launcher.Main.main(Main.java:583)
|
|
|
|
Re: Use jaxp with jdk1.3.1 for plugin development [message #117594 is a reply to message #102053] |
Wed, 27 August 2003 15:45  |
Eclipse User |
|
|
|
Originally posted by: gentijo.eyecatching.com
Look at the transclipse project in Sourceforge, the EndorsingClass
Loader does a good job even under JDK 1.4.x. It allows you to load
an external referenced JAR for Xerces & Xalan and override the
bootclass path.
-John G
Gerald Preissler wrote:
> Gerald Preissler wrote:
>
>> Hi folks,
>>
>> maybe someone can help us with this one:
>>
>> We're trying to develop an eclipse plugin that uses Xerces 2.4.0 via
>> the jaxp api to parse an xml file. Due to restrictions from the
>> environment under which the final installation should run, we have to
>> use jre 1.3.1 as runtime environment.
>>
>> The following code works fine in a "normal" java project using jdk
>> 1.3.1_08 :
>>
>> // Get Document Builder Factory
>> DocumentBuilderFactory factory =
>> DocumentBuilderFactory.newInstance();
>>
>> // Turn on validation, and turn off namespaces
>> factory.setValidating(false);
>> factory.setNamespaceAware(true);
>>
>> DocumentBuilder builder = null;
>> builder = factory.newDocumentBuilder();
>> if (builder != null) {
>> this.doc = builder.parse(stream);
>> }
>>
>> When using the same code within a plugin, I can build the project
>> without problems. However, I get a NoClassDefFoundError when getting
>> the DocumentBuilderFactory instance (see end of document for complete
>> stacktrace). This only happens when I specify jre 1.3.1 in the run...
>> dialog. The Xerces jars are include in the source lookup path under
>> Run...->Source. When I use jre 1.4.1 with the vm argument
>> -Djava.endorsed.dirs pointing to the dir where I installed the Xerces
>> jars, everything works fine.
>>
>> Can anyone provide an explanation or (even better :-)) a solution to
>> use the jaxp api in a plugin under jre 1.3.1?
>>
> [..]
>
> Ok, this is solved now. Just in case someone runs into the same problem:
> You can solve it easily by including a dependency on org.apache.xerces
> in your plugin.xml and removing any references to other xerces jars from
> your project and the run... configuration.
>
> Still the question remains if there is a canonical way to use a
> different xerces version from within a plugin. Can anyone give some
> information?
>
> kind regards
> Jerry
>
|
|
|
Powered by
FUDForum. Page generated in 0.15626 seconds