Help: Problems accessing XML file in WebSphere 3.5 Fix Pack 4 on Solaris

We are having an emergent issue with WebSphere 3. 5 Fix Pack 4 on Solaris 2.6: The WAR file we deployed fails with runtime exception due to the inability

to access a local resource(XML file) in the converted WAR file's web directory.

The way we access this XML file is as follows:

ServletContext theCon = getServletContext();

URL u = theCon.getResource ("/web/test.xml");

String newPath = u.toExternalForm ();

InputStream is = new URL (newPath).openStream();

The InputStream returned from the URL object is NULL.

After checked the URL's externalForm string, we noticed that its protocol part is "classloader", e.g. the whole URL string is like "classloader:/opt/...../web/test.xml". However, if we replaced "classloader" with "file", the problem disappeared and the XML file can be read without error.

Anybody know why "classloader:" in the URL string cause this problem, and what is the solution without changing the URL string?

Thanks a lot!

[1026 byte] By [yaox0018] at [2007-9-26 1:21:16]
# 1
Hi,Can you try to replace the two last lines with:InputStream is = new FileInputStream (u.getFile()); Hope this helps,Kurt.
leukbr at 2007-6-29 0:56:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Hi Kurt,Thank you for the suggestion!But the same code works in WebSphere 3.5 (Fix Pack 4)on NT. Any idea why it fails on Solaris?Thanks!
yaox0018 at 2007-6-29 0:56:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...