Hi, Thanks a lot for response. Yes, I have a map of filename as indexes and their value is parsed dom object for xml. This problem "File not found " exception is coming intermittentely. Please find the attached files for our resolver and transformer code. Resolver.txt is our implementation which get called from transformer. XML_TRANS.txt is the file where we implement XML transformer. We are trying to re-produce but the problem is not occuring in development. It is happening in PRODUCTION intermittently. Could you please take a look on these files and can point something which could lead this problem. Regards Ajay
--- On Thu, 6/3/10, kesh...@us.ibm.com <kesh...@us.ibm.com> wrote: From: kesh...@us.ibm.com <kesh...@us.ibm.com> Subject: Re: File not found exception during xml transformation To: j-us...@xerces.apache.org, "xalan-j-users@xml.apache.org" <xalan-j-users@xml.apache.org> Date: Thursday, June 3, 2010, 12:21 AM First obvious question: You say you have the document in a Map; I presume you mean a Java Map indexed by the filename. Xerces and Xalan won't look there unless you have plugged in a user-written Resolver which recognizes the URI you are requesting and retrieves the document from the Map object rather than the file system or network. I'd suggest setting a breakpoint in that resolver to check that it's doing what you think it's doing. Note that what the resolver sees *is* a URI, not a filename, so you may need to use the file:// "scheme"; otherwise, a filename will usually be interpreted as relative to the enclosing document's base URI. Again, having the debugger stop in the resolver will let you see what's actually being passed to it, so you can change either the call to the document() function or the resolver's logic as appropriate. If those suggestions don't solve the problem for you, post more specifics -- exactly what the resolver you've written looks like, exactly what the Map's keys are, exactly what the URI passed to the document() call looks like. We need to know exactly what you're doing before we can offer specifics. ______________________________________ "... Three things see no end: A loop with exit code done wrong, A semaphore untested, And the change that comes along. ..." -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://www.ovff.org/pegasus/songs/threes-rev-11.html) From: Michael Glavassevich <mrgla...@ca.ibm.com> To: j-us...@xerces.apache.org Date: 06/02/2010 02:37 PM Subject: Re: File not found exception during xml transformation Hi Ajay, ajay bhadauria <abhadau...@yahoo.com> wrote on 06/02/2010 01:41:32 PM: > I am using xalan-2.7.1. Okay. So you should have asked this question on the Xalan user mailing list. > I have server which has xslt and external > document in Map. The external xml document is called from xslt using > xslt document function. > > During xml transformation, we are getting File not found exception in between. > > Transformation Exception : File not found: java.lang.NullPointerException > > org.apache.xalan.xsltc.TransletException: > java.io.FileNotFoundException: swift.mvaltest01$GetAccount.xml > > swift.mvaltest01$GetAccount.xml is stored in Map. > I do not know why it is saying FileNotFound Exception though > external document is stored in java Map and external doucument is > resolved through resolver. > > Any idea / thought Better ask the Xalan folks and they'll probably need more context (e.g. stack traces, code, etc...) to be able to tell you what's going on. > Thanks > Ajay > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org
public Source resolve(String href, String base) { int IndexValue = base.lastIndexOf('/'); String systemID = base.substring( 0, IndexValue ) + "/" + href ; Source source = null; // Below baseURI check is required to differentiate between file-system and // database resolving of dependent schemas. If wrapper schema is coming from // database, then systemId contains file:/// and if it id coming from file-system file // then systemId contains full pathname e.g file:////opt/mval. if ( base.length() == 8 ) { isSchemaResolveFromDB = true ; } Reader xsltReader = null ; String systemId = null; if ( isSchemaResolveFromDB ) // This will resolve xslt from database { xsltReader = m_smf.resolveSchema( base.substring(0,IndexValue) + "/" + href ); source = new StreamSource( xsltReader ); } else if ( isExternalDocFromMap ) // this will resolve document from map { source = (DOMSource) externalDocument.get( href ); // externalDocument is a map storing the key and parsed xml documents } else // this is needed to resolve xslt from file-system files { source = new StreamSource( new File ( base.substring(0,IndexValue) + "/" + href ) ); } source.setSystemId(systemID); return source ; }
public void process(Document doc, String ns, Result result) throws SAXException { try { template = adjCache.getAdjunct( ns ) ; Source source = new DOMSource( doc ); xformer = template.newTransformer(); xformer.setURIResolver( entityResolver ); xformer.setErrorListener( this ); xformer.transform(source, result); processXsltResult(); // clear all the data structures which are not required // after xslt processing clearXsltProcessedObjects(); xslhandler.clearCodeAndContext( threadId ); } catch ( TransformerException e) { // Clear all the storage area with this thread clearXsltProcessedObjects(); xslhandler.clearCodeAndContext( threadId ); throw new RuntimeException( e.getMessage() ) ; } } public void error(TransformerException exception) throws TransformerException { semanticErrors.error( exception ); } public void fatalError(TransformerException exception) throws TransformerException { semanticErrors.fatalError( exception ); } public void warning(TransformerException exception) throws TransformerException { semanticErrors.warning( exception ); }