First, I am cross-posting this message to jboss-dev because I think it may
involve a development issue regarding class loaders.  At the minimum, I
think some explanatory material should be developed both for using other
XML parsers and for migrating to 2.2.x from earlier versions.  I am
willing to do this, but I know I won't be able to look at it at least
until next week, by which time I'm sure somebody else will have done
something.

Second, I apologize that this message is longer, less complete, and less
clear than I would generally hope, but I thought it better to send it than
to delay it until I have enough time, which may be never :-).

It seems to me that this problem relates to class loaders and the JAXP
mechanism for loading XML parsers, i.e. a factory method.  If
javax.xml.parsers.SAXParserFactory is loaded by the system ClassLoader
from crimson.jar, which is specified in the classpath given on the
command-line, then it will not have access to classes that are loaded
either from jboss/lib/ext, an MBean, or from the libraries of deployed
EAR files.  One solution, then, is to modify the scripts to put the Xerces
jar file in the classpath passed on the java command-line.  Then the
system ClassLoader will be able to see the classes.

However, this seems incomplete to me, since you can still only have one
value for the javax.xml.parsers.SAXParserFactory property, also passed on
the command-line.  I have not fully investigated this, but from a quick
glance at one of the former messages on jboss-user, it appeared that JBoss
itself would not work with Xerces specified as the parser.  If this is not
the case, I apologize to the developers for insinuating that it might be.
If it is true, then I think part of the solution is to modify JBoss so
that it can work with either Xerces or Crimson (or any other
JAXP-compliant parser).  Again, I can work on this, but not until at least
next week.  For those who may want to test this, put the Xerces jar file
in the classpath passed on the java command-line *BEFORE OR INSTEAD OF
CRIMSON* and specify -Djavax.xml.parsers.SAXParserFactory appropriately (I
think it may be the following)

    set 
JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    set JAXP="%JAXP% 
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"

Note: UNIX users will need to adjust that to

    
JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    JAXP="$JAXP 
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"

Finally, the potential jboss-dev issue is this: is there some way that
beans or components (e.g Tomcat) could each be able to specify their own
XML parser and factory?  I'm not well-versed in the details of class
loading, so JBoss may already be doing the best that can be done given
Java classloading semantics, but I considered it worth asking the
question.

Xandy

On Mon, 14 May 2001, Dave Ortman wrote:

> I got a similar error.... and I'm not sure why.  Can anyone explain?
>
> In the meanwhile, if you change your scripts so that the Xerces jar files come
> AFTER all the JBoss jar files (run.jar, etc.) in the CLASSPATH, then all should
> work fine.
>
> -Dave Ortman
>
> >Folks,
> >
> >
> >I tried to configure JBoss to use Xerces as suggested but get the following
>
> >error at start-up:
> >
> >
> >JBOSS_CLASSPATH=;/lib/tools.jar;D:\Development\Landmark\Xerces\Xerces-1_3_1\
>
> >xerces.jar;run.jar;D:\Development\Landmark\Xerces\Xerces-1_3_1\xerces.jar;..
>
> >/lib/crimson.jar
> >jboss.home = C:\JBoss-2.2.1_Tomcat-3.2.1\jboss
> >Using configuration "tomcat"
> >[Info] Java version: 1.3.0,Sun Microsystems Inc.
> >[Info] Java VM: Java HotSpot(TM) Client VM 1.3.0-C,Sun Microsystems Inc.
> >[Info] System: Windows NT 4.0,x86
> >[Shutdown] Shutdown hook added
> >[Service Control] Registered with server
> >Exception in thread "main" [Default]
> >javax.xml.parsers.FactoryConfigurationError:
> >org/apache/xerces/jaxp/DocumentBuilder
> >FactoryImpl -Djavax/xml/parsers/SAXParserFactory=org/apache/xerces/jaxp/SAXP
>
> >arserFactoryImpl
> >[Default]       at
> >javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.
>
> >java:154)
> >[Default]       at org.jboss.Main.<init>(Main.java:192)
> >[Default]       at org.jboss.Main$1.run(Main.java:107)
> >[Default]       at java.security.AccessController.doPrivileged(Native
> >Method)
> >[Default]       at org.jboss.Main.main(Main.java:103)
> >[Default] Shutting down
> >[Service Control] Stopping 0 MBeans
> >[Service Control] Stopped 0 services
> >[Service Control] Destroying 0 MBeans
> >[Service Control] Destroyed 0 services
> >[Default] Shutdown complete
> >
> >
> >
> >Any ideas?
> >
> >
> >The overall problem is that I want to use SOAP.
> >JBoss ZOAP doesnt appear to be supported at the mo, so I downloaded  Apache
>
> >SOAP 2.1 whiuch needs the Xerces parser...
> >
> >
> >
> >Thanks in advance  - Adam.
> >
> >
> >
> >-----Original Message-----
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED]]On Behalf Of Chris
> >Winters
> >Sent: Monday, May 14, 2001 2:48 PM
> >To: [EMAIL PROTECTED]
> >Subject: Re: [JBoss-user] Using Xerces
> >
> >
> >* Manuel Alzola ([EMAIL PROTECTED]) [010512 12:09]:
> >>     Hello, I�m trying to use xerces on jboss-tomcat, as I was doing in
> >standalone tomcat, but it continues using crimsom , and I suppose it becouse
>
> >of this lines in jboss run.bat
> >>
> >> set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;../lib/crimson.jar
> >> set
> >JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.Docu
>
> >mentBuilderFactoryImpl
> >> set
> >JAXP=%JAXP% -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAX
>
> >ParserFactoryImpl
> >>
> >> I have not found in xerces docs a JAXP equivalent, and I need Xerces
> >> becouse crimson fails me when working with Xalan for xsl processing.
> >
> >As long as you've got the xerces classes in the classpath, the
> >following should work:
> >
> >set
> >JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.Docum
>
> >entBuilderFactoryImpl
> >set
> >JAXP="%JAXP% -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAX
>
> >ParserFactoryImpl"
> >
> >Hope this helps.
> >
> >Chris


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to