You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Co...@trilogy.com on 2000/07/26 04:46:59 UTC
multiple DOMs
> On the flip side, I see all sorts of problems from people having two
> different sets of DOM interfaces in the classpath. If there was just one
> dom.jar in the classpath no matter how many parsers, it would be a good
> thing.
James' mention of this in the requirements thread just reminded me to ask:
is there a 'standard' or preferred way of getting out of such a bind? I
don't have to do with it right this moment, but it looks like within the
next few weeks I am going to have exactly this same problem: my code (which
is written against Xerces 1.1.x) is going to be integrated with a much much
larger set of code that uses XML4J 2.0.19 (or maybe it was .15). Anyway,
when I have tried this briefly before, the (currently separate) apps would
each break when they encountered DOM libraries that we're their own (so
when my code hit the DOM libraries from XML4J; or when the other code hit
the Xerces DOM libraries). Is there any good way out of this? They will
be tied together, so I can't really use the two different VMs/two different
classpaths approach that's working right now. I've had some people suggest
that the best approach is to write a custom ClassLoader to enforce that the
right libraries are loaded. I haven't done that before, so any comments on
difficulty/etc are welcome too...(Note: this has to be deployed on a Java
1.1 platform)
---
Corbett J. Klempay
Trilogy Software, Inc.
512.532.5176 (W) | 512.750.1372 (C)
corbett.klempay@trilogy.com
Re: multiple DOMs
Posted by Edwin Goei <Ed...@eng.sun.com>.
Lawrence Fry wrote:
>
> Eventually I found that Forte4j had a xml.jar with dom 1 buried in its
> compile classpath (I fixed that problem).
>
> The unnerving thing about this problem is that it will always occur if dom 1
> is in the path before dom 2. Many distributions have the dom interfaces
> buried in their jar, and as we update our applications with the new dom 2,
> it is sometimes difficult to dig out the 'ol dom 1's.
So I think what you are saying is there was a conflict with the IDE you
were using. The IDE had DOM level 1 classes in the classpath before
DOM2 classes that the app used. I would expect that apps would normally
not be run in an IDE when deployed. IDE users should be wary of such
conflicts. (I don't usually use an IDE BTW and instead develop on Unix
with a JDK.)
-Edwin
RE: multiple DOMs
Posted by Lawrence Fry <lw...@bbnow.net>.
Edwin,
Thanks for the reply. Before I sent this message, I had searched the
archive, and did discover several references to "no such method found", and
these came out just as the first dom2 version was put out.
As for Sun, I had put that blurb in since this was behavior on Forte4j and
Java. I got no response from the Netbeans mail service, or the Sun forum.
Eventually I found that Forte4j had a xml.jar with dom 1 buried in its
compile classpath (I fixed that problem).
The unnerving thing about this problem is that it will always occur if dom 1
is in the path before dom 2. Many distributions have the dom interfaces
buried in their jar, and as we update our applications with the new dom 2,
it is sometimes difficult to dig out the 'ol dom 1's.
Xerces or any other application that uses dom 2 could check if there is a
conflict, and trap the problem. Users will invariably blame the application
that exhibits the problem (Xerces), instead of the lack of a class
versioning system or registry in Java.
Regards,
Lawrence
>>
>> If one app calls the other app in the same virtual machine, all is lost.
>> Because the vm will load org.w3c.dom.Document from DOM 1 before
>> org.w3c.dom.Document is loaded from DOM 2, you will get a runtime error
of
>> "no such method found, importNode". See for example the five or six
>> messages already on this news group about this problem.
>
>I don't remember seeing these messages.
>
>>
>> I do not see a work around for this problem. Can anyone from Sun address
>> this issue?
>
>I do not think someone from Sun would be any more qualified than anyone
>else to address this question...
>
>The simplest solution would be to put the DOM2 classes in the classpath
>first. Why doesn't this solution work for you? DOM2 just adds new
>methods to DOM1.
>
>-Edwin
Re: multiple DOMs
Posted by Edwin Goei <Ed...@eng.sun.com>.
Lawrence Fry wrote:
>
> If one app calls the other app in the same virtual machine, all is lost.
> Because the vm will load org.w3c.dom.Document from DOM 1 before
> org.w3c.dom.Document is loaded from DOM 2, you will get a runtime error of
> "no such method found, importNode". See for example the five or six
> messages already on this news group about this problem.
I don't remember seeing these messages.
>
> I do not see a work around for this problem. Can anyone from Sun address
> this issue?
I do not think someone from Sun would be any more qualified than anyone
else to address this question...
The simplest solution would be to put the DOM2 classes in the classpath
first. Why doesn't this solution work for you? DOM2 just adds new
methods to DOM1.
-Edwin
RE: multiple DOMs
Posted by Lawrence Fry <lw...@bbnow.net>.
Corbett,
This issue of which dom is in the class path is certainly a problem.
Consider this, application A is self-contained, and uses all of its own
classes...except for a DOM 1 jar file so it can serialize in xml (hundreds
of applications are doing this now). Another app is to be integrated with
App A, lets call it Application B. Application B simply allows Application A
to communicate over the web with xml and http:. Application B uses DOM 2
because of the neat new document methods available(importNode, for example).
If one app calls the other app in the same virtual machine, all is lost.
Because the vm will load org.w3c.dom.Document from DOM 1 before
org.w3c.dom.Document is loaded from DOM 2, you will get a runtime error of
"no such method found, importNode". See for example the five or six
messages already on this news group about this problem.
I do not see a work around for this problem. Can anyone from Sun address
this issue?
Regards,
Lawrence Fry
-----Original Message-----
From: Corbett.Klempay@trilogy.com [mailto:Corbett.Klempay@trilogy.com]
Sent: Tuesday, July 25, 2000 7:47 PM
To: xerces-j-dev@xml.apache.org
Subject: multiple DOMs
> On the flip side, I see all sorts of problems from people having two
> different sets of DOM interfaces in the classpath. If there was just one
> dom.jar in the classpath no matter how many parsers, it would be a good
> thing.
James' mention of this in the requirements thread just reminded me to ask:
is there a 'standard' or preferred way of getting out of such a bind? I
don't have to do with it right this moment, but it looks like within the
next few weeks I am going to have exactly this same problem: my code (which
is written against Xerces 1.1.x) is going to be integrated with a much much
larger set of code that uses XML4J 2.0.19 (or maybe it was .15). Anyway,
when I have tried this briefly before, the (currently separate) apps would
each break when they encountered DOM libraries that we're their own (so
when my code hit the DOM libraries from XML4J; or when the other code hit
the Xerces DOM libraries). Is there any good way out of this? They will
be tied together, so I can't really use the two different VMs/two different
classpaths approach that's working right now. I've had some people suggest
that the best approach is to write a custom ClassLoader to enforce that the
right libraries are loaded. I haven't done that before, so any comments on
difficulty/etc are welcome too...(Note: this has to be deployed on a Java
1.1 platform)
---
Corbett J. Klempay
Trilogy Software, Inc.
512.532.5176 (W) | 512.750.1372 (C)
corbett.klempay@trilogy.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org