Re: Ressource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory
Aleksander Slominski <[email protected]> Tue, 04 Mar 2003 13:02:18 -0500
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
Naresh Bhatia wrote:
> I am having trouble creating an instance of XmlPullParserFactory in my
> J2EE application. I have tried two ways:
>
> 1) XmlPullParserFactory factory = XmlPullParserFactory.newInstance(
> System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
>
> 2) XmlPullParserFactory factory = XmlPullParserFactory.newInstance(
> System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
> Thread.currentThread().getContextClassLoader().getClass());
>
this will not work as both causes to use system (bootstrap) classloader
that has no XPP3 classes
(getContextClassLoader().getClass() returns ContextClassLoader.class
that is one of system classes).
try instead to point to your app class (YourAppClass)that is in current
class loader context
3) XmlPullParserFactory factory = XmlPullParserFactory.newInstance(
System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
YourAppClass.class);
as in this case all XPP3 classes are in one jar (and not split into API
and impl that could be placed in two different class loaders) you can
simply use:
4) XmlPullParserFactory factory = XmlPullParserFactory.newInstance(
System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
XmlPullParserFactory.class);
i have also fixed XmlPullParserFactory to use XmlPullParserFactory.class
as default context and not String.classs
please let me know if it is (not) working now.
thanks,
alek
--
"Mr. Pauli, we in the audience are all agreed that your theory is crazy.
What divides us is whether it is crazy enough to be true." Niels H. D. Bohr
------------------------ Yahoo! Groups Sponsor ---------------------~-->
New Yahoo! Mail Plus. More flexibility. More control. More power.
Get POP access, more storage, more filters, and more.
http://us.click.yahoo.com/Hcb0iA/P.iFAA/46VHAA/2U_rlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/