I have the following snippet of code running successfully in a J2EE 1.2 level (servlet 2.2/JSP 1.1).
javax.xml.transform.Source xslSource = new javax.xml.transform.stream
.StreamSource(AvXSLTServlet.class.getClassLoader()
.getResourceAsStream("/yyy/zzz/xslt/SearchResults.xsl"));
The servlet resides in a different package but the same .war file as the xsl document.
When I ported my code to JBoss same code returns a NullPointerException. It seems that it can't find the xsl document. First I tried placing the xsl document in the same package as the calling servlet - this didn't make a difference.
The following code does work:
javax.xml.transform.Source xslSource = new javax.xml.transform.stream
.StreamSource(new File("c:\\XSLDir\\SearchResults.xsl"));
I don't wish to work with a reference to the underlying file system in my web app.
I'm extremely perplexed about the change in the J2EE classloading mechanism. Can anybody clarify how this works so I can massage my code to find the needed xsl?
Many thanks.
Doug