From inside a stateless session bean, I have done this successfully:

First, I put in my ejb-jar.xml file:

/META-INF/foobar.dtd
/META-INF/foobar.xml

Then, in code:

URL url = getClass().getResource("/META-INF/foobar.xml");
InputSource is = new InputSource();
is.setSystemId( url.toString() );
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
SAXParser parser = factory.newSAXParser();
parser.parse(is, myDefaultHandler);

I *think* your problem might have to do with the context of the 
classloading.  Mine works since I use the classloader of the bean itself.

Hope this helps,
David

--

Saroj Kumar wrote:
> Hi All,
> 
> I have got a XML which defines some constants which are read by my
> Session Bean while serving some requests. Reading is done in a helper
> class. I am unable to read this XML file.
> 
> I use :
> 
>     
>      InputStream fi = ClassLoader.getSystemResourceAsStream(xmlFile) ;
> 
>       I am getting fi as NULL.
>      
>      InputStreamReader isr = new InputStreamReader(fi);
>      
>      
>      InputSource is = new InputSource(isr);
>      
>      
>      DOMParser parser = new DOMParser();
>      
>      parser.parse(is)
> 
> Any help would be great;
> 
> SAROJ
> 



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to