java ee - DocumentBuilder FileNotFoundException when parsing xml String using continuous deployment on tomcat -


i have utility class converts object xml string , builds pdf out of it.

the class working fine started use continuous deployment on tomcat (i.e. app.war deployed app##00010.war , new version of app uploaded twice day) , since having massive issues documentbuilder.

my utility class has load several files class path (dtd, fop conf, xsl styesheet, etc.). use full path [path start]/tomcat 7.0/webapps/app##0010/[path file] load files filenotfoundexception [path start]\tomcat 7.0\webapps\ app (the system cannot find file specified).

hence documentbuilder seems ignoring full path giving him.

here method use converts xml string xml file:

    public static document stringtoxml(string xmlsource) throws saxexception,parserconfigurationexception,         malformedurlexception,ioexception{     documentbuilderfactory factory=documentbuilderfactory.newinstance();     factory.setnamespaceaware(true);     documentbuilder builder=factory.newdocumentbuilder();      return builder.parse(new inputsource(new stringreader(xmlsource))); } 

and xmlsource "<?xml version="1.0" encoding="utf-8"?><!doctype doc system "file:///[path start]/tomcat 7.0/webapps/app##0010/ [...] /pdf.dtd">"

any idea of how solve issue?

ok fixed using custom entity resolver shown in post: parsing xml file dtd schema on relative path


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -