RE: Ressource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory

"Naresh Bhatia" <[email protected]> Tue, 4 Mar 2003 13:55:50 -0500
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
Both 3) and 4) work!
 
Thanks for your help.
Naresh

	-----Original Message-----
	From: Aleksander Slominski [mailto:[email protected]] 
	Sent: Tuesday, March 04, 2003 1:02 PM
	To: [email protected]
	Subject: Re: [xmlpull-dev] Ressource not found:
/META-INF/services/org.xmlpull.v1.XmlPullParserFactory
	
	
	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	
ADVERTISEMENT
 
<http://rd.yahoo.com/M=246920.2960106.4328965.2848452/D=egroupweb/S=1706
030390:HM/A=1464858/R=0/*http://www.gotomypc.com/u/tr/yh/cpm/grp/300_Cqu
o_1/g22lp?Target=mm/g22lp.tmpl> 	
 
<http://us.adserver.yahoo.com/l?M=246920.2960106.4328965.2848452/D=egrou
pmail/S=:HM/A=1464858/rand=321603860> 	

	To unsubscribe from this group, send an email to:
	[email protected]
	
	
	
	Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .