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

"Naresh Bhatia" <[email protected]> Tue, 4 Mar 2003 08:15:28 -0500
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
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());

The exception I get is:

    org.xmlpull.v1.XmlPullParserException: caused by:
org.xmlpull.v1.XmlPullParserException:
        Ressource not found:
/META-INF/services/org.xmlpull.v1.XmlPullParserFactory
    at
org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.jav
a:284)

My ear structure is shown below. Notice that xpp3_1.1.2.1.jar is sitting
at the root level and I am trying to access it from my webapp. There is
an appropriate Class-Path entry in MANIFEST.MF of my webapp. The webapp
code finds the jar correctly, as evidenced by the execution of
XmlPullParserFactory.newInstance( ). However, line 284 does not find
/META-INF/services/org.xmlpull.v1.XmlPullParserFactory which is sitting
in xpp3_1.1.2.1.jar. I have tried creating
/META-INF/services/org.xmlpull.v1.XmlPullParserFactory at the root of
the ear as well as the root of the war but it is still not found. Any
ideas how to solve this problem?

MyApp.ear
  META-INF/Manifest.mf (Class-Path is empty)
  META-INF/services/org.xmlpull.v1.XmlPullParserFactory
  xpp3_1.1.2.1.jar
    META-INF/services/org.xmlpull.v1.XmlPullParserFactory
  MyWebApp.war
    META-INF/Manifest.mf (Class-Path: xpp3_1.1.2.1.jar)
    META-INF/services/org.xmlpull.v1.XmlPullParserFactory

Thanks.
Naresh