On Mon, 9 Sep 2002, Shankar wrote: > Hello, > > I have 2 projects, say Project A, Project B. > > For running the Project A I must use Xerces DOM Parser and > for Project B I need Crimsion DOM Parser. > I am using Websphere VisualAge4.0. > > I used the following code for instatiating DOM Parser in Project A: > javax.xml.parsers.DocumentBuilderFactory dbf = > DocumentBuilderFactory.newInstance(); > > When Project A alone is in the Websphere Environment classpath, it takes > Xerces Parser and everything is O.K. > But when I included both Projects in the Websphere Environment > classpath, it alwaya takes Crimsion. So, I couldn't execute my Project A > application. > > Anybody have any ideas how the "DocumentBuilderFactory.newInstance()" > determines which parser to select when more than one parsers exists in > the Websphere Environment..?
It is probably just taking what it finds first, i.e. what's first on the CLASSPATH. You probably shouldn't be putting things on the CLASSPATH, the latest servlet spec allows a whole directory structure for including classes and libs in your webapps, partly just to deal with the situation you're running into. Each context/web application has a classes directory and a lib directory (under WEB-INF) where you can put stuff particular to that context/web application. You should try putting Xerces in Project A's classes or lib directory, and Crimson in Project B's. There are also container-wide classes/lib directories for putting stuff that all contexts/web applications should have access to, and server classes/lib directories for stuff that Tomcat itself should have access to. Like I said, this is all for dealing with conflicts similar to what you ran into (and so you don't have to use CLASSPATH). Anyway, this is the way Tomcat is set up, I assume Websphere is set up similarly. Milt Epstein Research Programmer Integration and Software Engineering (ISE) Campus Information Technologies and Educational Services (CITES) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED] ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html